Learning to program the Ardupilot Mega

Information

Learning to program the Ardupilot Mega

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

Members: 314
Latest Activity: yesterday

Discussion Forum

My Brain is Melting, usual newbie help required please.

Started by alex corbett. Last reply by Sid Apr 30. 10 Replies

Hi Everyone,I've been happily flying and being flown by my apm2 tricopter since pretty much it came out. I've never dabbled in altering or writing code.......until now.I'm trying to sort    …Continue

Tags: how, to, compile, arduino, frsky

Getting Reliable Attitude & Heading Data

Started by Nicholas J Anderson. Last reply by Redemptioner Apr 26. 8 Replies

Hello,For the sake of better understanding APM guts I've been working on what I've been calling ArduGimbal.  I've just assembled code together looking at Arducopter 2.5.5 for how to structure the…Continue

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

Started by anubhav prabakar. Last reply by Steven Lutz Mar 25. 6 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 Markus Järve Mar 18. 21 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

Comment

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


Developer
Comment by Andreas M. Antonopoulos on June 24, 2012 at 12:54pm

@Veikko,

Try

git checkout modem_test

With GIT, all the versions of all the branches are already downloaded. All you have to do is tell it which version to make your local files look like. By default you are looking at branch master which is just a copy of the main repo, if you checkout modem_test you will see that branch's files' appear. modem_test only works for ArduCopter. I would suggest testing it on ArduCopter on the bench. If it works for you (live telemetry), I can quickly and easily port the code to ArduPlane in a few minutes. 


Developer
Comment by Andreas M. Antonopoulos on June 24, 2012 at 12:52pm

@Mike, The SITL system that I have running on the Autobuild/Autotest (jenkins), actually builds all the pre-requisites and creates the folder structure. You can see all of that in the job "autotest_skel", which builds the skeleton directory. 

If you look at job apm_autotest_main for example, it contains a full copy of all the required files to run SITL, in its workspace. You can download it as a zip. 

The older autotest and SITL systems have a dependency on 4-5 tools and libraries and expect everything to be in specific directories. I will be changing that gradually, but for now I just re-created the correct directory structure, which you can see online

Comment by Veikko Vierola on June 24, 2012 at 12:45pm

@Mike "by the way, Massimo is a member here"

Thats cool. Mike do you have experience about the GIT. I'm trying to make a version of the APM that includes Andreas's modem_test code. The code is available in Andreas's GIT repository but I don't know how to use the GIT exactly right?

Comment by Michael Pursifull on June 24, 2012 at 12:33pm

@Andreas - I found that setting up SitL can be more complicated than might be portrayed in the wiki. A typical issue with a developer of yummy software is that their development environment, which they are using to write up the install process, often has dependancies pre-installed that get forgotten about. This was either the case or my environment was significantly different. I was in a hurry, and I have everything working -except- jsbbsim - but there were more things required that are presently in the wiki. I had some issues with jsbbsim and aborted when someone needed help with a servo in a mission (and so went back to my HiL setup, and then I didn't feel like unplugging it to work on the code I was hacking up.)

I wish I had kept notes. Maybe someone smarter than me will take notes while setting up for SitL in a clean system, and we can make SitL more accessible for a wider audience?

Comment by Michael Pursifull on June 24, 2012 at 12:26pm

@Veikko - by the way, Massimo is a member here

Comment by Veikko Vierola on June 24, 2012 at 11:24am

Reference: http://diydrones.com/group/telemetry-over-cellular-ip/page/testing-...

Hi, I'm trying to get Arduplane version included with modem_test branch. Does anyone know how to do it? I have downloaded and installed the GIT GUI and GIT Bash and I have downloaded the whole "git clone https://code.google.com/r/andreas-apm2-wip/" using the GIT command line... What do I have to do next to compile this modem_test version of the arduplane? Or do I have to use some branch command to download right version from the GIT.

I know how to compile APM with arduino.cc, but I don't know how to make right kind of version (modem_test) using the GIT-system?


Developer
Comment by Andreas M. Antonopoulos on June 5, 2012 at 12:09am

Don't know if this is interesting to the group, but here goes:

I am working on an automated build and test system (continuous integration) which builds upon Tridge's work on autotest. 

It is hosted, open to all at:

http://jenkins.dronecloud.net/

This system will automatically build every single code revision, for most every imaginable configuration of plane, copter, heli and rover. It builds APM2, HIL and SITL modes. It also runs automated flight testing (the autotest functions under Tools/autotest) of planes and quads to test out functions like Loiter, RTL, regular flight, hover etc. 

The reason this may be useful/interesting, is that you can look at the console logs of any build and see each and every command that is used to build that configuration. You can look in the "Workspace" and see the file structure. It also allows developers to click a button and launch a software-in-the-loop simulation of any revision or configuration and then connect a GCS to "fly" it. 


Over the next several weeks, I will be continuing to work on this system in anticipation of a more formal launch once it is rock solid and thoroughly tested. 

Let me know if you find it useful or if you have any feedback. 

Comment by Ellison Chan on May 22, 2012 at 1:55pm

Multi-tasking is usually done by the OS in computers.  The Arduino has no OS perse. The whole system consists of a bootloader, and C/C++ like programming environment.  This does not mean that a small multitasking OS cannot be put onto the Atmel chip, but it isn't used right now.  Most microcontroller chips are using hardware timers to perform tasks asynchonously.  This is like multitasking, without the need of an OS.  As well by performing work at different intervals of the system clock, serial code can also be executed asynchonously.

In the AC code, the task are basically divided into a fast loop, a fiftty hz loop, and a medium loop.  The fast loop runs at 100hz, the fifty hz loop is obviously run at 50hz, and the medium loop runs at 10hz.  The 50hz loop does other slower tasks, like running the medium loop, and updating gps data.

There are other things that happen in interrupt service routines, which need to execute even faster than 100hz, like actually sampling the radio input channels, and updating the motor output channels.

Believe it or not this is much simpler than any multitasking OS, like Linux, and allows things to happen at within preset intervals.  What is usually referred as realtime processing.  That's the 20,000 foot overview of how things work with AC code.


Developer
Comment by Andreas M. Antonopoulos on May 22, 2012 at 1:37pm

Veikko, Indeed it is quite complex. Currently, ArduPlane is 97,000 lines of code.

You will find it easier to browse code from this link:

http://code.google.com/p/ardupilot-mega/source/browse/

For example, the loops start here:

http://code.google.com/p/ardupilot-mega/source/browse/ArduCopter/Ar...

What I did with the link above is I clicked on the line number and then copied the URL. That allows you to link to a specific line, so you can send the URL and say "look here!"

Comment by Veikko Vierola on May 22, 2012 at 1:20pm

Just borrowed a book from library by Massimo Banzi, Getting Started With Arduino. Seems to be quite good book for learning the basic idea of Arduino. It says that Arduino can not do real multi-tasking. I was just wondering that if you have for example Arduplane software running in Arduino board, how frequently/quickly Arduino reads the information from different sensors? I understood that Arduino runs a loop and during that loop cycle it gathers all the information from different sensors. But how is it really done? Does Arduino store the sensor data to some temp memory when it processes the wanted operations/reactions according to the data? For example arduino gets altitude info from NMEA data, it has to be compared to the flight route planning altitude, if the NMEA data altitude is less than the flight route planning altitude Arduino starts a servo loop to give tail elevator command to lift up so that the aircraft starts to climb. At the same time the gyro gives information that the max pitch up angle is received, how Arduino determines that now I have to stop lifting the nose up? Arduino has to do these comparisons for all the sensors: gps speed, pitot speed, gps location, gps altitude, pitch, roll, yaw, xyz-g sensors, baro altitude, temperature, magnetometer readings.....How fast is Arduino able to run the loops, and how is it done if you want to for example reduce max bank angle according to height or something similar...How many times per second is Arduino capable of reading the sensor data???? At least I have learned the complexity of the programming after reading the book....You must have very good process management talents to keep all the system part tasks working together in the code. Blinking LED is 8 rows of code, Blinking led when button is pushed needs double amount of code. Just wonder How many rows exist in Arduplane or Arducopter code. Have to say that the coding must have been a very complex job to do... 

 
 
 

Social Networking

Contests

Season Two of the Trust Time Trial (T3) Contest has now begun. The fourth round is an accuracy round for multicopters, which requires contestants to fly a cube. The deadline is April 14th.

A list of all T3 contests is here

Advertisement

© 2013   Created by Chris Anderson.   Powered by

Badges  |  Report an Issue  |  Terms of Service