Controller <- MAVLink -> QgroundControl Minimal Example

I didn’t actually make any progress figuring this out from the code. I paused to look into ROS + gstreamer setups for the video side because ROS is probably more long-term more useful to me in the big picture (though not for my short-term goal).

So I was working to debug ROS gscam and wanted to make sure I was getting UDP video to the new Ubuntu laptop I set up for ROS. Since that worked beautifully out-of-the-box in in QGroundControl, I downloaded the official QGroundControl Linux binary from http://qgroundcontrol.com/

I turned on my robot and everything just started working. I achieved “connected” status and got the Joystick plugin and now I’ve got manual control messages streaming to my robot. I haven’t tried Blue Robotics QGroundControl on Linux to see if that works.

I will post more detail later, but the following seems to work for the official Ubuntu binary AppImage here: Redirecting to latest version of document (master)

My robot is sending a heartbeat that says it’s MAV_TYPE_SUBMARINE, with an autopilot of MAV_AUTOPILOT_GENERIC. It has a base mode of
(MAV_MODE_MANUAL_ARMED | MAV_MODE_FLAG_CUSTOM_MODE_ENABLED),
has a custom mode of 0, and is in state MAV_STATE_ACTIVE

QGC sees this and starts to request things. I negotiate the following:

QGC sends PARAM_REQUEST_LIST

I respond with repeated #22 PARAM_VALUE
to send some parameters using mavlink_msg_param_value_pack_chan() I don’t think it matters much what the parameters are, I’m sending four parameters total at the moment, one right after the other.

QGC sends COMMAND_LONG
The command it sends using COMMAND_LONG is 520 MAV_REQUEST_AUTOPILOT_CAPABILITIES with param1 of 1 (request autopilot version)

I respond with #148 AUTOPILOT_VERSION using mavlink_msg_autopilot_version_pack_chan() with basically random data.

QGC sends #43 MISSION_REQUEST_LIST

I respond with #44 MISSION_COUNT using mavlink_msg_mission_count_pack_chan() I say that there are zero mission items.

I’m also always sending some #1 SYS_STATUS messages. They don’t contain anything besides my battery voltage yet. That shows up in the proper places in the QGC GUI.

This is enough for the official QGC on Ubuntu 16.04. Connection is achieved and it starts sending MANUAL_CONTROL messages with live data from my F710 joystick.

Again, I’ve changed nothing on the robot side since the last post. I figured out this exchange from printing and responding to each of the messages from the Blue Robotics forked QGC (3.2.4 IIRC?) on Windows. The Blue Robotics fork on Windows eventually stopped querying the robot and showed the responses in MAVLink Inspector, but did not connect or present the joystick interface.

The official QGC install for Windows never sent any packets to my robot. It sent its heartbeat but never saw my robot. I think this might have been a port issue, but I didn’t debug that yet.