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: 546
Latest Activity: yesterday

Discussion Forum

Real time extraction of apm 2.5 telemetry to matlab?

Started by J'Rome. Last reply by mikiuse Mar 20. 5 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

Do you have to have a rate controller?

Started by Ozy. Last reply by Talha A. Feb 14. 1 Reply

I've been reading some academic papers such as…Continue

Tags: Ardupilot, Quadcopter, PID

obstacle avoidance programing using 6 maxbotix (XL-max sonar - EZ/AE) range finders (arducopter)

Started by anubhav prabakar. Last reply by Hameedullah Omari Feb 2. 13 Replies

Hi guys!!!I would like to program the APM 2.0 and integrate these 6 sensors for obstacle avoidance. Has anybody done that?? Any hints on how to do this??Continue

Takeoff and Arm from GCS arducopter 2.9.1

Started by Markus Järve. Last reply by Nate Miller Nov 5, 2014. 27 Replies

Firstly I would like to apologize for sending takeoff message to all people in "Learning to program the Ardupilot…Continue

Tags: motor, arming, MP, Takeoff

Comment Wall


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

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


Comment by Antonie Kruger on January 16, 2014 at 5:05am

Hi Randy, thanks.

Comment by Randy on January 15, 2014 at 10:43pm


     The best way is probably to modify the AP_MotorsQuad.cpp file's so that it adds another motor at the bottom with zero for the roll, pitch and yaw factors.  That alone might do it.  Below is an excerpt of that file with the additional line that I think should be added.

        // X frame set-up
        add_motor(AP_MOTORS_MOT_1,   45, AP_MOTORS_MATRIX_YAW_FACTOR_CCW, 1);
        add_motor(AP_MOTORS_MOT_2, -135, AP_MOTORS_MATRIX_YAW_FACTOR_CCW, 3);
        add_motor(AP_MOTORS_MOT_3,  -45, AP_MOTORS_MATRIX_YAW_FACTOR_CW,  4);
        add_motor(AP_MOTORS_MOT_4,  135, AP_MOTORS_MATRIX_YAW_FACTOR_CW,  2);
        add_motor_raw(AP_MOTORS_MOT_5, 0.0,  0.0, 0.0, 5);


© 2015   Created by Chris Anderson.

Badges  |  Report an Issue  |  Terms of Service