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?

I posted this over in the PX4 Autopilot discussion category, not sure which one is more relevant.

Thanks in advance!

Hello friend,
– are u publishing two setpoint command at the same time ? seems I didn’t find some official support for this, u can try this ~setpoint_raw/attitude, it includes the attitude and normalized thrust (0-1).
– another thing I feel confuse is: u split the throttle command and attitude command ? I mean how can u use one hovering throttle from a hovering case and a user calculated omega command from another case? the thrust and attitude/attitude rate comes together from a mission, e.g., from one point to another, using some quadrotor control method u will acquire the cmd thrust together with the corresponding attitude cmd, coz the direction of the thrust vector is determined buy the orientation of the quadrotor. So, u should calculate the T + attitude based on some control methods (geometric control for example).

hope I understanding correctly :))

  1. This is what I was following and why I was publishing to those 2 topics. I am now publishing to ~setpoint_raw/attitude with the same results, however.
  2. So I have my own controller that determines thrust and attitude commands.To test it out, I wanted the quadrotor to hover at a desired height with no rotation. This did not work, so I then tried to hover at a desired height and command the throttle using a simple position controller while publishing a 0 rotation quaternion (w = 1.0, x = y = z = 0.0 ? ). However, this causes the vehicle to bounce around the desired height setpoint endlessly. What is weird is that this exact same throttle controller works when instead of sending attitude commands I send roll, pitch, and yaw rate commands (all 0.0 for 0 rotation). I am changing the typemask from 7 (ignore rate cmds) to 128 (ignore orientation cmds). This is annoying as I need the attitude commands…

Thanks for your reply! Please let me know if you have any insights!

hello friend,
– if the thrust and the corresponding attitude/att rate are match, i.e., even the thrust is from a position controller, if there are some errors in x, or, y, or z, the cmd attitude should also changing accordingly from the position controller, if this is not a problem, and u are sure on that are doing correctly, then maybe it is the lower level controller’s issue, decrease the angle control gain P in QGC, coz there is oscillation when u send attitude cmd, but there is no oscillation when u send rate cmd, this may say the rate controller PIDs are ok.
– I still think that u should also derive the cmd quaternion from the position controller’s output, not set it to 1 0 0 0, because this actually ignored the thrust direction changing, this is the attitude of the drone right? if really not this issue, then u can go check the lower controller’s gains.


1 Like
  1. Ok perfect. Thank you, will try.
  2. So I actually got it to work by using the thrust derived with this controller. BUT you were right in not sending 0 rot quaternion since I did not have an attitude controller. Instead, it worked by sending the original orientation quaternion. I will now test it out with my attitude controller and see how it works.

Thanks for your help!