Help with offboard attitude control on fixed wing


I’m trying to write a ROS2 offboard controller for a fixed wing model. I already have a working c++ application based on the offboard example here: ROS 2 Offboard Control Example | PX4 User Guide

I also can control the attitude rates and velocity setpoint (for multicopters).

Now I would like to have proper control to set the desired attitude of the aircraft. I’ve been trying to use the VehicleAttitudeSetpoint topic documented here px4_msgs/VehicleAttitudeSetpoint.msg at master · PX4/px4_msgs · GitHub

But I can’t get it to work. The aircraft usually just banks right regardless of what values I set in the quaternion or body attitude values. Probably some mode is wrong somewhere but I can’t figure it out.

Has anyone got this working, and is there an example c++ application I could take a look at?