I’m interfacing a custom autopilot to QGroundControl, and at the moment I have it claiming to be a PX4 autopilot as this puts the Fly Tools up on the display whereas claiming to be a Generic autopilot does not.
I’m running into some oddities in processing the requests to button clicks on the Fly tools. In particular, the action to change altitude and the pause button. They both seem to generate a MavLink Cmd Long message #192 (Reposition), whereas I would have expected that the pause button would send Cmd # 193 (MAV_CMD_DO_PAUSE_CONTINUE).
Can somebody point me in the right direction? Where in the QGC source would I find the Fly Tools implementation?
Ok, well it seems that looking in the PX4 firmware confirmed my suspicion.
In PX4FirmwarePlugin.cc there is this:
“void PX4FirmwarePlugin::pauseVehicle(Vehicle* vehicle)
true, // show error if failed
And a little lower down in PX4FirmwarePlugin::guidedModeChangeAltitude()
true, // show error is fails
static_cast(vehicle->homePosition().altitude() + newAltRel));"
So, the only difference between Pause and Change Altitude is the altitude field. BUT there’s still a problem.
When I hit ‘Pause’ I receive one Cmd Long 192 Reposition message with no altitude (use default), and then I receive a second one with an altitude. This second message is indistinguishable from a change altitude message. I would have thought that the desired behavour was that pause brings the vehicle to a hover (vtol) while attempting to follow the mission plan including any scheduled altitude changes.
Perhaps I need to build a custom firmware implementation in QGC…doesn’t sound simple. Is there a guide/tutorial on this, or is it a matter of copying/modding what was done for Px4 and hoping that it all compiles/links/works.