
Here's a auto pilot simulator for NXT AutoPilot based on Michal B's ArduSim.
All you need is Lego NXT, RobotC and bluetooth-abled computer to run this simulator. You don't need any of the sensors NXT AutoPilot requires to be able to fly. Although you can add servo controller if you like. As before this simulator is based on X-Plane simulator.
Here's how it basically works:
-LegoSim.exe communicates between X-Plane (thorugh UDP) and NXT (through bluetooth).
-NXT receives GGA sentence (1hz) and the planes attitude (10hz) from LegoSim and sends back servo positions and the telemetry it received as a double check.
-LegoSim saves the co-ordinates it received to a .kml file which you can then open in google earth.
-LegoSim sends the servo positions to X-Plane.
Which closes the circle, so to speak...
You should note when using this simulator that the real AutoPilot updates it's attitude and servo positions at almost 300 hz so you can't use the same PID values for your stabilization when flying for real.
To replicate this simulation you need:
- X-Plane (set it up as described in
THIS blog post BUT USE 49003 as the port you define in the settings!!)
-Now pair your NXT with your computers bluetooth and memorize the COM port it uses to connect.
-Download
LegoSim_v.0.0.zip
-You can run the LegoSim already and set the IP to 127.0.0.1 and the port to 49003. Set the COM port to the one that NXT uses with your computer and the baud rate to maximum.
-Next you need to download and compile with RobotC (ver. 1.45 or above) the AutoPilot for your NXT:
NXT AutoPilot Simulator v.0.0.zip
- Now in X-Plane set your loaction to Innsbruck and your aircraft to Cessna.
- Finally: Press start in LegoSim and then start the AutoPilot program in NXT (you may need to start the AutoPilot several times before it runs OK due to some bugs in my code). Now just release your breaks in X-Plane by pressing b and the auto pilot will take off. (After you have started the AutoPilot you can also hit the "Google Earth"-button in LegoSim..
Here are some screenshots of the simulation:
Waiting for NXT AutoPilot to start:

Take off...

In flight:


And finally here's a snap shot of two different fly paths one in perfect conditions and the other in heavy wind/turbulence:

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