[driver] Add driver for Ultrasonic ranging module#47
[driver] Add driver for Ultrasonic ranging module#47kevalpatel2106 wants to merge 4 commits intoandroidthings:masterfrom
Conversation
|
Thanks for your pull request. It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). 📝 Please visit https://cla.developers.google.com/ to sign. Once you've signed, please reply here (e.g.
|
|
I signed it! |
|
CLAs look good, thanks! |
|
Any plans to merge this PR? |
|
@kevalpatel2106 , thanks for the PR. Are you getting reliable measurements using this driver? Android Things is not a real time OS, so there's no guarantee that a timing-sensitive protocol like the one in HCSR04 wouldn't be affected by competing threads/processes. We are working on a solution for it, and when we have it, we will work with you to review and add your driver to the official library. How does that sound? |
|
@mangini That sounds good. I am getting almost up to 4-5 cm accuracy with this driver. I am using it one of my DIY Robocar projects. To make it real time, I am spinning two different threads. One to send the pulses and another to get the echoes. |
|
Great. You can define different thread priority, but it still won't be real time. I will keep this PR open until we have a better way of doing it. |
|
Good morning, |
|
@Fleker Sure I will do it. |
I have added driver for the ultrasonic ranging module to measure the distance of the object from the sensor. I have tested this driver using HC-SR04 ultrasonic sensor. It has simple implementation and a callback listener to get the distance value in centimeters.