Ardupilot 2.5 and new groundstation taken to next level.

 

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

Views: 364

Comment by KnutL on May 7, 2011 at 3:07am
Could you say a few words, what you did on the ardupilot side to allow for 2-way communication ?
Comment by Niklas on May 7, 2011 at 6:13am

Hey guys.

 

The trick is to not mess up the data stream from the GPS module, since only one serial port is available. I created a command queue in the ground station, so it transmits one command after each GPS message. These are only received every second in my case. Then I modified the code for the binary GPS message parser, to be able to parse additional commands. I will make the source code available asap.

 

Regards

Niklas

Comment by KnutL on May 8, 2011 at 5:24am
Ok. agreed: Thats the way to go. Wait for the source code to check, if I can use it in my case.
Comment by KnutL on May 10, 2011 at 3:24am

Some quick comments:

Donwloaded your code. I imported the Javacode to eclipse first (on Vista), could compile it. Had some minor problems with gnu.io :)

I connected just an Arduino to get a hw connected to an usb port and changed only

one line of code


String portName =

It seems that it works so far, because the GS Window opens.

Next step will be to get the AP code running and connect the AP. The will be a task for tomorrow.

Thnx for sharing knut


"COM3";
Comment by Niklas on May 10, 2011 at 2:06pm
Actually I think you could just use the GPS and print functions, if you have a working setup yourself.
Comment by KnutL on May 10, 2011 at 11:28pm

It was easier for me to connect the AP.

I did that and downloaded your code and did some adaptions to my hardware.

The AP runs (hm, I can see, that the servos move if I use my RC). Connecting your GD I can see the servo values

and the CtrlMode, but NOT roll/pitch from the thermopiles.

I receive in eclipse the follorwing error message


%%524.0000000000;0;950;1082;950;1044;55.0000000000;10.0000000000;55.0000000000;10.0000000000;71.4000015258;9.5000000000;150.0000000000;133.0000000000;0**


java.lang.NumberFormatException

at java.lang.NumberFormatException.forInputString(Unknown Source)

at java.lang.Integer.parseInt(Unknown Source)

at java.lang.Integer.parseInt(Unknown Source)

at SerialReader.parseAdditinalInfo(

at SerialReader.processString(


 



Line 185 in serialReader is:

plane

.roll_p = Integer.parseInt(in[ROLL_P]);

: For input string: "55.0000000000"SerialReader.java:185)SerialReader.java:81)




 

 

Comment by Niklas on May 10, 2011 at 11:34pm

For some reason you received floats on your serial channel? Since a float can not be parsed by Integer.parseInt the code fails. I would look into the print functions in the ardupilot code.

The received values should look something like this: %%524;0;950;1082;950;1044;55;10;55;10;71**. You can confirm that your AP code i correct by checking the communication in the Ardupilot IDE.

Note that gains har displayed and input multiplied by 100.

Best regards

Niklas

Comment by KnutL on May 10, 2011 at 11:45pm

This is strange. I did not touch your code in that area (why should I). And yes, in the IDE Monitor I can

exactly see, what I can see in eclipse: It does not say %%bla bla;55; it says %%bla bla;55.0000000;

 

And in the code (I hope, this is the roght area)

void printAdditionalInfo()
{
       Serial.print("%%"); 
       Serial.print(battery_voltage,DEC);                      // 0
       Serial.print(";");
       Serial.print(servo_throttle,DEC);    // 1
       Serial.print(";");
 Serial.print(ch1_trim,DEC);   // 2
 Serial.print(";");
 Serial.print(ch2_trim,DEC);   // 3
        Serial.print(";");
 Serial.print(ch3_trim,DEC);   // 4
        Serial.print(";");
 Serial.print(ch3_fs,DEC);   // 5

        Serial.print(";");
        Serial.print(roll_p *100,DEC);   // 6
        Serial.print(";");
 Serial.print(roll_i *100,DEC);   // 7
        Serial.print(";");
 Serial.print(pitch_p *100,DEC);   // 8
        Serial.print(";");
 Serial.print(pitch_i *100,DEC);

I am going to delete the DECs.

Comment by KnutL on May 11, 2011 at 12:04am

Ok, I changed the code, put int() in each line. The errors messages in eclipse are all gone.

I can see data comin in, but still NO display in the GS window with regards of pitch/roll thermopiles.

Will do some debugging later the day.

Oops, did not check my GPS..there you did a lot of changes..

Comment by Niklas on May 11, 2011 at 12:08am

I am using an accelerometer instead of thermopiles, so my sensor file is altered as well. You should be able to use thermopiles, just keep track of the roll (sensor_roll?) and pitch (sensor_pitch?) variables.

 

The changes in the GPS code is only used the command parsing.

Comment

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

Join DIY Drones

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

Groups

Advertisement

© 2013   Created by Chris Anderson.   Powered by

Badges  |  Report an Issue  |  Terms of Service