Add PING))) Ultrasonic Distance Sensor library


I would like to add support for the Parallax PING))) Ultrasonic Distance Sensor to the existing Sensor Library.
This is on the ArduRover code. Can someone point me to the right direction, I just need some guidance in understanding the flow through of the ArduRover code.

I am a C/C++ programmer. I have Previously built some projects that uses the PING))) sensor and programmed the Arduino Uno platform.


I’ve never messed with the ArduRover code. I have done a bit of work with custom device drivers before so I can provide a roadmap.

First, pick an existing device driver and figure out how it works. The AP_BattMonitor is a nice and easy place to start. Read the code and get a really good idea how it works, then see how it’s integrated with the rest of the main code.

Second, figure out how you’re going to communicate with the ultrasonic distance sensor. Is it analog, UART, I2C? Draw up on paper how you’d like the software to work.

Third, write your device driver. Don’t try to integrate it with the main code just yet. It’s much easier to take things one step at a time.

Fourth, write a small utility to help you debug the driver. AP_BattMonitor/examples/AP_BattMonitor_test has a good example of this. It’s simple code that checks to see if everything is working correctly.

Finally, integrate your device driver with the main code. Look at how the current ultrasonic sensor library interfaces. That’ll give you a good place to start.