Interfaceing Ardupilot with Arduino Uno

I am just getting started learning about quadcopters and how to make one. My goal is to have a quadcopter with a Ardupilot 2.8 to do the low level work (keeping it level, moving in a specific direction, changing altitude, etc) and accept "commands" from a Uno. For example, the Uno would "tell" the Ardpilot to move 20 meters in compass direction 270 degrees and then stop. Or something along these lines.

There are a lot of videos and articles on the internet but nothing clear how to interface the Ardupilot with the Uno.

Any help is appreciated.

What is the question? Does the Ardupilot have no documentation?

There is lots of documentation including the ardupilot web site, but nothing that specifically shows how to have them "talk" to each other bidirectionally.

How are they connected? Wires? Wireless? Why do you need two Arduinos anyway? Isn't the Ardupilot an Arduino app itself?

Seems to me, you should be able to just piggy back on the Ardupilot firmware that you are using on the flyer.

Connected by wires. Both will reside on the Quad chassis. As mentioned in OP: the Ardupilot will handle the low level control issues (as it is designed to do) and the Uno will send to it the high level directives. This is how the Ardupilot works when a human sends the command: except instead of having a human send a command via wireless, the Uno will send it a command via jumpers.

Then research serial communications. It's a standard and well supported method of inter-processor communications.

Basically you want to emulate a GCS (ground control station).

I am familiar with serial communications. My issue what ports / pins / examples to even get a simple "command" and response going with the Ardupilot 2.8 and Uno going. Once I have that i can take it from there.

You mention emulating GCS: If anyone has an example of that (wiring and code snippet) it would save me a lot of gnashing of teeth.

The serial pins on the Arduino side at least, are well documented...

The place to start is to study the Ardupilot code.

aarg: Yes, I know the Arduino side is well documented and I have been using it for years in many varieties (Serial. softSerial, AltsoftSerial, etc etc ).

My point is (again) to see the specific of how the Arduino side (well documented as you say) talk t the Ardupilot and get a response... even a simple command and response will do.

jremington: Yes, I have looked into it. I have not seen (yet) exactly how to send / receive information including what pins to use, baud rate, etc, that would be open and available t be used by the Uno.

So... any example / hardware set up is apreciated.

I'm not sure what the point is here. Some of the Ardupilot hardware examples are fast Linux machines. If you need something telling the software where to go, it can simply be another process on the Beaglebone (or whatever).

Also, the software provides mission planning out of the box, so I'm still missing what benefit a (heavy) Uno is going to give you.

Your chances of catching a ready made solution for that here, are slim. It's just a very specialized project. I suspect you will have to tackle it yourself.

Myself, I would be over on the Ardupilot code page looking for a protocol description... before anything else...

Here is a place to start. Rover in manual mode at: ardupilot/mode_manual.cpp at master · ArduPilot/ardupilot · GitHub

Look up what the function "get_pilot_desired_steering_and_throttle(desired_steering, desired_throttle);" does to get its two input values.

#include "mode.h"
#include "Rover.h"

void ModeManual::_exit()
{
    // clear lateral when exiting manual mode
    g2.motors.set_lateral(0);
}

void ModeManual::update()
{
    float desired_steering, desired_throttle, desired_lateral;
    get_pilot_desired_steering_and_throttle(desired_steering, desired_throttle);
    get_pilot_desired_lateral(desired_lateral);

    // if vehicle is balance bot, calculate actual throttle required for balancing
    if (rover.is_balancebot()) {
        rover.balancebot_pitch_control(desired_throttle);
    }

    // walking robots support roll, pitch and walking_height
    float desired_roll, desired_pitch, desired_walking_height;
    get_pilot_desired_roll_and_pitch(desired_roll, desired_pitch);
    get_pilot_desired_walking_height(desired_walking_height);
    g2.motors.set_roll(desired_roll);
    g2.motors.set_pitch(desired_pitch);
    g2.motors.set_walking_height(desired_walking_height);

    // set sailboat sails
    float desired_mainsail;
    float desired_wingsail;
    float desired_mast_rotation;
    g2.sailboat.get_pilot_desired_mainsail(desired_mainsail, desired_wingsail, desired_mast_rotation);
    g2.motors.set_mainsail(desired_mainsail);
    g2.motors.set_wingsail(desired_wingsail);
    g2.motors.set_mast_rotation(desired_wingsail);

    // copy RC scaled inputs to outputs
    g2.motors.set_throttle(desired_throttle);
    g2.motors.set_steering(desired_steering, false);
    g2.motors.set_lateral(desired_lateral);
}

wildbill: perhaps I want to add collision avoidance sensors to the Uno, then the Uno can process and decide which direction, and give those comands to the Ardupilot.

Before you do, I suggest you look into the docs a bit more - it's possible that the existing Object Avoidance features can do some (or all) of what you need.