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:
https://review.px4.io/plot_app?log=a9cb0aa3-058e-4e8c-9628-2a665d8aacef
Stops setting set points:

1 Like

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

1 Like

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:

1 Like

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!

@matheus-ps

I have github where I published the work from that. I added new parts to the GPS module to be able to change the coordinates the drone got compared to what they really was.

and a diagram of the connection:

1 Like

@Niknu

Thanks for sharing the repository of your thesis! Is the document publicly available? I want to have some insights into what can be improved on your implementation. I’m currently trying to do spoofing detection but with ROS2.

@matheus-ps
I have made my thesis in overleaf so you need to download the PDF from here:

4 Likes

Thanks for sharing @Niknu