Just documenting steps to get this set up, so as I don't forget.  Sorry but couldn't find a concise summary to fit my specific desire: do it on linux.      I'll clear this up in the wiki if I could have access to it.

 

Flightgear works, have that running.  Available in synaptic in ubuntu, easiest way to get it.

 

Now, need interface program, receive APM serial data outputs (servo commands), and send Flightgear simulation states (fake IMU signals),  both over ftdi serial cable between pc and APM.    It sounds like that Micheal Oborne's neato ArduPilotMegaPlanner program will run on linux, if I have mono. (reading the wiki page http://code.google.com/p/ardupilot-mega/wiki/FlightGear,  and blog http://diydrones.com/profiles/blog/show?id=705844%3ABlogPost%3A1862...)  latest APMPlanner is posted here:   http://code.google.com/p/ardupilot-mega/downloads/detail?name=ArduP...

 

But I've never heard of mono except in high school.   Oh,  this mono,  http://en.wikipedia.org/wiki/Mono_%28software%29        which runs .net programs on linux.     

 

So, ubuntu 10.10 already has mono.   ok, no highschool kissing jokes now.

 

download the APMP .zip file, unpack it, and open a cmd window in that directory, and type

$ mono ArdupilotMegaPlanner.exe

error message to the effect 'assembly mscorlib.dll was not found or could not be loaded.

need something called 'Nant' which includes some required files.  install that:   sudo apt-get install nant

 

And now it works!  APMPlanner launches.   I'll see now if can get it working together.  Thanks Michael for making it cross platform/OS compatible!

 

 

so, short answer, at least for Ubuntu 10.10: 

-unzip it, put it where you want  

-use mono to launch it,   $ mono ArdupilotMegaPlanner.exe

-you might need to install nant,    $ sudo apt-get install nant

Views: 2861

Reply to This

Replies to This Discussion

Awesome!  I was having a horrible time trying to run APMPlanner in a VM on Kubuntu 10.10.  Thank you!

Well, so I have APMPlanner launched and it appears to run (as the common binary, not recompiled on linux).  Poking around in it, it has locked up / crashed a couple times, not sure why.   So, I still have to get it set up and working with the APM and Flightgear all together.  I'll post once I have that.  But it appears so far it should or may work.  I haven't used APMPlanner for it's other functionality, I'm trying it first just for connecting APM & Flightgear.

 

Also clarify my original post:  I have Flightgear 1.9 installed.  I forget if I got it from synaptic, or installed sort of manually in order to get the older version, instead of newer version which is alleged to have some issue for this use.

 

Some people must be doing this on Linux?  Right?  How have you done it?   Is see there is another small connection program source code in the SVN, maybe that is used to connect APM serial port with Flightgear?  Or are you using APMPlanner.

 

I can speak to my experience, but I don't have the FlightGear setup working completely yet.  I am using Flightgear 1.9.1 (from the repositories - sudo apt-get install flightgear) and Arduino 0022 (need to download this from arduino.cc; the version in the rpositories, 0019, is too old to work).  Also note that I could not get any of this to work with the code from SVN so I am using the APM 1.02 release (http://code.google.com/p/ardupilot-mega/downloads/detail?name=ArduP...).  Finally I am using the APMPlanner from your link above (great program, Michael - thanks!)

 

Here's what I did (based on instructions at http://code.google.com/p/ardupilot-mega/wiki/FlightGear):

FlightGear setup:

1) Create a script to run FlightGear.  Here's mine (from "fgfs" on is all one line).

#!/bin/bash
fgfs   "--generic=socket,out,50,127.0.0.1,49005,udp,ardupilot"  "--generic=socket,in,50,127.0.0.1,49000,tcp,ardupilot"  "--in-air"  "--altitude=10"  "--vc=90"  "--heading=300"  "--timeofday=noon"

Save this to a file, e.g. FlightGearHIL.sh.  Set it as executable (chmod +x FlightGearHIL.sh).  Note that the batch file given for Windows includes an --fg-root option; until I took that option out FlightGear would not recognize the ardupilot protocol.

2) Install the ardupilot protocol:

cd /usr/share/games/FlightGear/Protocol

sudo wget http://ardupilot.googlecode.com/svn/branches/ArduPilot_2_7/X-Plane/...

 

APM setup (based on http://code.google.com/p/ardupilot-mega/wiki/ProgrammingArduino):

1) Create the APM_Config.h as follows:

#define ENABLE_HIL ENABLED
#define GCS_PROTOCOL GCS_PROTOCOL_XPLANE
#define GCS_PORT 0
#define GPS_PROTOCOL GPS_PROTOCOL_IMU
#define AIRSPEED_CRUISE 15 // or whatever works best for your Xplane selection
#define AIRSPEED_SENSOR ENABLED

2) Upload to APM

3) Set slide switch to FLY (e.g. to the right)

 

APMPlanner Setup:

1) Select APM source location (e.g. defines.h)

2) Select COM port (mine was /dev/ttyUSB0) and baud rate (115200)

 

In order to use this, what I do is:

1) Start FlightGear (e.g. ./FlightGearHIL.sh)

2) Wait a minute, then start APMPlanner

3) From APMPlanner choose ArdupilotSim

4) Select the FlightGear radio button and click Connect/Disconnect

 

At this point APMPlanner will connect to Flightgear on port 49000 and populate data such as GPS.  Invariably what happens, though, is that after a second or two the window in APMPlanner says "No APM data" and nothing else happens in the window.  APMPlanner is still responsive, but all I can do is disconnect and start over.

I'm not sure if this will apply to anyone else b/c I don't have the oilpan, just the APM board, and I connected my own slider switch manually.  I wonder if APM is hanging up because it cant' find the data logger.

 

I have seen APMPlanner crash a couple of times, usually this happens when I stop flightgear before disconnecting APMPlanner, when I plug/unplug the APM board or try to upload from Arduino.  In general I find that I do not have to restart APMPlanner between attempts as long as I am good about disconnecting it.

 

A couple of questions:

1) Anyone know how to start FlightGear with volume level of 0?

2) Is the source for APMPlanner available?  I am a C# developer (even though I run linux at home) and being able to step through in the debugger would help me get a handle on what's going wrong for me.

 

Thanks Dale for your directions, Michael for writing the APMPlanner, and all the folks who worked on the APM board and software!

hi guys,

yes the source is on the ardupilot mega svn. so have a play if you wish. If you do get it working let me know and ill modify the main exe so it will run on linux.

Michael

Steven,  my directions?  YOUR directions!  Thank You!!   I don't have an oil pan either.  I want to first just control FG with transmitter / receiver through APM.

http://code.google.com/p/ardupilot-mega/source/browse/#svn%2FTools%...  There's where Michael's source is, if it helps to locate it.

 

Thanks!  I've grabbed the source but haven't looked at it yet.

 

I solved part of the "No APM data" problem; it's related to me not having the oilpan.  In ArdupilotMega.pde, the slow loop case 1 calls read_airpressure() and of course I don't have a pressure sensor.  So I commented out that call and it seems to work much better.  Following the same procedure as above, APM no longer hangs, I can see the servo outputs and I get *some* control of the plane in FG.  I still see the "No APM data" and after 10 seconds or so APMPlanner crashes.  I will look into it and see if I can find out what's happening.

 

Dale, if you don't have an oilpan you'll need to mimic the slider switch in order to get the APM into FLY mode (you may have already done this).  The pins are marked on the back of the APM; connect PG1 to +5V for FLY and leave it empty or connect to GND for the CLI mode.  PG1 is the corner pin in the L-shaped row of headers.

 

Steven

 

 

It probly has something to do with cross thread calls.. or similar. Mono doesnt handle it as well as windows. It is using a delegate, but something must be failing.

Hi all,

A few months have gone by since the last post, so I'd like to ask if anyone has succeeded in getting later versions of APM-Planner and FlightGear working together ?

Thanks,

Nick

Hi Nick,

Didn't know that there is a way to get the Planner running under linux. When I embarked on a similar attempt of getting HIL simulation on either linux or Mac I settled on the combo APM+flightgear+QGroundcontrol+mavlink-proxy (written by one of the mavlink developers) on my Mac (the reason being the Ubuntu flightgear package at the time was too old apparently and I was too lazy to compile it from sources). If you are interested I can still dig out the details. No idea about the Planner though.

Good luck,

Andre

Hi Andre,

That would be very helpful .

Thanks

Nick

Hi,

I didn't update my local copy of the git repo for a while and seems that (as usual:) lot's of stuff has changed and my automatic build process got broken. Also it seems that the ArduPlane code at least changed to mavlink1.0, not sure what this means for the mavlink based HIL simulation. So I'm still sorting out how to get things working again :-) Sorry, hope to get back to you soon.

BR,

Andre

Nick,

Currently there is a blog post of mine waiting for approval. Tried to summarize the steps in there. Hope that helps.

Cheers,

Andre

Reply to Discussion

RSS

Groups

Season Two of the Trust Time Trial (T3) Contest 
A list of all T3 contests is here. The current round, the Vertical Horizontal one, is here

© 2018   Created by Chris Anderson.   Powered by

Badges  |  Report an Issue  |  Terms of Service