Offboard fixed wing position control

Hi there,

for my research project, I would like to control a fixed wing UAV from outside the flight stack. After implementing the MAVROS offboard example, I modified the publisher to:

ros::Publisher target_pos_pub = nh.advertise “mavros_msgs::PositionTarget”
(“mavros/setpoint_raw/local”, 10);

and adjusted

mavros_msgs::PositionTarget target;
target.header.stamp = ros::Time::now();
target.coordinate_frame = 8;

to send velocity and yaw rate setpoints.

The offboard node seems to correctly publish the topic, since both the Iris and VTOL airframes (Gazebo) take off and fly as expected. However, the fixed wing plane does not.
I took a closer look at the position_setpoint_triplet and the vehicle_attitude_setpoint topics, to conclude that the fw_pos_control_l1 module does not transform the position setpoints to attitude setpoints as expected (in offboard mode). Whereas the mc_pos_control does publish roll, pitch, yaw, yaw rate and thrust setpoints, the fw_pos_control does not.

To be honest, I do not have a clue on how to make it work. Can someone take a look at this please? Any help would be greatly appreciated. Thanks!:grinning:

Hm, that’s a good question. I’m not sure if offboard control is enabled for fixedwing. Fixedwing are usually controlled using mission items (waypoints). Is that not an option?

@JulianOes, are you saying that the PX4 firmware doesn’t allow fixedwings to receive new heading deviation during the flight from an onboard computer (e.g. to avoid an obstacle), and this is only supported on multirotors?

I’m not sure but from what I know fixedwing doesn’t have obstacle avoidance yet. And I’m not sure if fixedwing supports offboard control.

Thanks for your replies! In the end, the goal is to send altitude, velocity (preferably airspeed), and heading angle setpoints in real-time. The plane should then be able to (very) closely follow a path in a HITL simulation.

For now, I think it is good to know if there are people able to make the fixed wing position controller transform the position setpoint messages in offboard mode. And how they managed.
Or should I focus on the multicopter control for offboard mode?

I’m going to ask on slack, let’s see if there is anyone.

1 Like

I believe the attitude setpoint works with fixed wings in offboard mode. It seems like this would be more reasonable than publishing position setpoints

Unfortunately, there was no response on Slack. I think the best thing you can do is dive into the code and try out things in simulation an see how far you get.

I’d be interested to add offboard control for fixedwing to the DronecodeSDK if we manage to find out what’s supported.

Hey, I am working on same topic for a project now. However, my skills are mostly related to aerodynamics part. Is there any development with your search about this topic? I would like to get some help and ideas :slight_smile: Thanks!

Hi @khrmnefe so you also want to use offboard fixed wing position control?

@khrmnefe Enabled in this PR:

I was able to send commands for the setpoint_raw/attitude mavros node when in offboard mode in HITL. Can control roll, pitch, and yaw that way. However, I am still trying to figure out how to control velocity and hopefully local or global position in the end.

@apoissant95 If you are talking about linear velocity, currently it is not supported. You can look at the supported messages here

@Jaeyoung-Lim are supporting velocity setpoints for fw in the works right now? When I enter offboard mode and send attitude setpoints to xplane (working with HIL here) the plane goes to zero throttle and its airspeed drops.

@apoissant95 You need a more recent version of px4. Try running master

1 Like

I am running the most updated PX4 release from qgroundcontrol. This is ver 1.9.2. Is this not the most recent version of PX4?

This feature is only in master and will be in 1.10, you should be able to flash the latest beta in QGC.

Thank you for the response. I flashed the master to my Pixhawk but HIL mode with XPlane is not working properly now. When I start the mission in mission mode the plane does not move and qgc tells me the plan is complete. There is also some other weird behavior in HIL mode too. It was working with v1.9.2, but not with this master. Do I need to wait for the stable release of 1.10 to get HIL mode working again?

@apoissant95 are you just following the X-Plane instructions in the devguide or are there more tricks (for v1.9.2) to make it work?

I would like to reproduce this at some point and maybe I can check why it doesn’t work on master/v1.10 anymore. I think it’s mostly because none of the maintainers is using it and would be realizing when it breaks and fix it.

If you can debug it and get it back in working shape that would be very much appreciated.

@JulianOes yes, those are the steps I used for v1.9.2, which worked without issue. Would be happy to provide more setup instructions that I used if needed. Thanks

1 Like