We get 10 satellites instead of 13 sometimes. The test is flaky on master and no…t caused by a recent PR to support SIM_GPSx_FIXTYPE
> @Ryanf55 the merged uBlox SITL changes - could they cause the test failure in here?
>
> https://github.com/ArduPilot/ardupilot/actions/runs/24311650113/job/70986599160?pr=32669
I don't see how. I just changed a ternary to if/else. I don't ever set the satellite count to 10 instead of 13.
https://github.com/ArduPilot/ardupilot/pull/32706/changes
I reproduced the failure locally on `master`. Repeat testing of the test case shows the test is flaky.
```
./Tools/autotest/autotest.py build.Copter test.CopterTests2b.MultipleGPS
```
I also found it flaky on commit `6fff5e57f7827b5dcbf875d5596f5337b2e3b6af`, which was before my PR.
Logs for failed test.
<details>
```
AT-0001.3: ##################################################################################
AT-0001.3: ########## MultipleGPS (check ArduPilot behaviour across multiple GPS units) ##########
AT-0001.3: ##################################################################################
AT-0001.3: Doing timesync roundtrip
AT-0001.3: Received: TIMESYNC {tc1 : 5360446000, ts1 : 142250}
AT-0001.3: Received TIMESYNC response after 0.000000s
AT-0001.3: AP: EKF3 IMU1 tilt alignment complete
AT-0001.3: AP: EKF3 IMU0 tilt alignment complete
AT-0001.3: AP: EKF3 IMU1 MAG0 initial yaw alignment complete
AT-0001.3: AP: EKF3 IMU0 MAG0 initial yaw alignment complete
AT-0001.3: RC values good
AT-0001.3: Drained 12 messages from mav (20076.445154/s)
AT-0001.3: Changing mode to STABILIZE
AT-0001.3: Sending COMMAND_LONG to (1,1) (MAV_CMD_DO_SET_MODE=176) (p1=1.000000 p2=0.000000 p3=0.000000 p4=0.000000 p5=0.000000 p6=0.000000 p7=0.000000)
AT-0001.3: Got mode STABILIZE
AT-0001.4: AP: GPS 1: probing for u-blox at 230400 baud
AT-0001.4: AP: GPS 1: detected u-blox
AT-0001.7: AP: EKF3 IMU1 origin set
AT-0001.7: AP: Field Elevation Set: 584m
AT-0001.7: AP: EKF3 IMU0 origin set
AT-0001.9: GPS2_RAW count after 24.000000 seconds: 0
AT-0001.9: GPS2_RAW: Want=0.000000 got=0.000000
AT-0001.9: -
AT-0001.9: ---------- Get GPS2_RAW as soon as we're configured for a second GPS ----------
AT-0001.9: -
AT-0001.9: set_parameters: ({'GPS2_TYPE': 1})
AT-0001.9: GPS2_TYPE want=1.000000 autopilot=None (attempt=1/10)
AT-0001.9: Requesting (GPS2_TYPE)
AT-0001.9: Received wanted PARAM_VALUE GPS2_TYPE=0.000000
AT-0001.9: GPS2_TYPE want=1.000000 autopilot=0.0 (attempt=2/10)
AT-0001.9: Sending set (GPS2_TYPE) to (1.000000) (old=0.000000)
AT-0001.9: Received wanted PARAM_VALUE GPS2_TYPE=1.000000
AT-0001.9: GPS2_TYPE want=1.000000 autopilot=1.0 (attempt=3/10)
AT-0001.9: GPS2_TYPE is now 1.000000
AT-0002.2: AP: EKF3 IMU0 is using GPS
AT-0002.2: AP: EKF3 IMU1 is using GPS
AT-0002.4: GPS2_RAW count after 20.200000 seconds: 102
AT-0002.4: GPS2_RAW: Want=5.000000 got=5.000000
AT-0002.4: -
AT-0002.4: ---------- Ensure correct fix type when no connected GPS ----------
AT-0002.4: -
AT-0002.4: 2026-04-13 09:52:42.75: GPS2_RAW (id=124) (seq=176) (src=1/1) (in-link=None) (signed=No)
time_usec: 0us
fix_type: 0 (GPS_FIX_TYPE_NO_GPS)
lat: 0.0deg
lon: 0.0deg
alt: 0mm
eph: 65535
epv: 65535
vel: 0cm/s
cog: 0.0deg
satellites_visible: 0
dgps_numch: 0
dgps_age: 0ms
yaw: 0.0deg
alt_ellipsoid: 0mm
h_acc: 0mm
v_acc: 0mm
vel_acc: 0mm/s
hdg_acc: 0.0deg
AT-0002.4: -
AT-0002.4: ---------- Ensure detection when sim gps connected ----------
AT-0002.4: -
AT-0002.4: set_parameters: ({'SIM_GPS2_TYPE': 1})
AT-0002.4: SIM_GPS2_TYPE want=1.000000 autopilot=None (attempt=1/10)
AT-0002.4: Requesting (SIM_GPS2_TYPE)
AT-0002.4: Received wanted PARAM_VALUE SIM_GPS2_TYPE=1.000000
AT-0002.4: SIM_GPS2_TYPE want=1.000000 autopilot=1.0 (attempt=2/10)
AT-0002.4: SIM_GPS2_TYPE is now 1.000000
AT-0002.4: set_parameters: ({'SIM_GPS2_ENABLE': 1})
AT-0002.4: SIM_GPS2_ENABLE want=1.000000 autopilot=None (attempt=1/10)
AT-0002.4: Requesting (SIM_GPS2_ENABLE)
AT-0002.4: Received wanted PARAM_VALUE SIM_GPS2_ENABLE=0.000000
AT-0002.4: SIM_GPS2_ENABLE want=1.000000 autopilot=0.0 (attempt=2/10)
AT-0002.4: Sending set (SIM_GPS2_ENABLE) to (1.000000) (old=0.000000)
AT-0002.4: Received wanted PARAM_VALUE SIM_GPS2_ENABLE=1.000000
AT-0002.4: SIM_GPS2_ENABLE want=1.000000 autopilot=1.0 (attempt=3/10)
AT-0002.4: SIM_GPS2_ENABLE is now 1.000000
AT-0002.4: Drained 0 messages from mav (0.000000/s)
AT-0002.4: Rebooting SITL
AT-0002.4: Sending param_request_read for (STAT_RESET)
AT-0002.5: get_parameter(STAT_RESET): PARAM_VALUE {param_id : STAT_RESET, param_value : 1.0, param_type : 6, param_count : 1405, param_index : 65535}
AT-0002.5: Sending param_request_read for (STAT_BOOTCNT)
AT-0002.5: get_parameter(STAT_BOOTCNT): PARAM_VALUE {param_id : STAT_BOOTCNT, param_value : 2.0, param_type : 4, param_count : 1405, param_index : 65535}
AT-0002.5: Sending reboot command
AT-0002.5: Sending COMMAND_LONG to (1,1) (MAV_CMD_PREFLIGHT_REBOOT_SHUTDOWN=246) (p1=1.000000 p2=1.000000 p3=0.000000 p4=0.000000 p5=0.000000 p6=0.000000 p7=0.000000)
AT-0002.5: Sending param_request_read for (STAT_BOOTCNT)
AT-0002.5: While awaiting reboot received (COMMAND_ACK {command : 246, result : 0, progress : 0, result_param2 : 0, target_system : 250, target_component : 250})
EOF on TCP socket
Attempting reconnect
[Errno 111] Connection refused sleeping
AT-0003.5: get_parameter(STAT_BOOTCNT): None
AT-0003.5: Sending param_request_read for (STAT_BOOTCNT)
AT-0003.5: get_parameter(STAT_BOOTCNT): PARAM_VALUE {param_id : STAT_BOOTCNT, param_value : 3.0, param_type : 4, param_count : 1395, param_index : 65535}
AT-0003.5: current=3.0 required=3
AT-0003.5: Doing timesync roundtrip
AT-0003.5: AP: RCInput: decoding UDP (Pulses)
AT-0003.5: Received: TIMESYNC {tc1 : 200844000, ts1 : 148250}
AT-0003.5: Received TIMESYNC response after 0.000027s
AT-0003.5: Calling initialise-after-reboot
AT-0003.5: Drained 0 messages from mav (0.000000/s)
AT-0003.5: AP: Calibrating barometer
AT-0003.5: Doing timesync roundtrip
AT-0003.5: Received: TIMESYNC {tc1 : 1057168000, ts1 : 149250}
AT-0003.5: Received TIMESYNC response after 0.000033s
AT-0003.5: AP: Barometer 1 calibration complete
AT-0003.5: AP: Barometer 2 calibration complete
AT-0003.5: AP: ArduPilot Ready
AT-0003.5: AP: AHRS: DCM active
AT-0003.5: Reboot complete
AT-0003.5: set_parameters: ({})
AT-0003.5: Simstate Close to startup location: dist=0.000000 max=1.000000 (simstate: lat=-35.362938,lon=149.165085,alt=0.0 start-loc: lat=-35.362938,lon=149.165085,alt=584.1)
AT-0003.5: Waiting for text : gps 1: detected u-blox
AT-0003.5: statustext got=(RCInput: decoding UDP (Pulses)) want=(GPS 1: detected u-blox)
AT-0003.5: statustext got=(Calibrating barometer) want=(GPS 1: detected u-blox)
AT-0003.5: statustext got=(Barometer 1 calibration complete) want=(GPS 1: detected u-blox)
AT-0003.5: statustext got=(Barometer 2 calibration complete) want=(GPS 1: detected u-blox)
AT-0003.5: statustext got=(ArduPilot Ready) want=(GPS 1: detected u-blox)
AT-0003.5: statustext got=(AHRS: DCM active) want=(GPS 1: detected u-blox)
AT-0003.5: AP: RC7: SaveWaypoint MIDDLE
AT-0003.6: AP: EKF3 IMU0 initialised
AT-0003.6: AP: EKF3 IMU1 initialised
AT-0003.6: AP: AHRS: EKF3 active
AT-0003.6: AP: EKF3 IMU1 tilt alignment complete
AT-0003.6: AP: EKF3 IMU0 tilt alignment complete
AT-0003.6: AP: EKF3 IMU1 MAG0 initial yaw alignment complete
AT-0003.6: AP: EKF3 IMU0 MAG0 initial yaw alignment complete
AT-0003.7: AP: GPS 1: probing for u-blox at 230400 baud
AT-0003.7: AP: GPS 2: probing for u-blox at 230400 baud
AT-0003.7: AP: GPS 1: detected u-blox
AT-0003.7: Received expected text: gps 1: detected u-blox
AT-0003.7: Waiting for text : gps 2: detected u-blox
AT-0003.7: statustext got=(RCInput: decoding UDP (Pulses)) want=(GPS 2: detected u-blox)
AT-0003.7: statustext got=(Calibrating barometer) want=(GPS 2: detected u-blox)
AT-0003.7: statustext got=(Barometer 1 calibration complete) want=(GPS 2: detected u-blox)
AT-0003.7: statustext got=(Barometer 2 calibration complete) want=(GPS 2: detected u-blox)
AT-0003.7: statustext got=(ArduPilot Ready) want=(GPS 2: detected u-blox)
AT-0003.7: statustext got=(AHRS: DCM active) want=(GPS 2: detected u-blox)
AT-0003.7: statustext got=(RC7: SaveWaypoint MIDDLE) want=(GPS 2: detected u-blox)
AT-0003.7: statustext got=(EKF3 IMU0 initialised) want=(GPS 2: detected u-blox)
AT-0003.7: statustext got=(EKF3 IMU1 initialised) want=(GPS 2: detected u-blox)
AT-0003.7: statustext got=(AHRS: EKF3 active) want=(GPS 2: detected u-blox)
AT-0003.7: statustext got=(EKF3 IMU1 tilt alignment complete) want=(GPS 2: detected u-blox)
AT-0003.7: statustext got=(EKF3 IMU0 tilt alignment complete) want=(GPS 2: detected u-blox)
AT-0003.7: statustext got=(EKF3 IMU1 MAG0 initial yaw alignment complete) want=(GPS 2: detected u-blox)
AT-0003.7: statustext got=(EKF3 IMU0 MAG0 initial yaw alignment complete) want=(GPS 2: detected u-blox)
AT-0003.7: statustext got=(GPS 1: probing for u-blox at 230400 baud) want=(GPS 2: detected u-blox)
AT-0003.7: statustext got=(GPS 2: probing for u-blox at 230400 baud) want=(GPS 2: detected u-blox)
AT-0003.7: statustext got=(GPS 1: detected u-blox) want=(GPS 2: detected u-blox)
AT-0003.7: AP: GPS 2: detected u-blox
AT-0003.7: Received expected text: gps 2: detected u-blox
AT-0003.7: 2026-04-13 09:52:44.05: GPS2_RAW (id=124) (seq=7) (src=1/1) (in-link=None) (signed=No)
time_usec: 9963000us (9.963s)
fix_type: 6 (GPS_FIX_TYPE_RTK_FIXED)
lat: -35.362938deg
lon: 149.165085deg
alt: 584090mm
eph: 121
epv: 200
vel: 0cm/s
cog: 0.0deg
satellites_visible: 10
dgps_numch: 0
dgps_age: 0ms
yaw: 0.0deg
alt_ellipsoid: 584090mm
h_acc: 300mm
v_acc: 300mm
vel_acc: 0mm/s
hdg_acc: 0.0deg
AT-0003.7: -
AT-0003.7: ---------- Check parameters are per-GPS ----------
AT-0003.7: -
AT-0003.7: Sending param_request_read for (SIM_GPS1_NUMSATS)
AT-0003.7: get_parameter(SIM_GPS1_NUMSATS): PARAM_VALUE {param_id : SIM_GPS1_NUMSATS, param_value : 10.0, param_type : 2, param_count : 1405, param_index : 65535}
AT-0003.7: SIM_GPS1_NUMSATS has expected value 10.000000
AT-0003.7: set_parameters: ({'SIM_GPS1_NUMSATS': 13})
AT-0003.7: SIM_GPS1_NUMSATS want=13.000000 autopilot=None (attempt=1/10)
AT-0003.7: Requesting (SIM_GPS1_NUMSATS)
AT-0003.7: Received wanted PARAM_VALUE SIM_GPS1_NUMSATS=10.000000
AT-0003.7: SIM_GPS1_NUMSATS want=13.000000 autopilot=10.0 (attempt=2/10)
AT-0003.7: Sending set (SIM_GPS1_NUMSATS) to (13.000000) (old=10.000000)
AT-0003.7: Received wanted PARAM_VALUE SIM_GPS1_NUMSATS=13.000000
AT-0003.7: SIM_GPS1_NUMSATS want=13.000000 autopilot=13.0 (attempt=3/10)
AT-0003.7: SIM_GPS1_NUMSATS is now 13.000000
AT-0003.7: Exception caught: Expected 13 sats, got 10
Traceback (most recent call last):
File "/home/ryan/Dev/ardupilot/Tools/autotest/vehicle_test_suite.py", line 9153, in run_one_test_attempt
test_function(**test_kwargs)
File "/home/ryan/Dev/ardupilot/Tools/autotest/vehicle_test_suite.py", line 14689, in MultipleGPS
self.assert_gps_satellite_count("GPS_RAW_INT", 13)
File "/home/ryan/Dev/ardupilot/Tools/autotest/vehicle_test_suite.py", line 14585, in assert_gps_satellite_count
raise NotAchievedException("Expected %u sats, got %u" %
vehicle_test_suite.NotAchievedException: Expected 13 sats, got 10
AT-0003.7: log list: ['logs/00000001.BIN', 'logs/00000002.BIN', 'logs/00000003.BIN']
AT-0003.7: Most recent logfile: logs/00000003.BIN
AT-0003.7: Drained 8 messages from mav (15556.064905/s)
AT-0003.8: set_parameters: ({'GPS2_TYPE': 0.0, 'SIM_GPS2_TYPE': 1.0, 'SIM_GPS2_ENABLE': 0.0, 'SIM_GPS1_NUMSATS': 10.0})
AT-0003.8: GPS2_TYPE want=0.000000 autopilot=None (attempt=1/40)
AT-0003.8: Requesting (GPS2_TYPE)
AT-0003.8: SIM_GPS2_TYPE want=1.000000 autopilot=None (attempt=1/40)
AT-0003.8: Requesting (SIM_GPS2_TYPE)
AT-0003.8: SIM_GPS2_ENABLE want=0.000000 autopilot=None (attempt=1/40)
AT-0003.8: Requesting (SIM_GPS2_ENABLE)
AT-0003.8: SIM_GPS1_NUMSATS want=10.000000 autopilot=None (attempt=1/40)
AT-0003.8: Requesting (SIM_GPS1_NUMSATS)
AT-0003.8: Received wanted PARAM_VALUE GPS2_TYPE=1.000000
AT-0003.8: Received wanted PARAM_VALUE SIM_GPS2_TYPE=1.000000
AT-0003.8: Received wanted PARAM_VALUE SIM_GPS2_ENABLE=1.000000
AT-0003.8: Received wanted PARAM_VALUE SIM_GPS1_NUMSATS=13.000000
AT-0003.8: GPS2_TYPE want=0.000000 autopilot=1.0 (attempt=2/40)
AT-0003.8: Sending set (GPS2_TYPE) to (0.000000) (old=1.000000)
AT-0003.8: SIM_GPS2_TYPE want=1.000000 autopilot=1.0 (attempt=2/40)
AT-0003.8: SIM_GPS2_TYPE is now 1.000000
AT-0003.8: SIM_GPS2_ENABLE want=0.000000 autopilot=1.0 (attempt=2/40)
AT-0003.8: Sending set (SIM_GPS2_ENABLE) to (0.000000) (old=1.000000)
AT-0003.8: SIM_GPS1_NUMSATS want=10.000000 autopilot=13.0 (attempt=2/40)
AT-0003.8: Sending set (SIM_GPS1_NUMSATS) to (10.000000) (old=13.000000)
AT-0003.8: Received wanted PARAM_VALUE GPS2_TYPE=0.000000
AT-0003.8: Received wanted PARAM_VALUE SIM_GPS2_ENABLE=0.000000
AT-0003.8: Received wanted PARAM_VALUE SIM_GPS1_NUMSATS=10.000000
AT-0003.8: GPS2_TYPE want=0.000000 autopilot=0.0 (attempt=3/40)
AT-0003.8: GPS2_TYPE is now 0.000000
AT-0003.8: SIM_GPS2_ENABLE want=0.000000 autopilot=0.0 (attempt=3/40)
AT-0003.8: SIM_GPS2_ENABLE is now 0.000000
AT-0003.8: SIM_GPS1_NUMSATS want=10.000000 autopilot=10.0 (attempt=3/40)
AT-0003.8: SIM_GPS1_NUMSATS is now 10.000000
AT-0003.8: Doing implicit context-pop reboot
AT-0003.8: Drained 0 messages from mav (0.000000/s)
AT-0003.8: Rebooting SITL
AT-0003.8: Sending param_request_read for (STAT_RESET)
AT-0003.8: get_parameter(STAT_RESET): PARAM_VALUE {param_id : STAT_RESET, param_value : 1.0, param_type : 6, param_count : 1371, param_index : 65535}
AT-0003.8: Sending param_request_read for (STAT_BOOTCNT)
AT-0003.8: get_parameter(STAT_BOOTCNT): PARAM_VALUE {param_id : STAT_BOOTCNT, param_value : 3.0, param_type : 4, param_count : 1371, param_index : 65535}
AT-0003.8: Sending reboot command
AT-0003.8: Sending COMMAND_LONG to (1,1) (MAV_CMD_PREFLIGHT_REBOOT_SHUTDOWN=246) (p1=1.000000 p2=1.000000 p3=0.000000 p4=0.000000 p5=0.000000 p6=0.000000 p7=0.000000)
AT-0003.8: Sending param_request_read for (STAT_BOOTCNT)
AT-0003.8: While awaiting reboot received (COMMAND_ACK {command : 246, result : 0, progress : 0, result_param2 : 0, target_system : 250, target_component : 250})
```
</details>
I'll look at this in time for dev call.
_Originally posted by @Ryanf55 in https://github.com/ArduPilot/ardupilot/issues/32669#issuecomment-4237750986_