How to limiting Max Vel when sending position setpoints over /setpoint_raw/local?

When sending position setpoints over the /mavros/setpoint_raw/local topic, is it possible to also specify the maximum velocity (that the drone isn’t allowed to exceed)? mavros_msgs/PositionTarget.msg doesn’t have a dedicated field. What would be the best practice to limit drone’s velocity while sending position setpoints? I know that I can use the MPC_XY_VEL_MAX parameter, which isn’t ideal if I want to define a different max velocity for every setpoint I send.


@canberkgurel I don’t think dynamically updating velocity constraints to a cascaded controller is an ideal approach. The vehicle might do unexpected behaviors if you change constraints dynamically that the current state is violating.

The MPC_XY_VEL_MAX is something that should be set as a safety parameter that depends on the airframe and not the controller.

I do understand why you might want dynamic velocity constraints while you are sending position setpoints - However, given that the mavlink message you are using through /mavros_setpoint_raw/local already supports feedforward velocity controls I think your use case is more suited by using the feedforward velocity setpoints on top of the position setpoints.

If you want to control better tracking than this, you need a proper trajectory tracking controller. You can use my implementation as reference: GitHub - Jaeyoung-Lim/mavros_controllers: Aggressive trajectory tracking using mavros for PX4 enabled vehicles

@Jaeyoung-Lim I never tried to send a position and velocity setpoints at the same time, I’ll test this. What would be the expected behaviour if I send [1,0,1,1,0,0,0,0,0,0,0] when the drone is at [0,0,1]?

P.s., I like the geometric controller idea, it’ll be my last resort.