I am trying to spoof gps on the ardupilot over a wireless serial connection to the GPS port. Essentially, I want to tell it that it starts at coordinates (0,0), and then I will give it positions relative to the origin in my local coordination so that it can go to waypoints set through mission planner indoors. I have a mapping algorithm using a lidar that returns (x,y) positions relative to the starting point.
How would I go about converting (x,y) positions from a local coordinate frame to a protocol that the APM wants? Does it want NMEA messages, including velocity? What update rate is it looking for?
Any help is appreciated. Thank you.
Did you fully read the question? This question is not about getting real GPS working on the ardupilot. This is about how to go about spoofing GPS on the ardupilot so that indoor navigation can be performed. So far, I have s SLAM algorithm using a laser scanner to map and determine the quadrotor's position in a local coordinate frame. Now, I need to figure out how best to trick the APM into thinking that it has a GPS lock and update its position through the GPS serial port.
For better precision and you would need to emulate UBLOX and MTK19 protocol, but rather than creating such GPS stream, you could add a GPS_PROTOCOL to Arducopter code for whatever data you already have.
No need to take your indoor position, translate it to raw GPS data, then make APM use that, it sounds to me like needless complex solution with multiple conversions.
Why not just create some new NMEA sentences then update the Arducopter code to accept them. This way you can still use the GPS port and you could even still have a GPS connected (NMEA allows you to mix in multiple devices). This is done on planes/gliders all the time for other devices, such as pressure sensors and varios. By having both you could then have the APM move from indoor system to outdoor without even changing hardware.
The alternative here about spoof GPS means that you convert your local coordinates into GPS fake coordinates, so that APM can convert them into real coordinates - skip those steps and just feed it real coordinates.
Were you ever able to figure this out? I am about to embark on a similar thing.
Yep, I did. I used at the time what was a beta ardupilot firmware. I had to manually flash the ardupilot firmware after changing a #define to use NMEA instead of ublox. Then I sent "GPS" NMEA messages over a bluetooth to serial adapter that was connected to the APM GPS port. I hope that helps. It appears that the current firmware supports NMEA without any modifications, though. I could be wrong, though. If it isn't currently supported, you'll need to download a beta firmware.
Basically, I added a #define GPS_PROTOCOL GPS_PROTOCOL_NMEA.
Hopefully, this makes sense.
Well I'm having the same problem you did actually. I've got the coordinates of my system converted to GGA, RMC and VTG sentences. I'm trying to send them usb to serial so it's a little different from your approach. I've set GPS_Type to 5 (NMEA) in Mission Planner but it seems that nothing happens. I'll try to flash with that define to see what happens.
I am generating GPS strings in Python, then sending them over xbee to the the GPS port (tx, rx). Using PyNMEA2, I can make GPS strings-- but when I just Serial.write the strings, the Pixhawk is not seeing any GPS data (or at least does not register a lock or anything?
1. How did you send the messages over bluetooth
2. What baud rate is the GPS port set up with (I read 38400, but not convinced). I cannot find the setting anywhere in the arducopter code for the #define GPS_PROTOCOL.... its definitely not in my APM_Config file
Have you found a solution? I would like to do the same thing with the PIXHAWK.
How do you convert (x,y) cartesian coordinates in NMEA messages? and how do you send the message to the APM?
You can use a precise (+-2cm) Indoor "GPS": http://marvelmind.com/.
Here is a couple of demos: