Bharat Tak's Posts (3)

Sort by

This is in continuation to my earlier blog post on Hardware In Loop Simulation For Co-operative Missions Using ArdupilotMega

This video was recorded through live video telemetry from the 'Follower' aircraft running custom code(attached below) on APM autopilot board. The 'Follower' aircraft receives waypoint information from a 'Leader' aircraft also running on APM autopilot board and thus follows the leader aircraft autonomously through the air.

The video shows the airframe of the follower on which the camera was mounted. We were hoping to catch the 'Leader' aircraft on the camera flying ahead of this follower, but poor video signal quality left us wanting more. Although you can occasionally see the leader in the video (at 3:30), its no more than a black spot in the air. Next time we'll probably use something like FlyCamOne for onboard recording or a better video telemetry kit.  

Autopilot Used(Both Leader and Follower) : APM 2.5 (Latest)

No hardware changes required except for soldering burg-strips on UART2 of APM2.5 board. UART2(Serial3) is used for all telemetry.

Communication modules used : Xbee Pro S1 in API (mode 1) on all Aircrafts(UART2) and Groundstation Laptop

Aircraft GCS communication : MAVlink v1.0  *Embedded in Xbee API header and Footer.

ie (API Header)[All MAVlink Packets](API Footer)

GCS used : MissionPlanner, Qgroundcontrol GCS coupled with MAVproxy.

MAVproxy is used to collect data from groundstation Xbee and Add/Strip API headers as and when required to send clean MAVlink packets to qGCS and MissionPlanner through UDP connection on separate ports.

Inter Aircraft communication : In Xbee API protocol (Not MAVlink)

No. of MAVs in the cooperative mission simulated : Upto 3 till now, can be easily extended to more.

Cooperative missions flight tested : Leader follower for 2 MAVs.

The sketchbook containing the firmware for the above cooperative mission is attached.

Flight Tested Leader-Follower Sketchbook. I'll write a small readme on how to set this system up and get it going soon, it's straight forward really.

Read more…


Here is an ordered list of my actions to see how I can get my Xbee running on APM2.5.

Xbee is Xbee Pro 2.4ghz S1, Firmware is  XBP24 version 10EC, all defaults except baud = 57600

-Unzipped brand new APM 2.5 from plastic packaging, looks good!
-Cannot see the board version from the black protective cover
-Connected to the windows laptop via USB
-Mission planner v1.2.30 mav 1.0, APm shows up as COM24, baud 115200
-Upload firmware Arduplane v2.68 form Missionplanner
-Upload done, connecting to Missionplanner via same port(COM24, baud 115200)
-Connect done, Hud shows correct attitude

-Disconnect Mission Planner, Disconnect USB
-Board is now powered off
-Two Xbees, S1 Pro, transparent mode, baud rate 57600, communication verified on laptop(Docklight)
-Connected 1 Xbee to the telemetry port shown on the APM2.5 board(Telem. port on black Protective cover, UART0/2 on the board, TX-RX, RX-TX, 5v-5v, Grd-Grd)
-Powered the board with the adapter provided (JP1 is still not connected)
-Board powers on, leds blink(gyro calibration led dance), xbee powers on
-Connect Mission planner with groundstation Xbee COM port, baud 57600, TIME OUT, not connected.
-Verified that no data is coming on groundstation xbee using Docklight
-Board Power off
-Connected FTDI (TX-tX, RX-RX, Grd-Grd)
-Powered the board with the adapter provided (JP1 is still not connected)
-Connected Mission Planner, FTDI COM port, baud 57600, CONNECTED!
-Connect done, Hud shows correct attitude

Conclusion, correct MAVlink data comes to the UART0/2 port but is somehow NOT WORKING with Xbee.

-Removed Black Protective cover of APM2.5
-Soldered pins in UART0 & UART2 available on the side of APM2.5 (v2.5.1, now that i can see it)
-Connected Xbee on UART0
-Powered the board with the adapter
-Connect Mission planner with groundstation Xbee COM port, baud 57600, CONNECTED!
-Connect done, Hud shows correct attitude

Conclusion, correct MAVlink data comes to the UART0 port and WORKS with Xbee.

In search of UART2 for telemetry
-Board Power off, Xbee disconnected
-Cut the two wires connecting the upper pads of AUTOMUX, soldered both the lower two ones.
-Short tested to verify the solder connection.
-Connected Xbee on UART0/2 port on APM (TX-RX, RX-TX, 5v-5v, Grd-Grd)
-Powered using the provided Adapter
-Board On, leds dancing, Xbee powered
-Connect Mission planner with groundstation Xbee COM port, baud 57600, TIME OUT, not connected.
-Verified that no data is coming on groundstation xbee using Docklight
-Board Power off
-Connected FTDI (TX-TX, RX-RX, Grd-Grd)
-Powered the board with the adapter provided (JP1 is still not connected),Board On, leds dancing
-Connected Mission Planner, FTDI COM port, baud 57600, TIME OUT, not connected.
-Verified that no data is coming to UART0/2 using Docklight

Conclusion, no data comes to the UART0/2 port with AUTOMUX upper ports disconnected and lower ports connected(stock Arduplanev2.68 firmware).

-Connected Xbee on UART2
-Verified No data coming on UART2 port as well.

-Connected Xbee on UART0
-Connect Mission planner with groundstation Xbee COM port, baud 57600, CONNECTED!
-Connect done, Hud shows correct attitude

-Connected USB on USB port, Xbee on UART0
-Powered using USB
-Does NOT CONNECT with Xbee on UART0
-CONNECTS with USB after 30 seconds, but the 'Connecting MAVlink' window does not disappear, disappears only after i disconnect the Xbee

Conclusion, With stock Arduplane v2.68 firmware, with AUTOMUX upper ports disconnected and lower ports connected, No data comes to UART0/2
port, No data comes to UART2 port, correct MAVlink data comes to UART0 port, Xbee connects on UART0 port, but, with USB connected, Missionplanner
only connects with USB, no UART0.

Meddling with the Arduplane v2.68 firmware

-Downloaded the 'modified' Arduino 1.0.3 software and Arduplane v2.68 from APM google code page
-Created a sketchbook with Arduplane Libraries folder and Arduplane folder
-Set the sketchbook folder as default in Arduino firmware
-Open the sketch, Arduplane.INO
-Select Tools, Board, Atmega2560
-Compile, compiles ok.
-Paste this in APM_Config.h

// use this to enable telemetry on UART2. This is used
// when you have setup the solder bridge on an APM2 to enable UART2

-Save, Compile and Upload through USB
-Successfully Uploaded.

-Disconnect and Reconnect the USB
-Board on(Red LED Alive), no calibration Dancing LEDs!
-Connect Missionplanner using USB COM port
-Starts connecting, Getting parameters, STOPS in the middle of getting parameters!, hangs and then connection FAILED! (Multiple attempts, same results!)
-Random'ish data comes on port UART0 and UART2 at very low data rate. The only LED on is the Red ALive LED.

Conclusion, with firmware modified to TELEMETRY_UART2 ENABLED, with AUTOMUX upper ports disconnected and lower ports connected, Mission Planner stops connecting
on USB port, random data on UART0 and UART2 port. Additionally, abnormal LED behaviour. (So revert back to standard firmware)

Major setback: Just enabling #define TELEMETRY_UART2 ENABLED in arduino seems to be stopping proper telemetry everywhere!

So, long story short, can anybody tell how to enable telemetry on UART2 on APM2.5 ?

Read more…

3689491949?profile=originalAll the work below is done with the objective of finally being able to fly multiple MAVs/UAVs all in autonomous mode communicating with one another to achieve meaningful goals (Like quickly scan a particular area for identifying a target etc). The "Human pilot" flying in manual mode is optionally kept in the loop. Everything below is open source, so feel free to use/modify/extend :)

I am not sure if anyone else here in the community is working on carrying out such cooperative missions(like Leader-Follower, Orbit follower, Cyclic Pursuit etc) although theoretical work on it has been around for a while in many research papers. If nobody has worked on it yet, here is a fresh start, else, do comment below about your projects.

Currently, what we have here is a HIL simulator for these cooperative missions for 3 MAVs and we wish to now implement these in flight.    

A framework for Hardware in Loop Simulation (HILS) of cooperative missions in autonomous miniature aerial vehicles (MAV) using open source Ardupilot-Mega based hardware and software platform has been implemented. Ardupilot Mega (APM) is an Arduino based commercial autopilot board for stabilization and navigation of individual MAVs. Our framework extends its features to support HILS of cooperative missions for multiple MAVs by facilitating inter-aircraft and aircraft-ground station communication.

The framework has a loosely coupled design which isolates the high level planning algorithms from the rapidly evolving low level autopilot routines. It is designed as a natural extension to the various flight modes (Manual/Return-to-Launch/Circle/Waypoint navigation) already present in Ardupilot-Mega platform and can be switched between them seamlessly. Cooperative mission mode is triggered through switching to "Guided Mode".

Inter-aircraft communication is done using Xbee API protocol which facilitates unicasting custom message packets to-and-from any aircraft of the cooperative system. The Xbees are also used by all the aircrafts in the HILS to communicate with the QGroundControl Station (qGCS) using the widely compatible MAVlink protocol. This makes the framework compatible with any other GCS supporting MAVlink protocol.

Since all the communication between various nodes of simulation is through Xbees in API mode, it makes the framework readily extendable for flight testing of the cooperative algorithms in real flights. The hardware in this HIL simulation comprises of the APM autopilot controller board and Xbee modules in API mode. The APM board runs both the low level autopilot software and the high-level cooperative algorithms. Xbees perform the inter-aircraft and aircraft-GCS communication. The sensors and actuators are being simulated in this HILS framework. Open source flight simulation software Flightgear is used to simulate the flight dynamics. The sensor/actuator information is exchanged
between the autopilot board and Flightgear over a serial port. 

In short :

GCS used : Qgroundcontrol GCS

Autopilot Used : APM 1.4 (without Oilpan)

Communication modules : Xbee Pro in API mode on all aircrafts and GCS

Inter Aircraft communication : In Xbee API protocol

Aircraft GCS communication : MAVlink v0.9 embedded in Xbee API header and Footer

Flight Simulator Used : Flight gear, Aircraft used : Rascal 110 and C172p (JSBsim)

No. of MAVs in the cooperative mission simulated : Upto 3 till now, can be easily extended to more.

Cooperative missions performed up untill now : Leader follower for 3 MAVs, Orbit Follower for 3 MAVs, Cyclic Pursuit for 3 MAVs

Here are a few snaps of qGCS during various cooperative mission HIL simulations:

Leader Follower for 3 MAVs:

MAV1 : Autonomus Waypoint Navigation mode

MAV2 : Continuously follows MAV1

MAV3 : Continuously follows MAV1


View from another angle of the same mission.3689492202?profile=original

Orbit Follower for 3 MAVs

The orbit center(lat,long,alt) can be set for any of the 3 MAVs through clicking on APM Missionplanner "Fly to Here" option which sets it as the orbit center for that MAV and also sends this orbit center information to rest of the MAVs in the simulation with then accept it as there orbit center information. Thus all the aircrafts immediately start to converge into orbits around that center.


Another angle of view for the same simulation.


The major part of APM firmware is kept essentially the same, except for a few additions. This flowchart below explains what we have tried to do :


Since we were using APM1.4 without the Oilpan, we started with the firmware provided by ardupilotdev and made all the additions/changes in it. We are in an effort to port everything to the latest APM firmware so that we can test the setup in flight. We also have to shift from the old MAVlink 0.9 to MAVlink 1.0.

Here are the required codes for the leader follower mission (Edit it using Arduino 0022 relax patch)

I seem to have exceeded a space limit of some kind(can't seem to attach anymore files!), I'll attach the codes as comments below.   


This work was carried out by the combined effort of Swaroop Hangal and Bharat Tak under the guidance of Dr. Hemendra Arya.

Read more…