Obstacle avoidance with Sonar

I have used sonar in the past on quads to help maintain altitude during auto flights, loiter, and land mode. Some colleagues  of mine want to try to use sonar not for altitude corrections but rather obstacle avoidance like the functionality of the optical flow sensor. I believe that the code in ArduCopter V3.0.1 does not support sonar in such an application, and that to do this it would require additions to the ArduCopter V3.0.1 firmware. My question is; is my line of thinking correct, and how involved would such changes to the APM's code would this require?

Thanks in advance,

Will

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

Join diydrones

Email me when people reply –

Replies

  • Discussion update:

    This post, back in late 2013 early 2014, was intended to probe the challenges involved with engineering and designing a quad, that would be flying fully autonomously beyond line of sight in the Swiss Alps, that could see and avoid obstacles that where unknown to the flight planner. Since then my involvement in the project, QuadForge (http://www.quadforge.net/), has declined to a minimum and the project has moved in other directions.

    Consequentially, I have not made progress into such endeavors as obstacle avoidance. I am however very interested in terrain following with Lidar (such as seen here: http://diydrones.com/profiles/blogs/terrain-following-missions-usin...) or with sonar for applications within open pit mines and quarries and intend to develop a system for it in the near future for my newest employment and to begin a discussion on this topic as well.

    Cheers,

    Will F

    東京都でストーカー対策は探偵事務所に相談しよう!
    東京都でストーカー対策は原一探偵事務所に相談しよう!
  • Hello,

    I have successfully run 5 sonars on my quadcopter using the NEWPING library on arduinomega 2560 board. Can any body help me how to integrate my arduinomega 2560 with APM 2.8 so that the quadcopter would react accordingly. I think that this can be done using telemetry radio and a PPM encoder but I need the code for integrating the system. I am actually trying to implement obstacle avoidance.

    The following code can be used for obstacle avoidance:

    #include<Servo.h>
    Servo aileron,elevator;
    int setpoint=60,Kp=3;
    void setup()
    {
    Serial.begin(9600);
    aileron.attach(9);
    elevator.attach(10);
    }
    void loop()
    {
    int left,right,front,back;
    int d1,d2,d3,d4;
    int temp,temp1,temp2,temp3;
    int e1,e2,e3,e4;
    int op1,op2,op3,op4,opx,opy;
    temp=0;
    temp1=0;
    temp2=0;
    temp3=0;
    for(int i=0;i=10;i++)
    {
    left = analogRead(A0);
    temp=temp+left;
    }
    d1=temp/10;
    for(int i=0;i=10;i++)
    {
    right = analogRead(A1);
    temp1=temp1+right;
    }
    d2=temp1/10;
    for(int i=0;i=10;i++)
    {
    front = analogRead(A2);
    temp2=temp2+front;
    }
    d3=temp2/10;
    for(int i=0;i=10;i++)
    {
    back = analogRead(A3);
    temp3=temp3+back;
    }
    d4=temp3/10;
    e1=d1-setpoint;
    e2=d2-setpoint;
    e3=d3-setpoint;
    e4=d4-setpoint;
    op1=e1*Kp;
    op2=e2*Kp;
    op3=e3*Kp;
    op4=e4*Kp;
    opx=1500-op1+op2;
    opy=1500-op3+op4;
    aileron.writeMicroseconds(opx);
    elevator.writeMicroseconds(opy);
    Serial.println(left);
    Serial.println(right);
    Serial.println(front);
    Serial.println(back);

    }

    regards!

  • Can't be done, no room in APM, PIX maybe.

    See my other posts for a picture of a sonar set up. The code to pulse the sensors, determine good data from bad, and command the quad, gets long and very involved,

     

    With APM, I had to add another Arduino, but it does work (very well in fact).

     

    Good luck :)

     

    • I searched through your posts to find the info on the sonar setup but was unable to locate it.

      I have an APM 2.6 with a quadcopter setup and I am trying to do some basic obstacle avoidance such as turning a pre-planned direction once an obstacle is detected.  I have some sonar sensors but am considering using optical flow as well.

      Any suggestions?

    • Bump, with Pixhawk here, and with great sensors like LIDAR-Lite, Pixy (CMUcam5) and PX4Flow, Other Maxbotix sonars, etc.. time to kick off a project for sensor integration.. lets call it .... drum roll.... "Project Dodgem" ;)

This reply was deleted.

Activity

Derrick Davies liked lisa TDrones's profile
Wednesday
xemone liked Max Gilson's profile
Aug 31
nick rymer left a comment on ArduCopter User Group
"I recently switched laptops and now have Windows 10. I installed Mission Planner on my laptop and plugged a mRo SiK Telemetry Radio into the USB port. The radio is not recognized on the com ports but is instead on the "Other Devices" tab in Device…"
Aug 20
More…