ArduCopter 3.2.1 and AntennaTracker 0.7.2 on MEGAPIRATE!

It's a solution that you can build and upload the last APM 3.2.1 code for MEGAPIRATE BOARDS and AVR atmega2560 GENERICS BOARD with I2C bus communication.

As you know, megapirate team stop building APM and the last code was 3.1.5 version, we are desired work and port the last AVR APM 3.2.1 to this board, megapirate and AVR boards with atmega 2560 and I2C bus communication.

TESTED AND WORKING on MEGAPIRATE BOARDS:

   - ArduCopter 3.2.1
   - AntennaTracker 0.7.2

VIDEO WORKING APM 3.2.1 ON MEGAPIRATE:

   

    https://www.youtube.com/watch?v=baIYXkhdYcU

1. SOFTWARE TOOLS REQUIRED
--------------------------

These tools you need to download first.

1.1 Arduino 1.0.3 with gcc-4.8.2 version download from this link:

http://firmware.diydrones.com/Tools/Arduino/ArduPilot-Arduino-1.0.3...

1.2 Git tool, download from this link:

https://git-scm.com/downloads


2. STEPS FOR COMPILING
----------------------

2.1 Download and Decompress Arduino from section 1.1 to c:\arduino. You will see this order path c:\arduino\hardware\tools\avr\bin

2.2 Download and install GIT tool from section 1.2 to default path. NOTE.- in the steps windows install choose the option:

"Run Git from the Windows command Prompt"

2.3 Open Explorer and navigate to 'c:\' drive, right click and select "Git bash here", it's open a windows command prompt.

2.4 In prompt command line type the next command to clone ArduCopter-3.2.1_I2C branch as follow:

$ git clone https://github.com/hiro2233/URUS8.git ardupilot
$ cd ardupilot
$ git checkout ArduCopter-3.2.1_I2C

2.5 Open Arduino, go to File, Preferences, in "sketchbook location" click on Browse and choose the path where are the ardupilot folder you checkout with GIT,
in this case c:\ardupilot, ok and close.

2.6 Now load Arducopter sketch, compile and upload to the MEGAPIRATE board.

Enjoy!

BUILDING CODE FOR ANTENNA TRACKER

-------------------------------

1. SOFTWARE TOOLS REQUIRED
--------------------------

These tools you need to download first.

1.1 Arduino 1.6.6 version, download from this link:

http://arduino.cc/download.php?f=/arduino-1.6.6-windows.exe

1.2 Git tool, download from this link:

https://git-scm.com/downloads

1.3 fix_includes_arduino166 program, With this tool you can change all include headers files to work with arduino 1.6.6 in windows.
You need compile the code, it's included on repo branch master-AVR Tools/ArdupilotMega_ON_Generic_Board/


1.4 Notepad++, download from this link:

https://notepad-plus-plus.org/download/v6.8.8.html


2. STEPS FOR COMPILING
----------------------

2.1 Download and Install Arduino from section 1.1 to default path.

2.2 Download and install GIT tool from section 1.2 to default path. NOTE.- in the steps windows install choose the option:

"Run Git from the Windows command Prompt"

2.3 Download and install Notepad++ from section 1.4 to default path.


2.4 Open Explorer and navigate to 'c:\' drive, right click and select "Git bash here", it's open a windows command prompt.


2.5 In prompt command line type the next command to clone Ardupilot master-AVR branch as follow:

$ git clone https://github.com/diydrones/ardupilot.git
$ git checkout master-AVR
$ echo "ARDUINO=/c/arduino" > /c/ardupilot/config.mk


2.6 Compile Tools\ArdupilotMega_ON_Generic_Board\fix_includes_arduino166 with VS2013 or SharpDevelop (with this one was compiled).
Then you use as follow:

fix_includes_arduino166 -P <PATH_TO_FOLDER>

Example: Supose that you cloned Ardupilot in c:\ardupilot then you will have c:\ardupilot\libraries and you want make AntennaTracker c:\ardupilot\AntennaTracker then,

fix_includes_arduino166 -P c:\ardupilot\libraries
fix_includes_arduino166 -P c:\ardupilot\AntennaTracker

WARNING!
This tool make changes to the files in all librarie path and this tool doesn't make a backup of your files. You must be sure.

2.7 Open Arduino, go to File, Preferences, in "sketchbook location" click on Browse and choose the path where are the ardupilot folder you checkout with GIT,
in this case c:\ardupilot

2.8 Open the next file with notepad++, c:\ardupilot\libraries\AP_HAL\AP_HAL_Boards.h and replace this line #define AVR_ARDUINO_ENVIRONMENTS with //#define AVR_ARDUINO_ENVIRONMENTS. Save and close.
NOTE: If you uncomment this line, you are telling to Arduino make code for AVR Generic Board, but if you comment with this line with '//' you are telling to Arduino make code for APM2 Board.

2.9 Open AntennTracker in Arduino and compile.

ENJOY!

If you are looking for detailed and description file libraries modification follow the oficial PR on the oficial Ardupilot repo at:

   

    https://github.com/diydrones/ardupilot/pull/3578  ;

(DEVELOPERS) AVR and MEGAPIRATE DEVELOPMENT SUPPORTS Version Boards
Chat discussions at https://gitter.im/dronebo/URUS8


(USERS) MEGAPIRATE and AVR SUPPORT
Forum Discussions and supports at http://drone.bo/foro/development-english/apm

Views: 6590


Developer
Comment by Andy Little on February 29, 2016 at 4:53am

It is good to see that Atmega2560 and master-AVR branch is still being supported. I am sure there are many many AVR boards out there that have much life left in them yet. Great work :)

Comment by hiroshi takey on February 29, 2016 at 6:25am

Thanks Andy Little!

We are very happy promoting for developers can make and porting to any platform the best flight systems as is APM and personally i want show to news developers looking for flexibility flight systems, or robotics systems that they can make many automated and robotics projects from APM framework.

And for final user showing the APM powerfull flexibility with lastest code on this AVR board version.

Right now we are looking for working in a CAPE hardware system for RaspBerry PI with the APM 2.6 board to make and build the lastest APM versions and work together.

I think it's will be very interesting for development comunity.

Comment by benbojangles on February 29, 2016 at 11:23am

Yay! Megapirate <3

Comment by Thomas Butler on February 29, 2016 at 4:30pm

Your video only shows interfacing with MissionPlanner which is only half the battle. I would not call this "working" until you show the copter flying. I don't see the EKF enabled! Is it running the DCM of EKF? If you are not running with the Kalman filter, what's the point?  

Let's see a video with your copter in loiter/position hold!  THEN you can say it "worked".

Additionally, why are you bothering with the arcane Arduino compiler.  Use the Atmel Studio IDE with VisualMicro plugin it works with the latest MegaPirate code v3.1.5. Forget all that command line mickey-mosing around!

Comment by Thomas Butler on February 29, 2016 at 4:46pm

And additionally, ArduCopter v3.3 added several bug fixes to the Kalman filter code; these should be added ASAP!

Comment by Marc Dornan on February 29, 2016 at 4:59pm

@Thomas: It would still be good to have 3.2.1 running on a Crius AIOP. DCM work just fine, IMHO. It is a worthy objective for those that like to re-purpose old boards. I still would like to get the last version of Multiwii working on my AIOP board, just for nostalgia's sake.

Comment by Thomas Butler on February 29, 2016 at 5:19pm

One more note. You should mention this is NOT an APM2 compatible version.

FYI: there is no "MegaPirate" board. It is the Crius All-In-One you are compiling for. "MegaPirate" was the hacked version of ArduCopter made to run on the Crius board.You should note in your post that this is a mod to run the ArduCopter3.2.1 on the Crius board.

I don't see a HAL library module in your "I2C" version, and not to be critical, but just an observation, it looks like you have hacked the code and not followed the HAL convention. Perhaps you should see v3.1.5 of the MegaPirate version which has a HAL for the Crius board; AP_HAL_MPNG.

Rather than bypassing the code convention it always best to follow them. Nobody wants to have to maintain with chopped up code. I suggest you import the HAL changes from MegaPirate and update this version, AND while you are at it add in the latest fixes from 3.3; ONLY the fixes please. We don't need any more superfluous changes!

Anyway, looks like it might work. I'll try a build and run it on my old Crius board, but I doubt there will be enough horsepower to enable the Kalman filter.

Comment by Thomas Butler on February 29, 2016 at 5:21pm

Oh! Forgot to say, in spite of the caveats, good job! happy flying!

Comment by Thomas Butler on February 29, 2016 at 9:11pm

Perhaps I will make a HAL for the Crius and then put back the original APM2 values.

Hey @Marc, absolutely. Strange how the hot item is a KISS flight controller w/STM32F3 CPU! Less in more! Just goes to show don't really need RTOS either. Compiled w/CLI and STILL have 20k free code space.

The Kalman won't run on the Crius w/16mhz CPU; stuck with DCM. Additionally, defines in the code lock out Kalman if the CPU is a slow one. However, with proper isolation and dampening it might suffice.

Note there are a few things to change in the source:

The source is default to PPM sum on A8. In RCInput_APM2.CPP one can enable the PWM input. In addition, in APM_config.h, one can enable the CLI code for the command line interface. If the board is a Crius 1.0 or 1.1 it has no dataflash. This code set has dataflash disabled. Enable it in APM_config.h if you have a Crius v2.0. 

I have my MegaPirate code (ArduCopter v3.1.5r2) building in Atmel Studio (aka VisualStudio) with VisualMicro. If I have some spare time, perhaps I'll try a setup to build this code set. It a world of difference working in VS vs Arduino.

Did a build of this ArduCopter v3.2.1 code. Seems OK; compiles and the Crius interfaces with MissionPlanner. Even enabled the "removed" CLI.  I'll give it a fly when the weather gets better.

Comment by Rana on March 1, 2016 at 10:44am

did not workfor me

Comment

You need to be a member of DIY Drones to add comments!

Join DIY Drones

© 2019   Created by Chris Anderson.   Powered by

Badges  |  Report an Issue  |  Terms of Service