This last academic year, as a part of our Senior Design Project for an undergrad program in Mechanical/Aerospace Engineering at the University of Miami, my team (Mark Agate and Stephen Markus) and I developed a basic collision avoidance system using sonar sensors.
We first constructed a relatively rigorous 6 degree of freedom simulation in Matlab's Simulink where we developed and tested our control system. We interfaced our simulation with FlightGear to provide a visual medium for our control system. Below is a figure from the simulation showing the quad's response to barriers in the front, back, left, and right directions:
In the lab we worked in (the RISE lab), we had a JDrones ArduCopter Quadcopter kit with an APM 1.6 autopilot. We used four MaxBotix MB1200 XL-EZ0 sensors for detection. We designed custom 3D printed legs that replaced the stock kit legs. The legs we designed allowed for mounting of the sonar sensors along with "shields" we printed to reduce the interference between the sensors (effectively reduced error in readings from 16.6% to 0.345%). Above is a picture of the setup, with the 3D printed legs in green and shields in orange.
Our initial plan was to read the sonar readings in the APM, transmit them over Xbee radios using MAVLink, read them using our Simulink model (our model could be used both as a sim and as a real-time controller), calculate the necessary control values, and transmit back PWM commands using MAVLink and Xbee. However, we were unable to effectively use Xbee and MAVLink, and time constraints forced us to look at other options. We focused our efforts instead on full onboard integration. We modified the ArduCopter code to run our collision avoidance system when the mode was toggled by our RC transmitter. In the collision avoidance mode, the ArduCopter takes the sonar readings, determines whether it's in the user specified "danger zone," and, if it is, executes the necessary calculations and maneuvers to leave the danger zone.
Below is a video of outdoor/indoor tests of the system with only the front sonar activated:
Because we were using the APM 1.6, we only had one available analog port. Therefore, if we wanted to use more than one sonar sensor during flight, we would have to convert the signals to digital signals and use the I2C port. We daisy-chained the sensors together, as documented on the MaxBotix website, and sent the 4 analog signals into an analog to digital converter (ADC). The ADC sent a digital signal using I2C specifications to the APM. We wrote Arduino code that interpreted the digital signal and read the 4 separate sonar readings. However, this code required the Arduino Wire library. During the HAL process, the ArduPilot developers removed any Arduino-specific library dependencies, so the Wire library was no longer supported. Instead, the "HAL.I2CDriver" library had to be used. Again, due mainly to time constraints, we were unable to successfully port our code from using the old library to the new library. Therefore, we were only able to flight test using 1 sonar sensor, as shown above.
Because the 3 of us graduated, no further work was done on this project. Before we finished, though, we identified a few things that could be done to improve the project, for ourselves or anyone else trying a similar project. First, the APM 2 should be used, not only because it is newer, but because it has more analog ports. This would allow you to connect, I believe, up 4 sonar sensors using analog signals. Then you can proceed how we did and modify the ArduCopter code to run a basic collision avoidance system. Or, if you can manage the Xbee and MAVLink protocols, you can use another Arduino board, such as the Uno, to read the sonar sensors and transmit their readings to a ground control station. There, you can run your avoidance system and send back maneuver commands to the ArduCopter. Another option would be to use sensors that output their readings digitally, as this will simplify the process and eliminate the need of an ADC or extra Arduino board.
Thank you for reading this lengthy post. If you have any comments or questions, feel free to post them. Happy flying!
-Sarmad Chaudhry, Mark Agate, and Stephen Markus
Comments
Hi Hugues,
Thank you! They are actually 3D printed out of ABS plastic, about 2.5mm thick. They were designed to block the rebounding ultrasonic waves from one sensor hitting the other three, since they are so close to each other. For example, if the left side was approaching a wall and the other three sides were not, the rebounding wave might not only hit the left sensor, but also the right, or front and back sensors. The addition of these shields is what decreased out precision error in the 95% confidence interval from 16.6% to 0.345%!
Nice project. What are these orange shields made of and against what so they shield: EMI? Air vibrations?
Hi Thomas,
I actually tested for that exact type of interference. My experiment showed a negligible amount of- if any- interference from the turbulent air flow from the propellers past the ultrasonic sensors. I tested from idle to max throttle and the interference was minimal. So at least for our prototype, we did not encounter those problems. With the shield on and in flight, we achieved very good precision (0.345% error in the 95% confidence interval as eluded to in the article). Thank you for your read and input!
Sincerely,
Stephen Markus
@Sarmad,
I notice that you have the props pushing turbulent air flow down in front of the sonars.
My experience with the Maxbotix sonars on my rovers is that they are susceptible to false triggering on turbulent airflow perpendicular to the ultrasonic beam.
Regards,
TCIII ArduRover2 Developer
Clever!