How to offboard control drone with specific speed

I used the python script ( from PX4-Autopilot to send the waypoints and offboard control a drone, but the drone move so fast between waypoints.
Therefore, I would like to adjust the drone speed by this same python script. Is it feasible?

I also checked similar questions but cannot find a solution.
There are references:

Thank you very much for your reading and help


I’m not sure if this is exactly what you want, but you can use the parameters MPC_XY_VEL_ALL (resp. MPC_Z_VEL_ALL) to set a limit to the maximum overall horizontal (resp. vertical) velocity.

See the reference for more information :

You can use it in your code with something like this using mavros service ‘/mavros/param/set’ :

import rospy
import mavros_msgs.srv

def set_horizontal_velocity(max_velocity):
        max_hor_vel = rospy.ServiceProxy('/mavros/param/set', mavros_msgs.srv.ParamSet)
        max_hor_vel(param_id="MPC_XY_VEL_ALL", value=mavros_msgs.msg.ParamValue(real=max_velocity))
    except rospy.ServiceException as e:
        print("Service max_horizontal_velocity (MPC_XY_VEL_MAX) call failed: %s" % e)

Please note that this will only set an arbitrary limit to the speed of the drone, so it won’t be moving as fast as it could physically do, but this is not a mean to finely control the speed (as if you wanted it to to precisely follow a velocity input v_ref(t) ).

And as it is a call to a service, it is blocking and should be done at the beginning of the script, before entering offboard mode.