Help with offboard attitude control on fixed wing

Hi,

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?

Hello,
I am having a similar problem currently, did you ever figure out the solution to this issue?

@cos @gabedavid You need to use the body relative attitude fields since the fw attitude controller doesnt use the full quaternion

I am also working in attitide control for fixed wing. Since position setpoints do not provide control over the path the vehicle takes and velocity setpoints are not aceepted for fixed wing, attitude control is the next best solution. Did anyone manage to get attitude control working for a VTOL in offboard mode after transitioning to fixedwing ?

I am using PX4 version 1.15 and a standard vtol.

@Jaeyoung-Lim do you have a small example as to how you use the body relative attitude fields?

Is this possible to achieve with ROS2 and using px4/VehicleAttitudeSetpoint.msg ?