NOTE: I released the "magic smoke" today (8/7/2009) on my ArduPilot board, so development of the emulator will be stopping for the next two weeks. I need to order parts and I also need to appease the wife (too many late nights recently playing with my new toy).NOTE: This project is a part of Remzibi's OSD project, please download and install Setup.exe to make sure you have all the necessary DLL's and controls!!!OverviewThis project is used to provide emulated GPS data for the ArduPilot hardware using Remzibi's USB to serial cable. The emulated output will provide feedback for the Ardu's movement commands. It does require a recompile and upload of the firmware to the Ardu so you will need the FTDI cable. The output is then displayed on Google Maps and updated every 5 seconds. Home position and waypoints are shown as well.For info on Remzibi's OSD: www.rcgroups.com/forums/showthread.php?t=921467To purchase the ArduPilot: www.sparkfun.com/commerce/product_info.php?products_id=8785Programming cable for ArduPilot (GET THIS ONE NOT SPARKFUN'S!!): http://store.diydrones.com/ProductDetails.asp?ProductCode=TTL%2D232R%2D3V3ArduPilot Manual: docs.google.com/View?id=ddjmqgw3_43gm6gvggfStraight Headers: www.sparkfun.com/commerce/product_info.php?products_id=116Bind Plug: store.diydrones.com/ProductDetails.asp?ProductCode=AC%2D0002%2D01Getting StartedFirst, you'll need to solder on the headers as shown here: docs.google.com/View?id=ddjmqgw3_43gm6gvggf#2_Preparing_the_hardware_87968. The Emulator will only make use of a small number of these connections, but you'll need most of them when it comes time to fly. You'll also need to solder on the MUX jumper shown in the second photo. For this project, I am not making use of the ArduShield.Next, download the Arduino development environment frm here: arduino.cc/en/Main/Software and unzip it into a folder on your PC (ie C:\Program Files\Remzibi OSD).Now download the GPS Emulator from here: www.happykillmore.com/software/RemzibiOSD/Waypoints/Waypoints.zipThis zip file contains the ArduPilot source v2.2 (modified for use with the GPS emulator) and the GPS Emulator software. Unzip these files into the same folder as the Arduino development (ie C:\Program Files\Remzibi OSD). In the ArduSource folder, you'll find a file called easystar.h. This file needs to be cut and pasted into a new folder in \arduino-0016\hardware\libraries named ArduPilot so the new "full" path will be C:\Program Files\Remzibi OSD\arduino-0016\hardware\libraries\ArduPilot\easystar.h.Next, plug in your FTDI cable and determine the com port. Click Start, Run and enter devmgmt.msc and hit OK. Expand the branch called Ports (COM & LPT). You should see it in the list.Open the folder C:\Program Files\Remzibi OSD\arduino-0016 and run arduino.exe. Click File, Sketchbook, Open and browse to C:\Program Files\Remzibi OSD\ArduSource\ArduPilot_EasyStar_V22 and open any file in that directory. Next click Sketch, Verify/Compile. If you don't get any errors at the bottom, you're ready to upload the firmware to the ArduPilot.Uploading the firmwareNow that everything is compiled, click Tools, Serial Port and select the serial port you identified above. You need to plug the FTDI cable in to the ArduPilot and provide 5V power from a BEC or your radio. You can plug the power in to any of the servo input or outputs.Next click the icon labeled "Upload to I/O Board" in the Ardino software. Keep your fingers crossed. It will take about 30 seconds. A good indicator is to see the amber colored light (status light) after 10 seconds will flash for a second and then go off if it's working. See here for details on the lights on the Ardu docs.google.com/View?id=ddjmqgw3_43gm6gvggf#Appendix_1_Correct_LED_behavioThis is a good time to take a break and calm the nerves. Maybe take a quick walk outside to smell the fresh air.... ah.... what a nice day....Setting up Waypoints (temporary)Download the software found here: ardupilot.googlecode.com/files/ArduPilotConfigTool_Fix1.zip.The software is difficult to use in my opinion because the map on the right is utterly useless. You can't click on the locations or even zoom in on any area. All you can do is Click Add Waypoint and type in the lat and long values. It might be helpful to use Google Earth to find these values. You can also try using this: www.happykillmore.com/software/RemzibiOSD/waypoint.html and zoom in to your location. Then you can click on multiple spots and view the tool tips (leave your mouse over the point). It's tedious, I know. Once you get them entered into the ArduPilotConfigTool click Actions, Select Port and select your FTDI cable's COM port. Choose your board style under Actions (probably AT328 if your board is red). Click Actions, Write. Hopefully, all went well. Please note that you did not set your home location during this process. That is done later.Please write down your waypoints. You'll need them later for another temporary work around.More instructions are available here: docs.google.com/View?id=ddjmqgw3_43gm6gvggf#Using_the_Setup_Utility_137125Wiring the ArduPilot for use with the GPS EmulatorTo wire up the USB to serial to the ArduPilot, you're going to need to connect the ground wire to the top left corner (marked GND) or to any of the grounds (marked "-") on the servo input/outputs. The Blue wire goes to TX0 and the white to RX1.Next you'll need to provide 5V power from either your RX/ESC or from a BEC (as shown below). If you have the "old" 4-wire OTI USB to Serial from Remzibi, you can power the board using the red and black in the top left corner.You'll also need jumper the D6 pin to the pin to the left of it (GND). This is the "safety"/set home position jumper. BE CAREFUL not to jumper the GND to the unlabeled pin to it's left. I released the magic smoke from my ArduPilot that way!!!Finally, you need to connect a servo tester or your RX on a channel with a 3-position switch to the servo input labelled CTRL. The down position is normal flight mode (no auto-pilot). Middle position is Waypoint mode (will fliy on auto-pilot from home to all of your waypoints and then back home and will repeat). The up position is RTL (return to launch) / return to home. I'm not sure what it does when it gets home because I fried my board before I could test it.Editing the Default.html file (temporary)In C:\Program Files\Remzibi OSD there is a file called Default.html. This is the "template" for the Google Maps output. Please open this file in notepad and edit the lines that look like:var oMarkerLatLong = new GLatLng(41.251576,-81.814974);var oMarker = new GMarker(oMarkerLatLong, {icon:icon});map.addOverlay(oMarker);Please do not edit the first one that has %HOME% in it. This will be replaced by the GPS emulator software. You can have as many waypoints as you want. The Default file has 5 plus the home position. All you have to do is change the values after new GLatLng( to the values you wrote down in the Setting Up Waypoints section above.In the future this will all be automated and selecting your home location and waypoints will be MUCH easier.Using GPS EmulatorNow you can run the GPS Emulator program (C:\Program Files\Remzibi OSD\GPSEmulator.exe). You need to select the right COM port for your USB to serial cable (Start, Run, devmgmt.msc) and 9600 baud and 5Hz. I find it helpful to click NMEA, Show NMEA Output so I can watch what's being sent and what's being received. You'll need to enter your home GPS location (could be the same as waypoint #1 if you want). I'm planning on changing the way the data is entered in the GPS emulator, but for now, you'll need to take the decimal place of your lat and long and multiply it by 60 and enter that. ie 41.251576 = 41 .251576 * 60 = 41 15.09456. I know, I know, that's annoying too, but don't worry, it's a work in progress.Connect the 5V power to the ArduPilot with the D6 + GND jumper attached. With the GPS emulator running (you may have to hit Connect and Start if this is your first time running it) you should see the blue light on the ArduPilot blink very fast and then turn off. Now you can remove the D6 + GND jumper. Now the blue light should come on solid indicating GPS lock. At this point, flip your control servo input to the middle position (waypoint mode) and check the checkbox labelled "Read Data from ArduPilot"....FINALLY! It's flying on it's own!!! You should see the waypoints on the map and a purple line being drawn. The update speed is once every 5 seconds because too much processor time was being taken up by drawing the map and it was making the program crash.In your C:\Program Files\Remzibi OSD folder is an output file called Maps.html. It contains the source for what you were looking at in the output window. A sample can be found here www.happykillmore.com/software/RemzibiOSD/maps.htmlEDIT: I'm still making progress without having a working Ardu. This screenshot shows a working drag & drop marker map for setting waypoints and home location. The search function works too!
thank you for your reply I have to execute what you say but it does not work, I have attached a screenshot, I created a directory "Ardupilot" under arduino-0018 \ hardware \ libraries \ and I copied "EasyStar" in this new directory, I run the compilation and I have always an error message ...
55: error: easystar.h: No such file or directory In function 'void navigation()':
In function 'void stabilization()':
In function 'int calc_roll(float, float)':
In function 'int altitude_error(int, int)':
In function 'byte PID_throttle(int, int, int)':
In function 'int PID_roll(int, byte, int)':
In function 'int PID_pitch(int, int)':
At global scope:
Bad error line: -43
When compiling the file "ArduPilot23" with arduino-0018 before I set in my arduipilot an error message "as follows:
55: error: easystar.h: No such file or directory In function 'void controller ()':
In function 'void stabilization ()':
In function 'int calc_roll (float, float)':
In function 'int altitude_error (int, int)':
In function 'byte PID_throttle (int, int, int)':
In function 'int PID_roll (int, byte, int)':
In function 'int PID_pitch (int, int)':
At global scope:
Bad error line: -43
Nick, my form size is obviously set too small, I'll have to fixed that today. What you can't see is the red text at the bottom which is red because you're sending too much data for your GPS baud rate!!!! You need to cut down on the number of commands or decrease the Hz until that text turns black.
The ArduPilot (and Remzibi's OSD) only use GPRMC and GPGGA, please turn everything else off because it's a waste of bandwidth. You should be able to run at 5Hz, 9600 with only GPRMC and GPGGA turned on.
Yes, I'm working on that right now. My plan is to add to Jordi's Config Tool to make setting up the waypoints easier and then convert the GPS Emulator over to .NET. I'm already working on an option to choose DDMM.SSSS or DD.DDDDDD position format. I'll handle the +/- as well. I need to capture the output at bootup of the Ardu because it will tell me the waypoint's locations (no more editing the HTML file). I can work on most of this stuff without having the Ardupilot.
Nick, I have no idea how your results got that crazy!?!? I've seen issues where the speed is too high and it overshoots the waypoint and then goes in circles trying to hit it. I guess toggling between 20MPH and 200MPH isn't all the reealistic.
I also have found that if you run at 5Hz and use the code in ArduPilot_EasyStar_V22 that says #define NMEA_OUTPUT_5HZ "$PMTK314,0,5,0,5,0,0,0,0,0,0,0,0,0,0,0,0,0*28\r\n" you only get updates once per second and the distance calculation is far too slow. I'm not sure why you'd want to use your GPS on 5Hz and only get an update once per second (which is what that PMTK314 command specifies). Unless Jordi has a reason not to, I would suggest always using $PMTK314,0,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0*28 for all Hz settings.
How did you go Earl?
Using the wrong version of the GPS emulator tricked me the first time :P
I also had to run the software with admin privileges to allow it to make the maps.html file.
Happy, could you possibly change the emulator to use decimal coordinates (and possibly signed integers instead of N/S, E/W)?
Thanks,
Nick
Comments
Thank you very much
JCD
thank you for your reply I have to execute what you say but it does not work, I have attached a screenshot, I created a directory "Ardupilot" under arduino-0018 \ hardware \ libraries \ and I copied "EasyStar" in this new directory, I run the compilation and I have always an error message ...
55: error: easystar.h: No such file or directory In function 'void navigation()':
In function 'void stabilization()':
In function 'int calc_roll(float, float)':
In function 'int altitude_error(int, int)':
In function 'byte PID_throttle(int, int, int)':
In function 'int PID_roll(int, byte, int)':
In function 'int PID_pitch(int, int)':
At global scope:
Bad error line: -43
Best Regards
ie: arduino-0018\hardware\libraries\ArduPilot
When compiling the file "ArduPilot23" with arduino-0018 before I set in my arduipilot an error message "as follows:
55: error: easystar.h: No such file or directory In function 'void controller ()':
In function 'void stabilization ()':
In function 'int calc_roll (float, float)':
In function 'int altitude_error (int, int)':
In function 'byte PID_throttle (int, int, int)':
In function 'int PID_roll (int, byte, int)':
In function 'int PID_pitch (int, int)':
At global scope:
Bad error line: -43
can you help me
Best regards
JCD
The ArduPilot (and Remzibi's OSD) only use GPRMC and GPGGA, please turn everything else off because it's a waste of bandwidth. You should be able to run at 5Hz, 9600 with only GPRMC and GPGGA turned on.
Nick, I have no idea how your results got that crazy!?!? I've seen issues where the speed is too high and it overshoots the waypoint and then goes in circles trying to hit it. I guess toggling between 20MPH and 200MPH isn't all the reealistic.
I also have found that if you run at 5Hz and use the code in ArduPilot_EasyStar_V22 that says #define NMEA_OUTPUT_5HZ "$PMTK314,0,5,0,5,0,0,0,0,0,0,0,0,0,0,0,0,0*28\r\n" you only get updates once per second and the distance calculation is far too slow. I'm not sure why you'd want to use your GPS on 5Hz and only get an update once per second (which is what that PMTK314 command specifies). Unless Jordi has a reason not to, I would suggest always using $PMTK314,0,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0*28 for all Hz settings.
Using the wrong version of the GPS emulator tricked me the first time :P
I also had to run the software with admin privileges to allow it to make the maps.html file.
Happy, could you possibly change the emulator to use decimal coordinates (and possibly signed integers instead of N/S, E/W)?
Thanks,
Nick