Developer
This is a quick how-to to get going with ArduPilotMega QGroundControl Integration. Note that this is a work in progress and that the gains/ waypoints sent to the apm are not currently setting the values in the autopilot. I'll be working today to hook these up. I could really use help debugging and coding though so I've posted this to get everyone else up to speed.
  1. Get ArduPilotMega mavlink branch: svn checkout http://ardupilot-mega.googlecode.com/svn/ArduPilotMega/branches/mavlink "pathtosketchbook"/ArduPilotMega
  2. Get Arducopter libraries: svn checkout http://arducopter.googlecode.com/svn/trunk/libraries "pathtosketchbook"/libraries
  3. Get Mavlink: git clone https://github.com/pixhawk/mavlink.git "pathtosketchbook"/libraries/mavlink
  4. Get QGroundControl: http://qgroundcontrol.org/downloads or build from source: git clone https://github.com/pixhawk/qgroundcontrol.git "base directory"/qgroundcontrol, if you build from source you will need to copy "pathtosketchbook"/libraries/mavlink to "base directory" or create a symbolic link
  5. Set sketchbook path for arduino to "pathtosketchbook", then restart arduino IDE.
  6. Create an APM_Config.h file as seen below.
  7. Compile and upload code to board.
  8. Start QGroundControl, select network, add link, set to comm port (/dev/ttyUSB* on linux, COM* on windows) and then set the baud rate to 115200 (if using GCS_PORT 3)
Here is some documentation:

APM_Config.h file:

#define DEBUG_SUBSYSTEM 0

#define FLIGHT_MODE_CHANNEL 8
#define FLIGHT_MODE_1 AUTO
#define FLIGHT_MODE_2 RTL
#define FLIGHT_MODE_3 FLY_BY_WIRE_A
#define FLIGHT_MODE_4 FLY_BY_WIRE_B
#define FLIGHT_MODE_5 STABILIZE
#define FLIGHT_MODE_6 MANUAL

#define GCS_PROTOCOL GCS_PROTOCOL_MAVLINK
#define ENABLE_HIL ENABLED
#define GCS_PORT 3
#define GPS_PROTOCOL GPS_PROTOCOL_IMU
#define AIRSPEED_CRUISE 25

#define THROTTLE_FAILSAFE ENABLED
#define AIRSPEED_SENSOR ENABLED
E-mail me when people leave their comments –

You need to be a member of diydrones to add comments!

Join diydrones

Comments

  • Developer
    The development team is pushing hard to have a new stable release soon. There have been some great flights on the beta branch but there are still a few kinks to work out.
  • Developer
    Sounds Great! I work exclusively on linux so you should be all set for HIL. I use the oooark scicoslab toolbox to talk mavlink to APM over Serial0 and then talk to qgroundcontrol on Serial3. http://oooark.git.sourceforge.net/git/gitweb-index.cgi
  • Awesome, thanks. I will keep an eye on the trunk. I just got my APM board a few days ago, and am developing under linux so I have no HIL. I will stay out of the main branch until I get a few flights under my belt. However, I hope to eventually help with development.

    Any chance another stable APM release will be coming out any time soon?
  • Developer
    The mavlink dev branch is the one in sync with the apm trunk. (git clone "mavlinkurl" -b dev) I have hil running right now with in flight gains etc. I'm debugging some issues with the imu and flight modes as we speak. I wouldn't fly apm trunk until you can get a good hil run going. Hopefully I"ll have that working for me tonight though. It was previously working but we made some eeprom changes.
  • Has anyone been maintaining the mavlink branch? I just tried to grab and build it using these instruction, but it seems to be out of date compared to the latest ArduCopter libraries. I did notice that the APM trunk has some mavlink code in it, so I am going to try to build it next. Is the APM trunk stable enough to try to fly with? I would really like to have qgroundcontrol(mainly in-flight gain tuning), but it is a beast getting all this stuff to build.
  • Baud rate 115200== gibberish
    Baud Rate 38400== CLI messages sometimes
  • Changed to GPS_PROTOCOL_HIL , the code compiled and loaded .
    I got the latest libraries ,and mavlink files just this morning .

    My APM doesn't seem to be sending any sensor data to qGCS, the serial link happens , and i get the ArdupilotMega CLI messages sometimes , other times just gibberish .

    Tha APM_Config.h is just as above .

    Im trying all of this on a Mac (10.6.5 ) , is that why it isnt working ?
  • Developer
    Try switching from GPS_PROTOCOL_IMU to GPS_PROTOCOL_HIL and make sure your libraries are up to date and you have the latest version of the mavlink branch.
  • hey when i compile the code i get :


    ArduPilotMega.cpp: In function 'void fast_loop()':
    ArduPilotMega:518: error: 'class AP_GPS_HIL' has no member named 'airspeed'
    ArduPilotMega:527: error: 'class AP_GPS_HIL' has no member named 'roll_sensor'
    ArduPilotMega:528: error: 'class AP_GPS_HIL' has no member named 'pitch_sensor'


    i do not get this error when i use the regular ArdupilotMega code (non ArduCopter).
  • Developer
    If you write the mavlink protocol bridge for UDB then it will work.
This reply was deleted.