Developer

AP with Ground Station and 2-way comm

I wanted to post the code and exe of the Flash file for the Ground Station and my AP. If you want to try it, you need to do a few things first.(If you try this, remove your throttle or disconnect your ESC from your motor!)1 - Load the DefaultsWriter.pde onto the Ardupilot HW to get some decent values into the EEprom2 - Load the Waypoint Writer onto the Ardupilot HW to put some waypoints into the EEprom3 - Load the JSXPilot_Navigate.pde onto the Ardupilot HW4 - Download Serproxy and configure it as indicated in the cfg file5 - Run the Flash app as an EXE or with a local Flash player or -maybe- it will work in a browser6 - Press the space bar to connect the GS to Serproxy7 - tilt the plane to adjust the IR sensors and the plane is set to fly at 30MPH - it's in debug mode8 - If you want to play further, look in the test.pde and see test versions of 3 important functions. Elsewhere in the code these functions have been relabeled with a "_off" also turn off debug mode in the defines.hThis is a lot, but I'm used to it. Also, this is information for people making there own AP or just curious. It's not supported. It only works with my radio. It's barely tested. The code is very well commented. If you can get it to work for you, you win a gold star.Download it hereYou can see the video here of it in action. GroundStation.mov
E-mail me when people leave their comments –

You need to be a member of diydrones to add comments!

Join diydrones

Comments

  • Developer
    Hi Gus,
    are you on a PC or Mac? You may be tying to open a com port that isn't available. Check your serproxy config file. You may need to change that to the correct com port.
    Here is my latest code. I hid the map because when I'm in the field I don't have wireless. But this works really well with 2.5.03 because it has full uploading while the plane is in Manual mode.
    JasonGround_Station.zip
    https://storage.ning.com/topology/rest/1.0/file/get/3692022462?profile=original
  • I tried the above 1-7 steps you mentioned to run the adobe flash player of Ground Station but encounter a problem from serproxy: Fail to open Comm port - Connection refused. How do I solve this problem?
    Cheers
  • Developer
    If you look in the print.pde file you'll see void print_data() which has all of the output params.
    I'm using a format like this:
    Serial.print("!!");
    Serial.print(groundSpeed,DEC); // 0
    Serial.print("|");
    Serial.print(airSpeed, DEC); // 1
    Serial.print("|");
    Serial.print(throttle,DEC); // 2 throttle set by AutoPilot
    Serial.print("|");
    Serial.print(roll,DEC); // 3
    Serial.print("|");
    Serial.print(pitch,DEC); // 4
    Serial.print("|");
    Serial.print(rollSensor,DEC); // 5
    Serial.print("|");
    Serial.print(pitchSensor,DEC); // 6
    Serial.print("|");
    Serial.print(altitudeAboveHome(),DEC); // 7
    Serial.print("|");
    Serial.print(climbRate,DEC); // 8
    Serial.print("|");
    Serial.print(wpIndex,DEC); // 9
    Serial.print("|");
    Serial.print(wp_distance,DEC); // 10
    Serial.print("|");
    Serial.print(wp_TotalDistance,DEC); // 11
    Serial.print("|");
    Serial.print(planeBearing,DEC); // 12
    Serial.print("|");
    Serial.print(targetBearing,DEC); // 13
    Serial.print("|");
    Serial.print(bearingError,DEC); // 14
    Serial.print("|");
    Serial.print(actualTurnRate,DEC); // 15
    Serial.print("|");
    Serial.print(estTurnRate,DEC); // 16
    Serial.println("|");

    The values are sent unlabeled to save time and bandwidth. If you don't have a variable that matches, just send a 0.

    For example - the acutalTurnRate variable is for my debugging, sending 0 instead wouldn't affect anything.

    You should be able to easily replace the variable name with the Ardupilot names and get it to work.
    Jason
  • T3
    BTW what is the protocol?
  • T3
    Display is messed up in my 1280x1024 screen. P

    robably screen aspect ratio 5:4 plays a major role here.
  • Developer
    The plane angle is caused by me being at my kitchen table and sensors that are pointed at something warm. I'm using my hand to steer the plane by interfering with the XY IR sensors. I have a turn rate estimator that runs while the plane is waiting for GPS that is useful for this kind of simulation. I just have a faked out GPS routine for testing that doesn't correct the estimation and let's it fly on.
  • Thats a nice looking ground station
  • Developer
    I saw you are a Perl guy. I wrote a Perl socket server for the BS2 and Flash about 4 years ago. I still do a lot with it. I'm doing all of my waypoint parsing in Perl.
  • Very cool. Why is the angle of the plane down? (Lower left icon, if the name is incorrect...) Shouldn't that be reversed (so the head of the plane is up)? I really like the map display. I always wondered conceptually how auto pilot works, and that visual aid helped. Thanks. :)
  • Developer
    I forgot to mention. This code is using the trick of pulling the Pin 7 high and low to toggle the serial mux on the V2 Ardupilot Shield. The groundStation.pde file contains the parsing code.
This reply was deleted.