How to offboard control drone with specific speed

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:

Thank you very much for your reading and help

Hello,

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 : https://docs.px4.io/main/en/advanced_config/parameter_reference.html#MPC_XY_VEL_ALL

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):
    rospy.wait_for_service('/mavros/param/set')
    try:
        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.

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.

There is the video: h480 python horizontal vertical speed control - YouTube
Thanks again

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