I used the python script (mavros_offboard_posctl_test.py) 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:
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.
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.
Thank you very much. This max overall speed control is exactly what I want. Really appreciate your help.
I use the code you provide and write two threads in the setUp part.
One is for horizontal_velocity, the other is for vertical_velocity.
Notice: I find that I need to use MPC_XY_VEL_ALL, instead of MPC_XY_VEL_MAX.
Note: If you publish the service and delete it. The QGroundControl still remembers the parameter which you edited last time. Thus, you need to publish again to set parameters back to default value. Or manually edit in QGroundControl