How to control thrust or flight velocity?

There is a good solution by a_jegourel.
He/She used MPC_XY_VEL_ALL (resp. MPC_Z_VEL_ALL) to set a limit to the maximum overall horizontal (resp. vertical) velocity.

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)