Fake gps with ultrasonic beacons

Hi guys!

I’m trying to build an indoor localization system for quadrotor. I’ll start with definition of my system:
Indoor localization system: marvelmind beacons marvelmind.com/
Quadrotor: dji f450 frame with raspberry pi + pixhawk onboard. From raspberry pi fake gps signal is made and transmitted to the gps port on pixhawk.

What do i want to get?
I want to use pixhawk gps autopilot to control quadrotor indoor. I want to get the information about 2d position from fake gps. Altitude information from gps should be ignored, beacuse altitude i want to get from barometer/sonar.

What did i get at this moment?
Fake gps is well passed from rpi to pixhawk. But the apm fimrware corrects this data, so drones trajectory signicantly differs from fake gps data trajectory. If I stop the dron movement, than after 10 seconds drone position stabilizes and converges to fake gps data.

Altitude information from fake gps is incorrect.

Currently I control the flight in guided mode (in auto mode it won’t start mission, just disarms in 10 secs).
It well takeoffs, but cannot hold position. It listens to command fly to some point, but EKF position changes not in a way Fake GPS changes. As a result in cannot hold position(it constantly tries to move forward in the same direction all time), but can move in a right position after fly to some point command.


  1. How can I make bigger prioriry for fake gps data? So the EKF position will change in a way gps chages.
    I tried to solve this by setting next parameters:
    EKF_GPS_TYPE = 1 (use GPS 2d velocity and 2d position)

EKF_POS_DELAY = 95 (fake gps is sent at 11 hz)
EKF_POSNE_NOISE = 0.1 (min allowed value)
EKF_VEL_delay = 95 (fake gps is sent at 11 hz)
EKF_VELD_NOISE = 0.05 (min allowed value)

  1. Im auto mode it ignores mission, just disarms in 10 sec. WIth real gps everything works well.What possible things lead to this?

P.S. Full parameter list: dropbox.com/s/n225ntsphngo3 … param?dl=0

Best regards,

This is a VERY interesting question and I’d like to see it asnwered!

Hi xFirefly,

I want to do the same thing as you, but for a ground robot. Could you tell me how you generate the GPS datas from x, y coordinates given by the indoor localization system?

Best Regards


Hi Anbriel,
sure here is my function which converts local xy coords to longitude and latitude.

lat0 and lon0 - coords of the origin of local system in terms of long and lat.
Rot is parameter which definces angle between our local coord system and global system.

z coord inst calculated correctly, so only dz is correct.

def xyz_to_gps(x, y, z):
lat0 = 55.93060
lon0 = 37.51796
h0 = 0

rot = -80
latpm = 9.010063270126722e-06
lonpm = 1.130896616413607e-05
#y = -y

lat = lat0 - x * math.cos(math.radians(rot))*latpm + y * math.sin(math.radians(rot))*latpm 
lon = lon0 + x * math.sin(math.radians(rot))*lonpm + y * math.cos(math.radians(rot))*lonpm

return lat, lon, h0 + z

This is something I’m thinking about doing lately. I would like to see further info too!
What kind of GPS info have you sent into the GPS port? (Is it even going through the GPS port? I’m assuming you’re using pixhawk here) NMEA? or UBLOX?
Not really sure what is happening, neither any export to the method, but the first thing came to my mind is the coordinate transfer of your GPS coordinate.
AFAIK, the modern GPS uses WGS84 as the coordinate system, which model the eqrth surface nonlinearly(not a sphere), but your equation seems quite simple.
Also, do you have your indoor coordinate system matches with the local north direction? I think the compass would be confused if not.
Both of the above problem will probably annoyed the EKF, making the EKF decides to trust the GPS data less and possible causing the phenomenom you see.
Please let us know if there’s any news, THX.

Updating to master should help.

Hello! Your project is very interesting… I’m dealing with a similar problem. I’d like to generate a fake GPS using Google Tango. It would be grateful if you could give additional information about the pixhawk interface through GPS port: how did you made it?
Thank-you in advance for your reply