Repository navigation
Ultrasonic Array Arduino
I have an array of 5 ultrasonic sensors positioned around the edge of the base, pointing outward. For now they are static (constant direction relative to the base), although front-center sensor is mounted on a servo and could be rotated in the future. The sensors are connected to the arduino, which is plugged into a USB port on the pi. The arduino is powered separately directly from the 5V rail, although it may be possible to power it via the USB port.
I installed the rossserial and rosserial_arduino libraries on both the pi and my laptop (sudo apt-get install ros-kinetic-rosserial). Following the instructions on this page, I installed the relevant ROS libraries on my laptop in /usr/share/arduino/libraries. I had to explicitly select the library by starting the arduino IDE, and then selecting Sketch > Import library... > Add library... from the menu and then choosing the folder ~/Arduino/libraries/ros_lib. The ROS examples are then visible in File > Examples. A highly relevant example is IrRanger.
I introduce a node called "ultransonic_array" that runs on the pi and communicates with the arduino. For the time being, this will be one-way communication, with the node accepting incoming readings from the serial port. It loads calibrations, and maintains a list of readings, with their directions and variances. The variance should just be proportional to the time since the reading was acquired. The calibrations consist of the orientations of the sensors w.r.t. the base.
Eventually I will want to add 1) the ability to select which order the readings are acquired in, and 2) control over any servos that the sensors are mounted upon. In this way, readings can be focused on a direction of interest, e.g., the direction of travel. For now, the readings are acquired in a constant clockwise order.
I'm using these ultrasonic rangefinders. They have a maximum range of 4 meters, which means that we may need to wait up to 11800 us for the echo.