Hi,
I’m unable to get offboard attitude control working for VTOL. I’m using MAVSDK with a slightly modified version of the offboard_velocity.cpp example (only running the attitude part of it) and simulate it with HIL (Gazebo).
The issue is that my setpoints are overwritten from somewhere with the latest attitude setpoint before the switch to offboard (latest setpoint from Takeoff state in this case, the same happens when Loiter was the last previous state). A handful of the good setpoints are logged, though. I couldn’t pin down where and why the old setpoint is still kept and overwrites my new ones. Any help would be very appreciated!
Here’s a log from yesterday’s master branch:
https://logs.px4.io/plot_app?log=fc60426e-a06d-441f-b309-d3ee00d207a1
My guess was that it’s a problem with _mc_virtual_att_sp
not being updated with the offboard setpoint, so I changed the ORB_ID of this line to mc_virtual_attitude_setpoint
Here’s the corresponding log :
https://logs.px4.io/plot_app?log=6b832832-7029-4d79-b9cc-6519da3c02cc
At least it now also shows some +20° roll angle setpoints, but it’s still not working.
The script works well for Quadcopters, so it has to be something specific to VTOLs:
https://logs.px4.io/plot_app?log=1bc8e39e-e545-4ffe-97ae-7cc937cdfeea
My final goal is to create a new VTOL attitude controller for quadplanes for my Master thesis, for which I need to have a good frequency response model. Which is why I would like to be able to act directly on the attitude setpoints to get good data.
Thanks a lot for any help!
P.S. This post is a follow-up of 12972, but in the meantime I have switched to HIL instead of SITL. I think that the underlying problem is the same, though.
P.P.S Another weird thing happened: with the exactly same setup (same firmware version, same offboard script, same Pixhawk 4 in HIL mode) as for the second log, one time the drone fell out of the sky. Restarting Gazebo solved the problem, but it was strange anyway:
https://logs.px4.io/plot_app?log=829778d8-ea18-4156-b7b5-e21bebec2eca