Is there a code example or clear list of MAVLink messages and required “autopilot” parameters that will result in “Vehicle Connected” success? I’ve been working on this for a while in a similar situation. I have a custom robot, not an autopilot (so it doesn’t really make sense to use the whole stack) and want to teleoperate it with MAVLink and stream video.
QGC seems like the perfect tool for this in theory… plug in a gamepad, send a handful of MAVLink manual control and system status and other messages back and forth. But I’ve been banging my head against it.
I’ve gotten pretty far trying to follow the flow here: https://dev.qgroundcontrol.com/en/communication_flow.html I have bidirectional comms between my robot controller and QGC. But I still don’t have “vehicle connected” nor do I have access to the joystick configuration, which I understand is a firmware-specific thing.
I’ve been using the Blue Robotics fork of QGC (http://discuss.bluerobotics.com/t/qgc-v3-2-4-bluerobotics-rev2/1551) so before I posted, I just switched over to stable version v3.3.0 instead in case that helps… but that doesn’t even get as far as the Blue Robotics fork. Just a steady stream of errors in the app log:
[E] at ..\src\comm\UDPLink.cc:404 - "UDP: Could not resolve host: "" port: 2682"
I can still see the heartbeat from my vehicle controller:
But I get nothing else, and I am not seeing any activity from system ID 255 (ground control).
I suppose possibly this is a firewall issue or something I need to look up . Blue Robotics QGC was using outgoing ports in the 41000’s somewhere.
I used to be able to get commands to my microcontroller from QGC. Here’s some debug output from my code:
Working through https://dev.qgroundcontrol.com/en/communication_flow.html decoding messages QGC was sending to my controller through trial and error, I managed to respond properly to a number of commands (parameter requests and so on) that QGC sent to my controller.
I get the impression that you need to be a PX4 autopilot to enable joystick input in QGC.
So I tried to fake being a PX4 controller. Took a while clearing out most errors
but I can’t get the firmware versioning right (and I probably shouldn’t be able to):
I never got to “Vehicle Connected” that way.
I tried MAV_AUTOPILOT_GENERIC which doesn’t give any errors in the vehicle summary but still doesn’t result in “Vehicle Connected”
For reference of the OP, in case it’s helpful, here’s what I did:
While trying to fake being a PX4 firmware, I went through:
- I send heartbeats from the vehicle autopilot (MAV_COMP_ID_AUTOPILOT1 , or 1)
- QGC creates a vehicle with a number matching the MAVLink system ID my vehicle is sending
- QGC sends message #21 PARAM_REQUEST_LIST
- I respond with a bunch of #22 PARAM_VALUE messages, one-by-one clearing out QGC’s complaints about missing parameters
- QGC stops complaining about parameters, and the last one sent is still visible in MAVLink Inspector
- QGC sends message 76 CMD_LONG with command 520 (MAV_CMD_REQUEST_AUTOPILOT_CAPABILITIES) and parameter value 1 (meaning send autopilot version)
- I respond with message #148 AUTOPILOT_VERSION, trying to fake it (but failing to successfully fake it)
- QGC sends command #43 MISSION_REQUEST_LIST
- I respond with #44 MISSION_COUNT and tell it I have 0 mission items in the sequence.
When I’m faking PX4, I still get the firmware error.
When I’m a GENERIC autopilot, I get no errors at all, and QGC just sits there sending its own heartbeats, but I’m still not connected.
I get lots of data in MAVLink inspector (I’m also sending out a #1 SYS_STATUS with actual battery voltage and otherwise basically saying I don’t have any sensors):
But I’m still not “connected.” And I still don’t know how to get a joystick module.
All I want to do is be able to get QGC to send my joystick data to the robot and to get some basic telemetry (right now just battery and some status flags, eventually probably some heading and other data). Is there an actual list of back-and-forth commands or a code example of a successful bare-bones MAVLink negotiation that definitely results in a “connected” vehicle? Is there a way to know what the easiest type of “Autopilot” you should pretend to be to get a joystick? Is that even possible?
For the purposes of this discussion, I’ll try tomorrow to fix the port issue and get the official QGC working. Maybe that will connect?
But I’d love some pointers or more specific documentation.