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:
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
Here’s the corresponding log :
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:
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: