SITL GPS spoofing - how to do it?

Hi there,

I’m trying to simulate GPS spoofing for the SITL and it doesn’t work as intended. It looks possible if you are looking at the data from this site

What I’m have done is disable GPS(SIM_GPS_BLOCK=1) and sent the GPS msg to the hil_gps.
But the drone gets some errors in the compas or other sensors.

I use the newest stable release for the PX4

So my question is:
(1) Can I do it in a different way?
(2) Is the way I’m doing it the only way?

You can hack it in place in the simulator module.

If there are specific ways you want to spoof GPS or simulate failures we can extend it as needed.

In general, I should overwrite the GPS msg when I want to spoof the drone. So when I spoof the drone should it get false GPS messages. The behavior of the drone should be something like this when I spoof the drone( See the image below)

@dagar, how can I be sure that the drone will accept the new GPS msgs from the topic ‘/mavros/hil/gps’.
I can’t see my way out of that?

Any updates on this ?

I have linket to my master thesis where I did it in this link:

I hope you can figure out how i did it

1 Like