Yaw control by Offboard


I am controlling my drone via an offboard computer using velocity commands. Here I have chosen the /mavros/setpoint_velocity/cmd_vel_unstamped topic. Besides thid, I would like to control the yaw / heading of my drone independently from the velocity.
Is this possible?

I could control the yaw value via ‘attitude’-commands, however, the pitch and roll-values will override my velocity control.
Similar, when setting the yaw by local or global positions, this will overwrite my velocity control?

I appreciate your help! Thanks.

I’m having same issue, were you able to solve it

Kind of.
We bypassed the problem by using the following topic for velocity control:


with following msg type:

  mavros_msgs::PositionTarget velocityMsg;

  velocityMsg.header.stamp = ros::Time::now();

  velocityMsg.coordinate_frame =  mavros_msgs::PositionTarget::FRAME_LOCAL_NED;
  velocityMsg.type_mask        =  mavros_msgs::PositionTarget::IGNORE_AFX | 
                                  mavros_msgs::PositionTarget::IGNORE_AFY | 
                                  mavros_msgs::PositionTarget::IGNORE_AFZ |
                                  mavros_msgs::PositionTarget::IGNORE_PX  | 
                                  mavros_msgs::PositionTarget::IGNORE_PY  | 
                                // mavros_msgs::PositionTarget::IGNORE_VX  | 
                                // mavros_msgs::PositionTarget::IGNORE_VY  | 
                                // mavros_msgs::PositionTarget::IGNORE_VZ;
  velocityMsg.velocity.x = groundSpeed_ * sin(move_direction_ *  M_PI / 180);
  velocityMsg.velocity.y = groundSpeed_ * cos(move_direction_ *  M_PI / 180);
  velocityMsg.velocity.z = climb_speed_;

  velocityMsg.yaw = heading_;
  velocityMsg.yaw_rate = yaw_rate_; 

Don’t know if this is the desired/recommended way, however, it works fine.