GPS Emulator for ArduPilot with Google Maps

Maps.gifNOTE: 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.IMG_4943_640X480.jpgNext 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.IMG_4940_640X480.jpgEditing 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.htmlSample.gifEDIT: 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!GPS%20Emulator%20Set%20Home.gif
E-mail me when people leave their comments –

You need to be a member of diydrones to add comments!

Join diydrones

Comments

  • Got It. Fergot to change the html file.
    Earl
  • Ahh... I had the wronf gps sim program.
    now have read data from ardupilot
    it brings up google maps but no map
  • I dont have a read data from ardupilot in the gps emulator. mine says lock to top
  • Nick, I can't seem to get it working. I can tun the gps sim and going into ardupilot get a lock. the ap then xmits via xbee to my pc. I can run street atlas and see the data and gps fine.
    What do you use to see the data in ardupilot ? is it the ground station ?
    I set the GS to the proper comm port and baud rate (same as I used in street atlas) but dont see any data like lat long on display. I do google map from GS and still no moving cursor.
    How did you do it ?
    Earl
  • Hey Happy.
    Thanks for sharing your work. After some messing around I got it working:
    Hosted by imgur.com
    http://imgur.com/eRpCz.png
    I think I need to change the hit radius or some gains :P
  • That's me! I still have a bunch of things I'd like to add to this project. I had a few people contacting me on RCG that wanted a copy of what I had so far. So I posted it in my Blog there. Chris Anderson saw it and asked me to post it here as well. It's by no means done.
  • he sure is
  • Developer
    Are you the real HappyKill more? The one who wrote the software for the remzibi OSD?
  • Thanks, I fixed the link
  • @HappyKillmore
    this link is not working : Waypoint.html
This reply was deleted.