Need Attitude Control: Issues with /setpoint_attitude/attitude and /setpoint_attitude/thrust

Hi all,

I am trying to send attitude and thrust commands in simulation but (as per the title) I have been unable to do so. In offboard mode, I am publishing thrust and attitude commands to /setpoint_attitude/attitude and /setpoint_attitude/thrust. I have a controller that determines the attitude to apply a desired force on the quadrotor. Since the attitude commands must be quaternions, I am converting the euler angles (from my controller) to quaternions using the tf.transformation library. I should note that the parameter /mavros/setpoint_attitude/use_quaternion is set to true.

I have two main issues:

  1. Cannot find throttle at hover.
  2. Attitude commands are seemingly doing nothing.

I am mostly concerned about the first point. How have people done this in the past? I have a script which makes the quadrotor hover at a desired height for 20 seconds. I save this throttle value and start publishing it to /setpoint_attitude/thrust alongside my attitude commands. However, the quadrotor immediately plummets and then hovers at around 0.5m above ground…

I have checked and I am publishing commands to the correct topics.

If anyone has got this to work, could you share some insights?

Thanks in advance!

is there an urge using thrust setpoints instead of position setpoints? You may try that.

Logs could also be helpful.

@mwbb I am trying to follow this work by Klausen to minimize oscillations when the quadrotor is carrying a suspended payload. It works by determining the desired attitude along a smooth path. I need the thrust setpoints as they are needed alongside the attitude commands.

If there was a way to hold altitude while sending attitude commands, this would be ideal. However, I haven’t been able to find anything online where that is the case - at least not a real solution.

Logs could also be helpful.

Also, I am fairly new to ROS and all this. I am using rosbag to keep track of the thrust cmds and position of my quadrotor. Is this what you mean by this?