3689602503?profile=original

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:

3689602335?profile=original

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

E-mail me when people leave their comments –

You need to be a member of diydrones to add comments!

Join diydrones

Comments

  • Hello, very nice project. Me and my team are at the stage of software developing through simulink. We get a problem with multiple ultrasonic sensors handling. THere is an issue when we try to get the distance outputs for all sonars during simultaneous operation of all rotors. We can not find a solution... in your performance you used only one. What happens with all sonars. Any advice?

  • Hi Sarmad, Mark, and Stephen,

    Great work! I am currently undertaking a similar project for an undergraduate internship in France. The platform is the IRIS+, at  this stage I am creating a new flight mode 'object avoidance' to essentially do exactly what you've all done.

    Can I have a copy of your final report please? It appears I am starting off where you guys have finished.

    Cheers,

    CallumT

  • Hello! I am working on a project similar to your; however, My sensor code is not working for some reason. I have been analyzing my code but I can't see what I am doing wrong. Is there any way you can share the code with me to see what I am doing wrong? That will help me with the project. I will really appreciated it. My email is isadyvelazco@live.com. Thank you!!
  • You had really done a great job. i am doing a similar thing to your project which is my bachelor thesis in university. if u kindly send the documentation of your project to my email address (Hameed.omari@kpu.edu.af) in order to have my project. i facing lots of problem during this project so kindly help in the completion of my project.

  • And sorry, was referring to mavlink not sure how that became mailing?
  • Glad to see more work in the multi sensor collision space.
    Did your shield testing drive the dimensions and any results that determined size to relative distance from other sensors? Someone asked about the code, is it available somewhere?
    I am about to work on a similar process that will likely be configured with 5 sonar sensors and optical flow. Test bed is a y6 b frame. I want core collision onboard however I will also have a mailing for tasking of other functions. Running on pix hawk.
    Good work!
  • all the collision projects i've seen out there are kinda of meaningless because none of them are exploring the scenario where you voluntarily push the quad into a wall... (i'm thinking car safety features availlabe in many brands like Lexus or so)

    your quad seems sleepy and not reactive did you try to move it agains an object instead of moving the object?

  • Sounds great, is the code available anywhere?

  • For those who have issues with acoustic noise using MaxSonar sensors: http://www.maxbotix.com/articles/067.htm

    @Thomas: I guess the effect is negligible in this case due to polarization of acoustic noise and measurement (90°). If you point the sensor downwards (as we did), you can't use it under a motor.

  • Developer

    nicely done!

This reply was deleted.