A photo of successful flight as seen in Google Earth and X-plane:
Here is another ArduPilot simulation inspired by Jordi's simulation.My simulation requires minimum additional hardware, all you need is ArduPilot connected by FTDI cable to PC.Actual simulation runs in X-plane simulator. ArduPilot get simulated GPS data over serial, and it returns back proposed servo positions back over serial as part of telemetry info (servos can also move physically). ArduPilot also reports bunch of variables - lat/lot/alt, next waypoint, distance to it, etc.What you need to repeat the simulation:- Modified ArduPilot code from this blog post- X-plane 9 demo (buy full version if you wish, but demo works just perfect, it only ignores joystick input after 10 minutes, but we control it other way so it really doesn't limit us)- Google Earth- ArduSimulator ArduSim_20090211.zip (developed by me), which is simple application that does following:1) Connects to ArduPilot over serial for sending/receiving data2) Connects to X-plane on localhost (same PC)3) Reads data from X-plane (lat/lon/alt/course), sending these to ArduPilot as GPS sentences4) Simulating FMA copilot stabilization on ailerons/elevator5) Reads and displays telemetry and servo positions from ArduPilot6) Sends servo positions to X-plane to control throttle and rudder7) Records fly path and sends it to Google Earth to displayHere's how to repeat the simulation:- Start X-plane, go to Menu->Settings->Net Connections, select tab Inet 3 and enable "IP of data receiver", change IP address to 127.0.0.1 and port to 49001. It looks like this:
- Select Aircraft from folder Aircraft\Radio Control\GP_PT_60 (yes, we want to fly RC plane which has ail/elv/rud/thr controll)- Select airport Innsbruck- You can open this KML path: Innsbruck.kmz in Google Earth, which was my testing fly plan configured in ArduPilot; this will show you the waypoints- upload compiled ArduPilot code to the board and leave it running; LOCK LED should keep flashing- start ArduSim.exe (simulator tool); it will connect to serial port and X-plane; if it can't connect to serial, specify correct port and baudrate and press Start button- click [Google Earth] button in ArduSim to make connection with GE- hit B in X-plane to release brakes, and try keys A/W/C to choose various viewsNow simulation should be running if everything is connected successfully, and you should see plane in X-plane to fly and visualization path & icon in Google Earth to move. Don't control plane in X-plane! ArduPilot will take-off and fly on its own.Here's video how it all looks in action:And complete flight path visualization for Google Earth: Flight.kmzYou can see original waypoints in white, and real fly path in yellow. And also final circulation over start point when all waypoints were visited...Now about problems and future tasks:- I have strong impression that controlling altitude by throttle with use of copilot stabilization doesn't work properly, this simulation showed me that plane didn't want to drop altitude from high point to lower one... see results in above flight path in GE. I'm not sure how real plane behaves (didn't went out to real world with this yet), we'll see.- For this reason I plan to start playing with complete stabilization in ArduPilot, and controlling both elevator+throttle to get desired altitude.- You can play with dozen of various parameters to control behavior, most obvious are PID settings for throttle/rudder in ArduPilot, but also PID values in stabilization (which is here provided by simulator tool, in real world it is FMA Copilot which you can control by its sensitivity setting). Then you can change maximal servo rotation for ArduPilot to work with. All these values make the plane fly smoother, make more precise turns, etc etc. And the settings seem to depend on actual aircraft and its physical behavior. So there won't be single settings working for everyone.- It's somehow cumbersome to specify different altitude for various waypoints; while I converted waypoints from KML file out of Google Earth, I had to specify individual altitudes manually in waypoints.h file in ArduPilot code.After all, I'm pretty happy to see the plane flying in simulator and doing the task! Note that it's ArduPilot doing the navigation work. And in a real airplane, this simulation allows to reuse the ArduSim application as a base station, getting telemetry from plane over Xbee modem and displaying what it does as well as showing path in Google Earth.
Nice! Do I see correctly that plane missed 1st waypoint, and had to make circle to return to it? This is kind of situation that should be solved in better navigation intelligence.
problem solved!!!! It was so simple, Michal you did a wonderfull work on your code :D
On the scenario on my previous post you just first insert the ip of machine B (the ardupilot fix gps signal) then you just change the ip address of the X-Plane to machine A, i dont know why (i'm not skilled on C++) but it start to send data to x-plane and all work.
Here my first simulation in Bresso airport near Milan (Italy)
One simple solution for running this on two computers is to have Google Earth running on one, with X-Plane and ArduSim on the other, and the folder with the kml.kml be shared on the network. Then tell GE that you want to add a network link, choose that file, and set to 1 second constant update. This ofcourse won't help if your situation is like Roberto's.
I found the issue about work with x-plane on other PC, did u can insert a separate ip for inbound socket?
Thats' is my scenario:
machine A --> MAC with X-plane on connection I insert the ip of machine B
machine B --> windows XP with google earth, ArduSim, Ardupilot connection
If i insert on ArduSim x-plane ip box the ip of machine A i see on X-Plane inbound connection, but no GPS sentence to ArduSim
If i insert on ArduSim x-plane ip box the ip of machine B i dont see on X-Plane inbound connection, but i see the telemetry on ArduSim (Ardupilot fix gps)
I cant develop the solution by my self because i cant compile the source because i havent XP sdk.. :(
You mean telemetry.. so this is still work in progress, it's binary "protocol", first comes a code byte specifying telemetry info type. Then will come predetermined amount of bytes which are decoded as binary sequence of floats, ints or chars depending on telemetry type.
Take example of telemetry info TEL_GPS_POSITION, code 0xf0
then follows:
float latitude
float longitude
int altitude
int course
similar way are done other types - waypoint info, servo position, etc. You should check the code to see what is sent for each type. It's extensible, and no formal specification on the format is done. It just had to work fast when it was designed.
thanks for the reply.. now all work well i've done my first test.
I still have the problem if i use separate pc for x-plane.. it receive data from ArduSim but dont send GPS sentence to it..
Any suggestion??
Can I know the exact sentence that Ardupilot send to ArduSim?? I want to develop an open source version in Arduino Studio.. reverse engeneering is slow process...
Roberto: Save path button was not finished... you can add the code yourself ;)
Kyle: Try Google Earth button, then in GE in "Places" you should see periodically refreshing place "GPS test" having child "Plane". GE should auto-reload the path. You can have up to 4 servo control in ArduPilot.
the baud rate was the problem. For some reason I was thinking ArduPilot ran at 4800, but i found the line you pointed out:
SerialX.begin(19200);
//SerialX.begin(4800);
at line 204 on ArduPilot.cpp - so switching the baud rate in the ArduSim.exe and on my COM3 (my comptuer -> device manager) got it all up and running. Pretty slick to see! Now on to my next challanges... why is my Google Earth not interfacing with it? and How do you program more servos? I'm sure some digging around in the code and at the main ardu site will answer thos!
I'm trying to simulate a flight but i have some issue:
- save path doesnt work (i click but nothing appear)
- i have some trouble to setup X-Plane in a different PC than ArduSim, X-Plane receive the connection from AdrduSim but dont send data to it.. (I also changed the port to 49005)
It looks that you don't have communication over serial. Blinking blue led means that AP is waiting for GPS fix.
May be wrong baud rate.
Another debug hint:
StatLedOn(true);
will turn on STAT LED, so you know that code got there. This is not dependent on serial connection.
Comments
problem solved!!!! It was so simple, Michal you did a wonderfull work on your code :D
On the scenario on my previous post you just first insert the ip of machine B (the ardupilot fix gps signal) then you just change the ip address of the X-Plane to machine A, i dont know why (i'm not skilled on C++) but it start to send data to x-plane and all work.
Here my first simulation in Bresso airport near Milan (Italy)
Now i have to fine tuning with PID parameters..
One simple solution for running this on two computers is to have Google Earth running on one, with X-Plane and ArduSim on the other, and the folder with the kml.kml be shared on the network. Then tell GE that you want to add a network link, choose that file, and set to 1 second constant update. This ofcourse won't help if your situation is like Roberto's.
I found the issue about work with x-plane on other PC, did u can insert a separate ip for inbound socket?
Thats' is my scenario:
machine A --> MAC with X-plane on connection I insert the ip of machine B
machine B --> windows XP with google earth, ArduSim, Ardupilot connection
If i insert on ArduSim x-plane ip box the ip of machine A i see on X-Plane inbound connection, but no GPS sentence to ArduSim
If i insert on ArduSim x-plane ip box the ip of machine B i dont see on X-Plane inbound connection, but i see the telemetry on ArduSim (Ardupilot fix gps)
I cant develop the solution by my self because i cant compile the source because i havent XP sdk.. :(
Take example of telemetry info TEL_GPS_POSITION, code 0xf0
then follows:
float latitude
float longitude
int altitude
int course
similar way are done other types - waypoint info, servo position, etc. You should check the code to see what is sent for each type. It's extensible, and no formal specification on the format is done. It just had to work fast when it was designed.
thanks for the reply.. now all work well i've done my first test.
I still have the problem if i use separate pc for x-plane.. it receive data from ArduSim but dont send GPS sentence to it..
Any suggestion??
Can I know the exact sentence that Ardupilot send to ArduSim?? I want to develop an open source version in Arduino Studio.. reverse engeneering is slow process...
thanks for the wonderful work!!!!
r
Kyle: Try Google Earth button, then in GE in "Places" you should see periodically refreshing place "GPS test" having child "Plane". GE should auto-reload the path. You can have up to 4 servo control in ArduPilot.
the baud rate was the problem. For some reason I was thinking ArduPilot ran at 4800, but i found the line you pointed out:
SerialX.begin(19200);
//SerialX.begin(4800);
at line 204 on ArduPilot.cpp - so switching the baud rate in the ArduSim.exe and on my COM3 (my comptuer -> device manager) got it all up and running. Pretty slick to see! Now on to my next challanges... why is my Google Earth not interfacing with it? and How do you program more servos? I'm sure some digging around in the code and at the main ardu site will answer thos!
Thanks again!
I'm trying to simulate a flight but i have some issue:
- save path doesnt work (i click but nothing appear)
- i have some trouble to setup X-Plane in a different PC than ArduSim, X-Plane receive the connection from AdrduSim but dont send data to it.. (I also changed the port to 49005)
best regards!
May be wrong baud rate.
Another debug hint:
StatLedOn(true);
will turn on STAT LED, so you know that code got there. This is not dependent on serial connection.
-
1
-
2
-
3
-
4
-
5
of 8 Next