Learning to program the Ardupilot Mega


Learning to program the Ardupilot Mega

A group to discuss the many ways to edit and compile the code for the Ardupilot Mega!

Members: 598
Latest Activity: May 30, 2019

Discussion Forum

User Code and User Varibales

Started by adam bazley. Last reply by Spencer Manning May 9, 2019. 12 Replies

This is an open call to any one who has been able to get code working using the user code hooks. HELP!i am trying to get a simple script running that sets pin8 high when its hits a waypoint. i know…Continue

Tags: User

Learning to program Arducopter

Started by Minh Tran Quang. Last reply by Angelica Crespo May 15, 2017. 8 Replies

I tried to explain the control process in Arducopter.pde. The reference is http://ghowen.me/build-your-own-quadcopter-autopilot/.To…Continue

Getting mission status on UserCode.cpp

Started by Mauricio Oyarzún Nov 4, 2016. 0 Replies

Hello, everyone!I'm trying to count how many waypoints has my drone visited and if the mission has been sucessfully finished, and for that I'm planning on writing my code on the UserCode.cpp file,…Continue

Real time extraction of apm 2.5 telemetry to matlab?

Started by J'Rome. Last reply by Mohamed Abdelkader Zahana Aug 17, 2016. 8 Replies

I would like  to pull the ardupilot telemetry in to matlab, visual studio or visual basic in real time. Specifically, latitude, longititude, altitude and attitude. Any thoughts will be greatly…Continue

Comment Wall


You need to be a member of Learning to program the Ardupilot Mega to add comments!

Comment by Prashanth Pai on August 15, 2015 at 7:10pm

@david ramo, you need mission planner to load arduplane firmware on APM (ardupilot mega).

->Open mission planner

-> Connect your APM board through telemetry, USB or zigbee but don't click on Connect button in Mission Planner yet.

->Goto Initial Setup Tab page

->Click on Ardu Plane firmware 

->Confirm yes

You can manually add it too by first downloading latest firmware from http://firmware.diydrones.com/Plane/ and using Load Custom Firmware option present in right bottom corner of the Initial setup page. 

Comment by david ramo on August 14, 2015 at 2:16pm

how to apply arduplane on arduino mega ??

Comment by Hameedullah Omari on February 2, 2015 at 1:44pm

hello guys, i would like to connect arduino mega to apm through i2c port. in which the mega will be slave and the apm will be master. any suggestion please?

Comment by Bill Bonney on May 16, 2014 at 5:20am
@AntoineL: post your question here https://groups.google.com/forum/m/#!forum/drones-discuss, its where the APM devs discuss developement topics. I'm sure we can help get your Library working
Comment by Antoine LECESTRE on May 16, 2014 at 2:39am

Hi Guys, 

I've been working for a few days on implementation of CMUcam PIXY to Ardupilot. I have created AP_PIXY library which is available in my GIthub (here) and based on the original Pixy's arduino library  (here).

My objectif is to use the Pixy as an "optical flow" to allow a copter to hover precisely over a target, to land precisely on it or event to recognise color codes and do actions accordingly.

The library works well when I compile the "AP_PIXY_test.pde" example to my APM2.5 through the arduino IDE for Ardupilot.

My problem is when I try to add it to the main code. When I just include all the files there is no problem and the APM works fine. But when I try to define a variable in the UserVariables.h such as : "static AP_OpticalFlow_PIXY Pixy_Flow" the APM doesn't work. It compiles with no errors but the APM doesn't restart, no lights are ON exept the "Alive" one. I've uncomment the "#define USERHOOK_VARIABLES UserVariables.h" in AP_Config.h and disabled the optical flow through "#define OPTFLOW DISABLED" . Nothing else was changed.

what am I suppose to do to make it work? What are my errors?



Comment by Randy on April 15, 2014 at 6:02am


     For arducopter you'll need a minimum of 4hz.  5hz is best though.  1hz definitely won't work I'm afraid.  Inertial nav will get very upset.

Comment by Antonie Kruger on April 15, 2014 at 5:42am

Thanks, Randy. Would it take the NMEA strings at 5Hz as the binary or is 1Hz OK?

RE dual sensors - how are these managed? Are they identical sensors as the on-board IMU's managed through the I2C port or would other sensors be considered?

Comment by Randy on April 15, 2014 at 5:13am


     Those are some big questions and I can't answer them all.

     For the NMEA messages you can find our NMEA driver here.  It seems to be looking for 3 specific messages, GPRMC, GPGGA and GPVTG.  I've never looked at the nmea driver before though.

     Re the IMU, the driver for each accel/gyro chip should convert the output to deg/sec for the gyro or m/s/s for the accelerometer.  In other parts of the code we deal in centi-deg/sec or centimeters/s/s but I don't think that's the case for the IMU sensors.

     Re multiple sensors, we're extending the AC/AP software so that it makes use of the extra sensors (dual-gyro, dual accel, dual compass even dual GPS) on the Pixhawk for AC3.2 and the latest version of plane already support this (except the dual-gps).  My guess is that instead of offloading the attitude processing it makes more sense to offload the higher level navigation processing to a separate processor.  I think this because the communication overhead of pushing all that data around is probably quite high.  Better to keep the attitude processing very close to the IMU.

Comment by Antonie Kruger on April 15, 2014 at 4:03am

Hi Guys, I have a question around the NMEA GPS input stream and the IMU sensor - I apologise if these have been covered, I cant find the answers I'm after.

Firstly, there are many NMEA strings in the NMEA definition, it is not a single string that is generated, but can be a vast amount of string. This depends on the activated requirements on your GPS receiver. Here's my question - what are the minimum NMEA string specs that APM need to function properly and at what rate are these required(Hz)?

Secondly, the IMU sensor. Are there standardised units of measure for the sensors on IMU's(Accel, Gyro, Mag, Baro). As GPS position is generally defined with a degree lat and long, is there a similar definition for IMU's? If so, would it be possible to adopt such a philosophy with the APM development - allow the attitude to be streamed to the flight controller via a port instead of using the on-board sensors. The benefits in having this would be:

1. Moving the attitude processing off the flight controller.

2. Multiple IMU's can be used to improve accuracy and have sensor redundancy. Continuous health polling with reading averaging and standard deviation testing before feeding to the filter can be managed by a attitude processor and a clean attitude stream can be fed to the main flight controller.



Comment by Minh Tran Quang on January 24, 2014 at 1:19am

 Hello, Shyam

You may look at this for information



© 2020   Created by Chris Anderson.   Powered by

Badges  |  Report an Issue  |  Terms of Service