I have been having issues in control my drone in simulation using the
~/setpoint_raw/attitude topic. I have also
/mavros/setpoint_attitude/use_quaternion set to
true. However, there is something odd going on as I still cannot control the attitude of the drone using quaternions, but I can with the attitude rate commands. Does anyone know why this could be happening?
Please let me know what more information is needed as I have been unable to figure out what is wrong for weeks now.
Edit 1: I realized I missed about half the things I wanted to say…
I am currently just trying to get the drone to hover in place. I have a height controller which determines throttle commands to achieve a desired height. When I send body rate commands of:
target_attitude.body_rate.x = 0.0 target_attitude.body_rate.y = 0.0 target_attitude.body_rate.z = 0.0
the drone hovers at the desired height. To do the same with the attitude commands, I send an orientation of:
target_attitude.orientation.x = 0.0 target_attitude.orientation.y = 0.0 target_attitude.orientation.z = 0.0 target_attitude.orientation.w = 1.0
This should give me 0 rotation? I also should mention that I am changing the type_mask from 128 (ignore orientation) to 7 (ignore body rates) when performing these runs.
Finally, when I run
rostopic echo setpoint_raw/target_attitude I never actually see the typemask change to 7. However, when the typemask is changed to 128 to ignore the orientation field, the messages stop coming in altogether BUT the drone is able to hover at the desired height. What is happening here? I set the typemask by
target_attitude.type_mask = 1|2|4 or
target_attitude.type_mask = 128.