Basic Questions - Pixhawk4/QGroundControl Setup + Arduino/MAVLink

Hi. I’m really new to this and struggling so I’d really appreciate some help.

So firstly, when I try to connect the Pixhawk4 to my computer, QGroundControl says “Waiting for Vehicle Connection”. I checked my Device Manager and it said “The drivers for this device are not installed”. I checked here: http://ardupilot.org/copter/docs/common-downloads_advanced_user_tools.html, but wasn’t able to successfully install the USB driver. Are there any other places I can install the driver from? I noticed a lot of people directing users to Pixhawk’s download page, but it doesn’t look like it exists anymore.

I’m also a little confused about how MAVLink works. I did read up on it, but am unsure of how to implement it on the Arduino Uno. I imported a library I cloned from GitHub and have been trying to follow this post: https://discuss.ardupilot.org/t/mavlink-and-arduino-step-by-step/25566. Am I supposed to define the types and modes for the heartbeat message and it’ll send on its own? What about for NAV commands like MAV_CMD_MISSION_START? It looks like the command is run from a ground station. The end goal is to have the Arduino trigger the Pixhawk4 to start its mission after sending the MAV_CMD_MISSION_START command.

Any help would be appreciated. Thank you!

There are two different flight control software stacks. PX4 and ArduPilot. This forum is for PX4. QGroundControl and Pixhawk 4 are compatible with both.

For Windows drivers, unfortunately I don’t know. @MaEtUgR might be able to help.

Do you know where I could find a USB driver for linux?

Linux doesn’t require drivers, it works out of the box.

Sorry for the delay.

I use latest Windows 10 and there the pixhawk boards all work out of the box without me having to install any driver (also not the one I’ll mention next). If you use older versions e.g. Windows 7 then you need some drivers and the easiest way to get them is: When you run the installer of QGC at some point a second installation is started for PX4 drivers with a separate UI. Just click through that and they should get installed, on Windows 10 you can skip that with Cancel. If that driver doesn’t work you can try some more tedious options like https://zadig.akeo.ie/, you find instructions about it on the web.

I’m also a little confused about how MAVLink works.

Docs are here: Introduction · MAVLink Developer Guide
As a minimal hint you want to include the latest version of this library into your Arduino code: GitHub - mavlink/c_library_v2: Official reference C / C++ library for the v2 protocol
Use this command to switch to the mission mode: Messages (common) · MAVLink Developer Guide
by calling c_library_v2/common/mavlink_msg_command_long.h at 2a47f11e73eef6d817af7934692b1223d7fb434f · mavlink/c_library_v2 · GitHub
with the parameters set to select the mission mode according to PX4-Autopilot/src/modules/commander/px4_custom_mode.h at dc50a564ddf9444dc7cb63114db429404971520b · PX4/PX4-Autopilot · GitHub

1 Like

Thank you so much! This helps a lot.So do I need QGC in order to be able to use the Pixhawk or can I use only the Arduino to communicate with it?

By default PX4 running on your pixhawk hardware is configured to go into failsafe whenever there’s no communication link like a remote control or a MAVLink datalink left to control it. The corrent implementation considers an open MAVLink datalink with regular (~1Hz) heartbeat (keep alive) messages as a valid connection so you can use your arduino as main component controlling the drone. Does that answer your question?

1 Like

Yes, definitely. Thank you! I really appreciate it.

1 Like