PX4 / PX4-Autopilot

PX4 Autopilot Software
https://px4.io
BSD 3-Clause "New" or "Revised" License
8.53k stars 13.52k forks source link

GPS blend not working on Linux #16141

Open blazczak opened 4 years ago

blazczak commented 4 years ago

Describe the bug With code changes from #16124, px4 is not using the secondary GPS for positioning/blending.

In both cases, the system seems to "see" and report data from the primary GPS only

To Reproduce Steps to reproduce the behavior:

  1. Follow the instructions at https://docs.px4.io/master/en/gps_compass/#secondary-gps-dual-gps-system
  2. Set EKF2_GPS_MASK parameter to 3
  3. Configure the gps driver to use primary and secondary GPS: gps start -d /dev/spidev0.0 -i spi -e /dev/ttyACM0 -j uart -p ubx
  4. Reboot
  5. See the system still use the primary GPS

Expected behavior Data from both GPS systems should be blended.

Log Files and Screenshots

$ sudo px4-gps status
INFO  [gps] Main GPS
INFO  [gps] protocol: UBX
INFO  [gps] status: OK, port: /dev/spidev0.0, baudrate: 0
INFO  [gps] sat info: disabled
INFO  [gps] rate position:  4.94 Hz
INFO  [gps] rate velocity:  4.94 Hz
INFO  [gps] rate publication:  4.94 Hz
INFO  [gps] rate RTCM injection:  0.00 Hz
 sensor_gps_s
    timestamp: 3688453483  (0.095683 seconds ago)
    time_utc_usec: 1604894723800400
    lat: 
    lon: 
    alt: 76500
    alt_ellipsoid: 48006
    s_variance_m_s: 1.6260
    c_variance_rad: 0.6383
    eph: 5.7620
    epv: 13.5630
    hdop: 1.9500
    vdop: 3.7500
    noise_per_ms: 56
    jamming_indicator: 217
    vel_m_s: 0.3820
    vel_n_m_s: 0.2830
    vel_e_m_s: 0.2570
    vel_d_m_s: -0.7360
    cog_rad: 2.0818
    timestamp_time_relative: 0
    heading: nan
    heading_offset: 0.0000
    fix_type: 3
    vel_ned_valid: True
    satellites_used: 4
INFO  [gps]
INFO  [gps] Secondary GPS
INFO  [gps] protocol: UBX
INFO  [gps] status: OK, port: /dev/ttyACM0, baudrate: 115200
INFO  [gps] sat info: disabled
INFO  [gps] rate position:  4.96 Hz
INFO  [gps] rate velocity:  4.96 Hz
INFO  [gps] rate publication:  4.96 Hz
INFO  [gps] rate RTCM injection:  0.00 Hz
 sensor_gps_s
    timestamp: 3688463440  (0.174023 seconds ago)
    time_utc_usec: 1604894723799696
    lat: 
    lon: 
    alt: 72608
    alt_ellipsoid: 44114
    s_variance_m_s: 1.6170
    c_variance_rad: 0.7681
    eph: 5.1040
    epv: 12.4000
    hdop: 1.8200
    vdop: 3.5400
    noise_per_ms: 84
    jamming_indicator: 181
    vel_m_s: 1.5790
    vel_n_m_s: 0.1600
    vel_e_m_s: 0.7810
    vel_d_m_s: -0.7610
    cog_rad: 3.2859
    timestamp_time_relative: 0
    heading: nan
    heading_offset: 0.0000
    fix_type: 3
    vel_ned_valid: True
    satellites_used: 6

1.10.1:

$ sudo px4-listener ekf_gps_position

TOPIC: ekf_gps_position
 ekf_gps_position_s
timestamp: 3708828251  (0.206086 seconds ago)
lat: 
lon: 
alt: 28606
alt_ellipsoid: 1066962958
s_variance_m_s: 2.1290
eph: 13.4770
epv: 18.1050
vel_m_s: 0.4670
vel_n_m_s: -0.1420
vel_e_m_s: 0.4450
vel_d_m_s: -0.4530
heading: nan
heading_offset: 0.0000
fix_type: 3
vel_ned_valid: True
satellites_used: 7
selected: 1

1.11.1:

sudo build/emlid_navio2_native/bin/px4-listener ekf_gps_position
 Topic did not match any known topics

Are there more configuration changes needed for dual GPS in 1.11.x?

Drone (please complete the following information):

blazczak commented 3 years ago

Has this been worked on in 1.11.x by any chance? The GPS setup performs worse in dual mode than in single mode on Linux: PX4 in dual takes longer to acquire a fix, then a lock and in fact caused "GPS error too large" warning in-flight in plain view of satellites with two receivers attached and active - both are the same type, u-blox M8N.

Looking at the GPS stats it appears that in dual mode one of the receivers might "drag" the other one down: one receiver may have 15 satellites and a fix but PX4 still won't lock. Perhaps some sort of a weighing approach should be used in blended mode based on each receiver's fix, error and/or number of acquired satellites.

https://logs.px4.io/plot_app?log=b4bc8c8b-5e48-4bcb-8eab-9c396ec2f33f