How do I fully turn GPS off on a drone?

Hi,

I have two drones in Gazebo simulation, and I want to turn GPS off on the second one to get location from the first one.

I’ve already set this in Gazebo world file to get navsat plugin for first drone only. (I’m not sure it is working though)

    <plugin filename="gz-sim-navsat-system" name="gz::sim::systems::NavSat">
      <entity>name_of_the_first_drone</entity>
    </plugin>

I’ve also set these parameters:

SIM_GPS_TYPE = 0
SIM_GPS_DISABLE = 1
SIM_GPS1_ENABLE = 0
SIM_GPS2_ENABLE = 0
SIM_GPS3_ENABLE = 0
AHRS_GPS_USE = 0
GPS_AUTO_CONFIG = 0

So far, the preflight check shows

AP: PreArm: GPS 1: Bad fix

which probably means that GPS is off. However, when I turn off the check and take off, I can see this via status command:

662: GLOBAL_POSITION_INT {time_boot_ms : 191175, lat : -353632531, lon : 1491652484, alt : 583990, relative_alt : 0, vx : 0, vy : 0, vz : 0, hdg : 8999}
2: GPS_GLOBAL_ORIGIN {latitude : -353632621, longitude : 1491652374, altitude : 584000, time_usec : 39061000}
662: GPS_RAW_INT {time_usec : 0, fix_type : 1, lat : -353632531, lon : 1491652484, alt : 583990, eph : 121, epv : 200, vel : 0, cog : 23101, satellites_visible : 3, alt_ellipsoid : 583990, h_acc : 300, v_acc : 300, vel_acc : 0, hdg_acc : 0, yaw : 0}
193: HEARTBEAT {type : 2, autopilot : 3, base_mode : 81, custom_mode : 0, system_status : 3, mavlink_version : 3}

which probably means, that GPS data still flow (and changes during flight). Also, I’m seeing this during preflight:

AP: GPS 1: probing for u-blox at 230400 baud
AP: GPS 1: detected u-blox

Also, there is a difference between Guided and Guided_NoGPS modes behavior. In Guided_NoGPS it floats aside, as expected. In Guided, with GPS presumably “turned off”, it doesn’t.

Overall, it makes me think I didn’t turn GPS off. What should I do?

Log

It turns out, that

The “perfect” EKF type, 10, doesn’t rely on sensors for data, it is just echoing back the simulation numbers

You need to set AHRS_EKF_TYPE = 3 to use EKF 3 and standard out-of-simulation calculations. Then GPS won’t work.