Programming Arducopter APM 2.5

NMAIST

Beginner.
Hey Guys,

Me and a couple of friends built an Arducopter and we have been able to fly it, but we want to be able to program it to fly autonomously and perhaps integrate sensors to it too.

Is that possible? If so, can you please post some useful information and links? We know that the APM is Arduino based and we would really like some instruction on what ports to use to program it and generally what we might need to do.

Thanks.
 
Yes, are you wanting to do a ground up, or build off the source?
Also what type of experience do you have?




@Nick
For now, we would like to build off the source but are also looking to build from the ground up. We have experience with Arduino, Java, C and electronics in general, but this is our first UAV build. Thanks for the help.
 
For now, we would like to build off the source but are also looking to build from the ground up. We have experience with Arduino, Java, C and electronics in general, but this is our first UAV build. Thanks for the help.
Ok, the programming experience is only somewhat important, as it is pretty simple complexity wise regarding the code, but getting the math right is a really hard task.

One idea Nick and I came up with was to have an Arduino as a middle man between your receiver and your flight controller. This would allow your software to manipulate the quad and have stabilization. It would also save a little money, and a LOT of time.
 
Ok, the programming experience is only somewhat important, as it is pretty simple complexity wise regarding the code, but getting the math right is a really hard task.

One idea Nick and I came up with was to have an Arduino as a middle man between your receiver and your flight controller. This would allow your software to manipulate the quad and have stabilization. It would also save a little money, and a LOT of time.


That sounds like a good idea. How many sensors do you think we could possibly use and do you have any suggested ways of connecting the Arduino board to the flight controller? Also, do you have any suggestions on what to add to the existing program on the flight controller (if need be)? Thanks for the help!!
 
Sorry for joining the party late. What I plan to do is what George described above. I currently have a Turnigy 9x tx/rx connected to the KK2.5.1 flight controller and I plan to put an Arduino Nano in between the Rx and FCB. The Rx would get input from the Tx, send it to the Arduino where it adds the object avoidance corrections from the sensors connected to the Arduino, then send the final output to the FCB.
 
Sorry for joining the party late. What I plan to do is what George described above. I currently have a Turnigy 9x tx/rx connected to the KK2.5.1 flight controller and I plan to put an Arduino Nano in between the Rx and FCB. The Rx would get input from the Tx, send it to the Arduino where it adds the object avoidance corrections from the sensors connected to the Arduino, then send the final output to the FCB.

That sounds a little like what we had in mind. We thought about using an ultrasonic sensor(a very simple one) and connecting that to our Arduino mini and then connecting the Arduino to our copter. We are having difficulties figuring out exactly which ports on the flight controller to use. We'd like to be able to change flight modes if a certain object is detected, but we're also having trouble figuring out how to change flight modes without using RC or ground station. Any suggestions, tricks of the trade or general help would be great. Thanks again guys!
 
Yes, on the KK board the flight mode can be changed via the AUX port on it. Simply hook the signal wire for the AUX port to a digital pin on the Arduino. Then use the servo library to send the signal that changes the flight mode. Similarly, hook the signal wires from the roll, pitch, and yaw ports on the flight controller to the Arduino to have it influence the movement of the quad after processing the input from the sensors.
 
Thank you so much - really appreciate it! We're using an APM 2.6 flight control board so I believe flight modes can be changed via the RC channel 5 - but the signal for APM is PWM not PPM (I tried using the servo library with APM, but it doesn't seem to be working). What is the best way to generate varied PWM signals with Arduino (or am I approaching this wrong)?

For interfacing more complicated sensors (cameras, microphones), do you still recommend using the Arduino between the receiver and FCB or something else? APM is largely open-source, so I was thinking about modifying and/or writing additional programs to integrate it with the source code...

Thank you again!!
 
If the APM has extra pins to plug the sensors in I would just do all of the computing on the APM. Just take the output from the sensors and use that to add the adjustments needed to the roll pitch and yaw of the quad. If you have enough channels on your rx/tx, you should be able to assign the flight mode change (on your channel 5) to a toggle switch on the controller for ease of use.
 
Thank you so much! APM does have extra pins, but it has a fairly intricate source code and I wasn't entirely sure on how to integrate my own code with the current system without tampering with its existing features. I was able to assign flight mode change on a toggle switch on my controller, but I wanted to see if I could use the ultrasonic sensor to switch flight modes (i.e. if an object is detected within X cm, switch to LOITER flight mode). I personally am more comfortable and more experienced with Arduino - not so much with APM and ardupilot. If I am planning on using more sensors (like cameras and a microphone), would you recommend using an additional Arduino with APM or solely APM?

Thanks a lot in advance - really appreciate all your help.
 
If you have extra room on your quad, by all means load it up with an Arduino. You could then easily make the ultrasonic senor trip the change for the flight mode. More Arduinos = More processing power. Good luck with programming the sensor and make sure to link a youtube video once you have it flying!
 
Back
Top