Giving relative commands
tl;dr:
If you're setting a setpoint reference relative to the current UAV pose, do not use the current UAV State (/<uav_name>/estimation_manager/uav_state
, or /<uav_name>/estimation_manager/odom_main
) to calculate the new setpoint.
Instead, use the current control reference topic (/<uav_name>/control_manager/tracker_cmd
, or /<uav_name>/control_manager/control_reference
) to avoid drift.
Also, read the rest of this page to understand the problem!
Problem description
Consider the following typical situation: You are attempting to make the UAV remain stationary at its current position. Although, this is already taken care of by our feedback controllers, you might still want to set the control rerefence to induce hover, or alter the desired position slightly to induce movement in a desired direction. An intuitive (yet wrong) approach is to subscribe to the current UAV State and start from the current UAV position as the desired command setpoint for the control pipeline. However, this will most probably cause your UAV to drift, as is illustrated in the following figure. This is due to the fact, that the UAV is in practice never precisely at the commanded position, even when stationary (because of various disturbances, delays, noise in the odometry, UAV dynamics etc.).
More specifically, when you command the UAV at time