SITL GPS spoofing - hil/gps topic doesn't work?

Hi there,

I have tried to send new GPS data to the drone on the topic /mavros/hil/gps, where I set MAV_USEHILGPS=1 and SIM_BLOCK_GPS=1 to be able to see a GPS spoofing happens with QGroundControl. But after some time it goes into failsafe and I don’t understand why it happens?

  • It also stop setting setpoint after some time.

Flight Log:


Stops setting set points:

What is your goal here? Are you trying to test the fail safes of the PX4 Autopilot? Or are you trying to write code to maliciously takeover and bad GPS sensor data to the flight controller?

I want to takeover the drone by sending wrong gps signals. An image of what behavior I want is showned in the image below

GPS_SPoofing

I get it, but why do you want to try this with GPS spoofing?

I want to see if it’s possible to make a robust detection method for GPS spoofing that is a part of my master thesis.

Depends on what level you want to do it, some options/suggestions on top of my mind:

I have tried in the simulator but my problem with that is currently have a python program that runs parallel and with all the other and I can’t see how I should get access to the simulator so the python program says when and how the simulator gps msg data should be.

I have looked more into it now, and if I change directly the Gazebo GPS plugin would I also change the ground Groundtruth?
For the simulator, is it possible to create a ROS connection to it and from that says when and how the GPS msg should be?
If it’s possible how should It be done in the CMakeLists.txt? (I assume that it’s done in the CMakeLists.txt )

@Jaeyoung-Lim do you know the answer to the question regarding the GPS plugin on gazebo?

@Niknu for ROS 2, you can perhaps leverage the microRTPS bridge, but you would need to modify the logic I pointed you towards, to publish topics, you would essentially need to create your own uORB topic

That sounds like a lot of work. I hopped that it was easier to do, but it’s what it’s.

But for the /mavros/hill/gps, should that be used when you have hardware connected to it?

@Niknu

Did you have any updates on this topic? I am currently trying to accomplish almost the same thing as you, and I will have to work on this GPS module to validate my ML algorithms to detect spoofing.

Thanks!