Predictive parachute package delivery using real-time trajectory algorithm

I’m a college student studying CS who’s just getting introduced to the world of ardupilot. I’ve worked on a few DIY quadcopter projects with simple flight computers, but never on something as complex as ardupilot.

I have an idea for a project and was wondering if I could get some advice/help for where to start. Basically, I want to add a package delivery function to ardupilot that can precisely deliver a package with a parachute attached by calculating in real time where the package should land given current drone and wind velocity. I noticed there’s already a “delivery” function in ardupilot called payload_place, but this is different, as the drone will not stop on the ground to deliver a payload. I made a rough sketch in MS paint to try to make this understandable: https://imgur.com/a/QIO5Cec

I’m still getting familiar with ardupilot. I installed the SITL simulator and am playing around with mission planner connected to SITL to get a feel of the workflow of the software. I also have access to a basic quadcopter that’s running on a Pixhawk 4 when I eventually get something working.

To accomplish this added functionality, I think I’ll need to add a new flight mode and write custom code that will run alongside arducopter.

I’ll need the following information live from arducopter in order to calculate the trajectory:
Wind speed
Wind direction
Drone speed
Drone direction

Is there some API that ardupilot has that exposes information like this?

Should I start here https://ardupilot.org/dev/docs/apmcopter-adding-a-new-flight-mode.html?

I’d really appreciate it if someone with experience with ardupilot were to comment or give me pointers!

4 Likes

perfect use case for Scripting.

https://ardupilot.org/dev/docs/common-lua-scripts.html

2 Likes

Hi!

Thanks for the helpful comment! I’ve looked over the documentation page and the example code and I have a few questions:

  1. How can I tell the vehicle to change direction from inside a lua script? Once I’ve computed my predicted landing site, I’ll want to tell the copter to change direction. In my diagram, for example, I told the copter to move to a place that was west of the desired landing site. I saw in the example code that you can change the vehicle mode by calling “vehicle:set_mode(11)” to set it to rtl mode, but I don’t see anything else that could give me better control.
  2. It seems like the lua scripts are constantly called on a periodic basis. Would there be a way to only call it once it has reached a desired waypoint? I guess this isn’t too important since I could use a function call to compare current GPS coordinates with delivery GPS coordinates and return and wait a long time if I’m too far away, and in the other case return and wait very little time (and recalculate my trajectory) once I’m closer.

There is no way scripting can currently change the direction of the vehicle, but you could add some bindings to work with guided mode.

A first test would probably not to control the vehicle directly but to release the payload at the ideal spot in one mission leg. In copter you can’t really do much better than this in any-case as there is not wind estimate.

Yeah lua scripts run all the time, you have to idle in the background and look for the correct mission item. This PR adds mission support to scripting. https://github.com/ArduPilot/ardupilot/pull/12872 but it needs a rebase and a little work to make it completely safe (you can use it so long as you don’t set mission item via gcs and scripting at once).

2 Likes

Hey, I just noticed that mission support was added to scripting yesterday on the main branch! This is great news! I’ve looked through the bindings that were just added, and it doesn’t seem like you can SET a new mission item from within a script, but I’m thinking an alternative would be to add a set of small mission items within the circle where the dropoff would occur, but then choose between the “optimal” mission item from inside the script. (I think you can choose between mission items from within the script, right?)

You can set the mission index within the script. You can go to any waypoint existing in the mission but you cannot add a new waypoint that was not there before. So yeah you can pick from a few existing waypoints, you might also be interested in guided mode support that is coming soon:


you can then tell the copter exactly where to fly. You could look for some trigger waypoint in the script, switch to guided and give the exact location and then switch back to auto to finish the mission.

1 Like