I got it working on my Dell Latitude D830 laptop with Windows 7 Pro 64bit. I'm using X-Plain 9.21rc2, the AruduPilotMega Planner 0.5 by Michael Oborne, ArguPilot Mega with IMU shield and a Spektrum 8 receiver / transmitter.I was not sure how all this fit together but I think I understand it now. Here is how I understand it now.
- The Radio communicates with your receiver.
- Your receiver talks PPM to the APM inputs.
- The APM, with a few special changes in APM_config.h, is told to send X-Plane data
USB port on the IMU shield. - Using the FTDI serial driver the ArduPilotMega Planner connects to the APM and opens
the network port 49005 on localhost IP (127.0.0.1) for X-Plane to talk to. - X-Plane, with a few settings, sees the data on the port and acts accordingly.
My transmitter is programmed for a simple four servo plain no mixing.
The switches on my IMU, from left to right are UP, UP, UP Down, when you are facing the switch.
This turns off the IMU mixing.
In the ArduPilotMega Planner, I set my comm port and check the Reverse box for Roll, Pitch and
Rudder.
For a time I could had trouble getting all the controls to register. After checking and rechecking my
connections I got it to work find.
Replies
can anybody tell me is there a way to interfere the PPM singnal from RC receiver to arducopter board ? i was trying to read the value using pulsein() and write using servo mapping 1000 -2000 0 -179 didn't work :(
please help me thanks in advance
I am glad I found this discussion. I am tying to get this going on a PowerBook (runs X-Plane 9) and a HP G-60 laptop running ArduPilot Sim from Planner. I have FlightGear 1.9 on both to help get this going. I used Jean L Naulan's AFG_Control on PC and FlightGear with ArduPilot (168) over a year ago but with good success.
I don't get any data in GPS with FG or X-Plane. I could get no manual control.
I get !! loc err a lot.
I will try slowing down X-Plane UDP to 10/sec.
I use a APM 1.0 beta version with NAV-DOP, GPS message data turned on. I added this for HK_GCS.
With a little work I'm getting stable flight from an X-Plane simulator. Getting the airspeed throttle stable was the hard part. I'm sure this can be made better. The "default" setting did fly but resulted in 0 to 100% surges in the throttle.
I ran around and around on all the PID numbers until I found the Throttle Gain on the Sim interface resulted a more stable flight.
Is there a good description of what the Sim Gains do and how they should be set?
There are my PID settings.
Here are my gain settings. You'll see how the throttle is still surging but it is better controlled.
I'M FLYING!
I found my problem. My PID settings where all zero (0). After thinking through it I concluded you can't control the change if you don't have a value to change it by.
I changed my PID through the APM Planner (Action/PID Config) to the values I found here. http://code.google.com/p/ardupilot-mega/wiki/MPPID.
Now I need to work out the perfect PID Values for the X-Plane RC. Anyone know? Really the only issue is the throttle sarges.
Ok, i just tested everything on a Intel Celeron 1.7 gig (single core), and managed to make it all run. The main things i did was
run xplanes full screen at 1024x768, and lower every display settings, and in weather change the visibility to 5 nm.
This got it running at about 30-50 fps while sitting still.
in the data in out screen i change the UDP packet rate down to 10 hz. i usualy run 50. Basicly whatever you change this number it relates to how much cpu Ardupilot sim will use. As packets are sent to the APM at the same rate received from xplanes.
Normaly i test on a 3.2gz I7, so multiple cores and lots of cpu and graphics power.
if you have a look at http://www.x-plane.com/pg_Sys_reqs.html the laptop i used is below spec apart from memory, it had 2gb
I've made more progress but I still can't fly a mission.
I was having big issues with X-Plane getting a high frame rate. I recommend you display Frame Rate on the screen so you can keep track of this. (See my settings pic.) The screen rate needs to be higher then the UPD rate feeding X-Plane for good results. I fixed this issue by running X-Plane on a different computer then the Flight Planner / ArdupilotSim. To make this work, I had to program the ArdupilotSim program to connect to X-Plane at a different IP then 127.0.0.1. I added two new text fields for Simulater IP and Port.
This IP and port send the control data to X-Plane (192.168.2.188). I set the IP address and port in X-Plane to send it's data back to the ArdupilotSim program (192.168.2.181 port 49005).
With my connection to X-Plane working. I added these lines to APM_Config.h, compiled and uploaded the code to my APM.
Using APM PLanner 0.4.12 by Michael Obone, I added a few way points and started flying. Here are my waypoints.
#define WP_RADIUS 30 // What is the minimum distance to reach a waypoint?
#define LOITER_RADIUS 45 // How close to Loiter?
#define HOLD_CURRENT_ALT 0 // 1 = hold the current altitude, 0 = use the defined altitude to for RTL
#define ALT_TO_HOLD 600
float mission[][5] = {
{CMD_WAYPOINT,0,600,47.2606358,11.3479005},
{CMD_WAYPOINT,0,600,47.2589175,11.3322793},
{CMD_WAYPOINT,0,600,47.2607378,11.3317323},
{CMD_WAYPOINT,0,600,47.263592,11.3602924},
{CMD_LOITER,0,600,47.2598786,11.3485122},
};
I found my Mode switch has three modes, Manual, FBW-B and Auto. In manual I can fly all day. In FBW-B mode the plane doesn't fly to the next waypoint and I can only control the rutter. In Auto mode I can control everything but the throttle.What am I missing?
Here is my X-Plan settings.
The APM code I'm using is the code is the latest "Release".
After creating cables for all the serial ports and connecting things like the GPS emulator to the APM it came to me; What if I used a second APM to encode the flight APM's PPM output and send serial GPS data from the simulator to the GPS port. This would fix a couple of issues that bother me. 1) You are not flying the "real" code when you run a HIL now and 2) it would embodiment the testing code.
The code should be simple enough. The APM code is already reading PPM and translating it into joystick code for the simulator. Reading the NEMA code and formating it as GPS code for the APM should be simple too.
I have only one issue. I've looked for days and even studied the PERL code that talks to the simulators. I'm still confused about how best to that interface. Because there is no network, serial would be the best way out of the hardware so a utility to read that and send to the simulator would be needed.
Does anyone know of "GOOD" example of code to interface with either X-Plane or FlightGear?
I'm finding FlightGear is easier to work with the X-Plain. To bad there is not an API interface to RealFlight.
The biggest issue seems to be that APM overruns the input of FG and causes it to be very sluggish. I have found turning off as much of the display features as I can helps increase the frame rate and gets working just fast enough if I can get it over 40fps.
Is there a way to slow down the updates coming from APM?
Also FG uses a IP interface. Is there a way to change the IP used by the Simulator? I could then run FG on one system and APM and the simulator on another.
Jason