Dropping a Drone a Certain Height Via MAVROS - What Topics should I use?

Hello all,

I am working on a offboard control algorithm for a custom drone and part of the task is to make the drone fall a certain height (as vertically as possible). Below i’d like to conceptually outline my algorithm and ask some general questions regarding the algorithm’s implementation.

Algorithm Outline

  1. [Node 1] Initiate Offboard mode, Arm and tell drone to fly to a specified location. (Topic of Interest: /mavros/setpoint_position/local)

  2. [Node 1] Call Drop Drone Service [AKA Service 1]

  3. [Service 1] Stop Thrust until height drop is achieved. (Topic of Interest: mavros/setpoint_raw/attitude) My drone has a px4FlowSensor integrated so it can tell the height with good accuracy.

  4. [Service 1] Tell drone to start thrust with velocity (or force) only in the z direction. Stop High thrust when velocity in the z-direction becomes positive again (AKA when the drone stops dropping) (Topic of Interest: /mavros/setpoint_accel/accel)

  5. [Node 1] Tell drone to hover at the expected location after the height drop. (Topic of Interest: /mavros/setpoint_position/local)

General Questions

  • What are the best topics to communicate the various kinds of commands needed to implement the algorithm? I have placed my best guess in parenthesis above.

  • Since, (It seems) there is not one topic that can handle all of the command types (Flying to position, stopping thrust, restarting acceleration in a given direction), are there any special considerations needed to make sure the commands across various topics don’t conflict or overlap? Currently, all I do is ensure that I stop sending commands on one topic before sending them on another. But perhaps, there is a spinall(), instead of spinonce() to ensure there are no commands left in the previous topics buffer.

I would appreciate any help.

Thank you very much,