Niklas's Posts (3)

Sort by

3689405346?profile=original

 

So, what do you do when you have some old hardware lying around, and want to reuse that instead of buying the new ArduMegaPilot: Build you own ground station and modify parts of the code for the Ardupilot.


First of all I got tired of LabView, and the other standard parts, and found later versions of Ardupilot too messy to manipulate. Second, most of the available ground stations are written for Windows, not good at all on a Mac. Third, I needed some functions, that is not obviously available when using Ardupilot.


What I have done is to implement a simple ground station in Java, using standard components. It shows the basic information transmitted by the Ardupilot. It uses Google Earth to show the planes position on a map. Further more, it supports two way communication with the Ardupilot. This means that I am able to adjust gains, upload waypoints from a Google Earth .kml file and so on, while the UAV is in the air.


If anybody is interested I will make the sourcecode publicly available.


Best regards

Niklas

 

 

EDIT: I have add'ed the source code for the ardupilot and the source for the Java groundstation. The code is not commented at all, and is highly customized for my setup. Feel free to use any parts you want. Any questions, hit me! The code also contains quite good examples of how to encode at decode binary GPS data. Enjoy.

 

Ardupilot_25rc.zip

javasrc.zip

Read more…

Buggy GPS code for the EM406

Hi all.

I was messing around with my simulator some time ago, and found that the ground course, returned from the binary GPS decoder, in GPS_EM406.pde returned false heading between 300 and 360 degrees. This is also mentioned in the comment.

The problem is that the number returned from the GPS module is returned times 100, as the comment suggest, this means values between 0 and 36000.

if(ground_speed >= 50){

//Only updates data if we are really moving...

intUnion.byte[1] = gps_buffer[j++];

intUnion.byte[0] = gps_buffer[j++];

ground_course = intUnion.word; // degrees * 100

ground_course = abs(ground_course);//The GPS has a BUG sometimes give you the correct value but negative, weird!!

}else{



Since the integer used in the intUnion is a 16 bit signed integer, only numbers up to 32768 is supported, this fact yields negative values when the value is above, from the bit pattern interpretation.


The solution is to use the longUnion instead of the intUnion. This solves the buggy ground course.



if(ground_speed >= 50){

//Only updates data if we are really moving...

longUnion.byte[1] = gps_buffer[j++];

longUnion.byte[0] = gps_buffer[j++];

ground_course = longUnion.dword; // degrees * 100

//ground_course = abs(ground_course); //The GPS has a BUG sometimes give you the correct value but negative, weird!!

}else{


I hope that this helps somebody.


Best regards

Niklas

Read more…

Simulation, taken to the next level.

Hi guys,

I finally decided to join the community with my first post, enjoy.

My work started with great inspiration of the 6.th round of the T3 contest, where the task is to simulate a flight, writing DIY Drones. While the description of the open loop, nor the closed loop simulation did not include any real sensory inputs, I decided to setup a small test scenario on my desktop. I was not happy about how the simulation of the GPS data was performed either. From the beginning my plan has been to replace the thermopiles with a accelerometer, to reduce the price but also for simplicity. Notice that this is not the IMU board, merely an accelerometer which return the same information as the thermopiles.

The objective of my setup is to fool the autopilot into thinking it is flying for real, and not just using a simulation on the Ardupilot. For this I need to create a setup which tilts the accelerometer in a realistic manner. Create a GPS simulator for the Ardupilot, to fool it into believing that it receives real GPS data.

First on the hardware. The test setup consist of:

- An Ardupilot board
- An accelerometer
- An Arduino Deicimila
- And a servo

The accelerometer is placed on the servo. The servo is controlled by the Deicimila. The Deicimilia board receives input from the Ardupilot board, to output to the servo. The Ardupilot read the roll and pitch from the accelerometer (which simulates a roll with thermopiles).


Second I need to simulate where the plane is going by creating the appropriate GPS data. This took some time, but I succeeded by reversing the code from the Ardupilot, and reading some documentation of the Sirf Binary Protocol. The result is a small application written in Java, which reads of the roll and tilt, and produces a binary string containing latitude, longitude, altitude etc., which is sent back to the Ardupilot board. And it actually works. By running the real autopilot code the board turns on the blue LED, to indicate that it receives good GPS data.

The result is a (from my point of view) test of the real autopilot software, and I discovered some bugs in the code, which I will describe some times later. I will also create a detailed description of how to interpret the binary data of the GPS modules, if anybody is interested.

Please comment, and I will elaborate on any missing parts.
Read more…