# Offboard speed control in ROS2

hi,
I am trying to achieve simultaneous position and velocity control in ROS2, using micrortps_bridge
Separately i can do position, and velocity, but when together, i think i am missing some control theory fundamentals

here is what i am doing

1. prearm:

send a continuous stream of
Off-board control mode with only position set to true
and Trajectory set point msg with x = 0, y = 0, and Z = - ALTITUDE.

1. Arm
I arm the vehicle after 20 setpoint messages

2. takeoff :
send a continuous stream of
Off-board control mode with only position set to true
and Trajectory set point msg with x = 0, y = 0, and Z = - ALTITUDE

at this point vehicle takes off

1. trying to move towards a point (2, 26) with slow speed :
send a continuous stream of
Off-board control mode with position and Velocity set to true
and Trajectory set point msg with x y z, and vx vy vz,

the drone moves towards the waypoint, but at a very high speed, where as i have set vx vy and vz to 2m/s.

Position setpoint and velocity setpoint (the velocity setpoint is used as feedforward; it is added to the output of the position controller and the result is used as the input to the velocity controller).

so i started assigning negative values to the vx, vy. It is now moving slower. but the local position message still shows around 9m/s in y axisâ€¦ what am i missing here

as suggested here,

MPC_XY_VEL_MAX
message has to be used to control the max speed. What is the equivalent in ROS2 micrortps message?

i could do it through Qgroundcontrol though. but there has to be a better wayâ€¦

For anyone reading this later. The position and velocity setpoint often creates some confusion. The way it works is that the most â€śouterâ€ť setpoint is used, so in this case position. The velocity setpoint is used as a feed-forward for the controller but not as a limit.

2 Likes