Help modifying ArduCopter code


I’m in a group that’s building a drone for a school project that will be performing certain tasks autonomously. We’re using a camera that tracks a coloured object and sends an x and y coordinate back to our ground control station where we plan on using these coordinates to update the autonomous flight control code (ArduCopter) in order to move towards this object. We have a few different ideas on how to do this. One of the ideas is to treat these new coordinates as way points and continuously feed the drone new way point coordinates in order to move towards the object in question. Right now we are going through the ArduCopter code and mapping out how it all works…hours upon hours and days upon days have been devoted to this haha. We’re slowly getting a better idea of how it work. Does anyone have any information for us about which files we might have to modify(within the ArduCopter code) in order to input these new coordinates from our camera and guide the drone towards a new way point? Right now navigation.cpp seems to have a lot of the information we might be interested in.

Any help would be appreciated?

Thank you

Your application seems like an ideal use of DroneKit (straightforward and well documented) as opposed to modifying the ArduCopter firmware (difficult and undocumented).

For tracking using a vision system, you could send the autopilot goal updates in guided mode or control with RC overrides in stabilize, depending on how accurate you need to position and whether you’re operating outdoors (guided needs GPS).

Of note, we had a similar challenge for a semester long graduate level course in autonomous navigation at my university. All 4 teams failed the objective, and only one was able to get a system that would navigate the drone without crashing. So this isn’t a trivial challenge. I’m sure you’ll find some people interested in your project here!

Thank you so much for the help! Yep, we’ll be operating outside using GPS and sending new way point coordinates in guided mode was kind of the route we were exploring! I had a quick look into Dronekit and it looks like it’s exactly what we can use for this project. I’m going to do a lot more digging into it now.

Thanks again!

It seems to me that modifying ArduCopter firmware’s is WAY overkill just to achieve that task.

You can use guided mode, send it an initial waypoint, and then just keep sending corrections (as opposed to world coordinates’ waypoints) using MAVLINK message #84.

You can use dronekit for that purpose, or a program of your own and include the mavlink libraries.

Oh excellent! I may have been overcomplicating things. So pretty much all the manipulation of the drones autopilot can be done outside of the ArduCopter firmware and then just feed those controls into the ArduCopter program as updates.

Thanks again!

@cwzerr, @4sfaloth, @jmack… Hi, Did u succeed in giving external commands using drone kit? I am interested in the same project and would like to implement the guided mode with corrections “on the go” including RC Override" for pitch/roll. Can we implement the code by giving input as yaw/pitch angles (instead of waypoint) and modifying the guided path ON THE GO by RC Override for pitch/yaw.
Any help would be appreciated. Thanks in advance.

Yasir Khizar

Any comments will be appreciated…
Yasir Khizar

hey, I would like to get in touch with your team because im doing a project in university right now that would require me to modify the control law. I would obviously give you credit for any help you give me in understanding the code.

Yes all of that is possible and simple to do.

We wrote the documentation to help people like you understand the code.

The examples are there to help you as well.