Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Commander: add option to re-enable GPS fusion on link loss #24193

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

sfuhrer
Copy link
Contributor

@sfuhrer sfuhrer commented Jan 10, 2025

Solved Problem

In case of GPS spoofing or jamming, or simply for testing purposes, operators can disable the GPS fusion (EKF2_GPS_CTRL) to purely rely on other means of navigation. In case of link loss, they have no more way to change system settings, and in some cases it is beneficial if then the system switches back the GPS fusion setting as it was at the moment of takeoff.

Solution

New param: COM_DLL_GPS_CTRL.

In case the data link is lost and the GPS fusion parameter (EKF2_GPS_CTRL) is changed while arming, the fusion parameter is reset to the value before arming.

Changelog Entry

For release notes:

Feature: Commander: add option to re-enable GPS fusion on link loss...

Test coverage

SITL tested: VTOL:

  • takeoff, transition to FW, Hold mode,
  • set COM_DLL_GNSS_CTL to 1
  • set EKF2_GPS_CTRL to 0
  • close the ground station
    --> vehicle will RTL and set EKF2_GPS_CTRL back to 7

New param: COM_DLL_GPS_CTRL.

In case the data link is lost and the GPS fusion parameter
(EKF2_GPS_CTRL) is changed while arming, the fusion parameter
is reset to the value before arming.

Signed-off-by: Silvan <[email protected]>
@sfuhrer sfuhrer requested review from MaEtUgR and bresch January 10, 2025 14:01
Copy link

🔎 FLASH Analysis

px4_fmu-v5x [Total VM Diff: 416 byte (0.02 %)]
    FILE SIZE        VM SIZE    
--------------  -------------- 
+0.0%    +416  +0.0%    +416    .text
  +1.1%    +220  +1.1%    +220    ../../src/modules/commander/Commander.cpp
  +0.0%     +73  +0.0%     +73    ROMFS/nsh_romfsimg.c
  +0.3%     +64  +0.3%     +64    ../../src/lib/parameters/parameters.cpp
  +0.0%     +63  +0.0%     +63    [section .text]
  -0.1%      -4  -0.1%      -4    ../../src/modules/commander/accelerometer_calibration.cpp
+0.0%     +56  [ = ]       0    .debug_abbrev
   +11%     +56  [ = ]       0    ../../src/lib/version/version.c
+0.0%      +8  [ = ]       0    .debug_aranges
  -5.0%      -8  [ = ]       0    ../../src/lib/version/version.c
  +1.8%     +16  [ = ]       0    ../../src/modules/commander/Commander.cpp
+0.0%     +72  [ = ]       0    .debug_frame
+0.0% +3.48Ki  [ = ]       0    .debug_info
  +0.0%      +8  [ = ]       0    ../../src/drivers/batt_smbus/batt_smbus.cpp
  +0.0%      +8  [ = ]       0    ../../src/drivers/cdcacm_autostart/cdcacm_autostart.cpp
  +0.0%      +8  [ = ]       0    ../../src/drivers/distance_sensor/lightware_laser_i2c/lightware_laser_i2c.cpp
  +0.0%      +8  [ = ]       0    ../../src/drivers/dshot/DShot.cpp
  +0.0%      +8  [ = ]       0    ../../src/drivers/heater/heater.cpp
  +0.0%      +8  [ = ]       0    ../../src/drivers/lights/rgbled/rgbled.cpp
  +0.0%      +8  [ = ]       0    ../../src/drivers/lights/rgbled_is31fl3195/rgbled_is31fl3195.cpp
  +0.0%      +8  [ = ]       0    ../../src/drivers/lights/rgbled_lp5562/rgbled_lp5562.cpp
  +0.0%      +8  [ = ]       0    ../../src/drivers/lights/rgbled_ncp5623c/rgbled_ncp5623c.cpp
  +0.0%      +8  [ = ]       0    ../../src/drivers/osd/msp_osd/msp_osd.cpp
  +0.0%      +8  [ = ]       0    ../../src/drivers/power_monitor/ina226/ina226.cpp
  +0.0%      +8  [ = ]       0    ../../src/drivers/power_monitor/ina226/ina226_main.cpp
  +0.0%      +8  [ = ]       0    ../../src/drivers/power_monitor/ina228/ina228.cpp
  +0.0%      +8  [ = ]       0    ../../src/drivers/power_monitor/ina228/ina228_main.cpp
  +0.0%      +8  [ = ]       0    ../../src/drivers/power_monitor/ina238/ina238.cpp
  +0.0%      +8  [ = ]       0    ../../src/drivers/power_monitor/ina238/ina238_main.cpp
  +0.0%      +8  [ = ]       0    ../../src/drivers/power_monitor/pm_selector_auterion/PowerMonitorSelectorAuterion.cpp
  +0.0%      +8  [ = ]       0    ../../src/drivers/pwm_out/PWMOut.cpp
  +0.0%      +8  [ = ]       0    ../../src/drivers/px4io/px4io.cpp
  +0.0%      +8  [ = ]       0    ../../src/drivers/rc/crsf_rc/CrsfRc.cpp
 -100.0% +3.33Ki  [ = ]       0    [171 Others]
+0.0%    +443  [ = ]       0    .debug_line
  +0.1%     +29  [ = ]       0    ../../src/lib/parameters/parameters.cpp
  -1.3%     -25  [ = ]       0    ../../src/lib/version/version.c
  +1.4%    +440  [ = ]       0    ../../src/modules/commander/Commander.cpp
  -0.1%      -1  [ = ]       0    task/task_cancelpt.c
+0.0%    +376  [ = ]       0    .debug_loc
  +0.2%     +15  [ = ]       0    ../../src/drivers/rc/crsf_rc/CrsfRc.cpp
  -0.0%      -2  [ = ]       0    ../../src/drivers/uavcan/uavcan_main.cpp
  +0.0%     +28  [ = ]       0    ../../src/drivers/uavcan/uavcan_servers.cpp
  -0.1%     -15  [ = ]       0    ../../src/lib/avoidance/ObstacleAvoidance.cpp
  -0.1%     -50  [ = ]       0    ../../src/lib/parameters/parameters.cpp
  +0.2%     +15  [ = ]       0    ../../src/lib/rtl/rtl_time_estimator.cpp
  +1.1%    +448  [ = ]       0    ../../src/modules/commander/Commander.cpp
  -0.1%     -13  [ = ]       0    ../../src/modules/commander/failure_detector/FailureDetector.cpp
  +0.6%     +48  [ = ]       0    ../../src/modules/control_allocator/ActuatorEffectiveness/ActuatorEffectivenessTiltrotorVTOL.cpp
  +0.3%     +15  [ = ]       0    ../../src/modules/flight_mode_manager/tasks/FlightTask/FlightTask.cpp
  -0.1%     -15  [ = ]       0    ../../src/modules/fw_att_control/FixedwingAttitudeControl.cpp
  +0.0%     +15  [ = ]       0    ../../src/modules/fw_pos_control/FixedwingPositionControl.cpp
  -0.3%     -15  [ = ]       0    ../../src/modules/land_detector/FixedwingLandDetector.cpp
  -0.1%     -15  [ = ]       0    ../../src/modules/mag_bias_estimator/MagBiasEstimator.cpp
  +0.0%     +15  [ = ]       0    ../../src/modules/mc_pos_control/MulticopterPositionControl.cpp
  -0.1%     -15  [ = ]       0    ../../src/modules/navigator/mission_base.cpp
  -0.4%     -15  [ = ]       0    ../../src/modules/navigator/rtl_mission_fast_reverse.cpp
  -0.1%     -29  [ = ]       0    ../../src/modules/sensors/vehicle_angular_velocity/VehicleAngularVelocity.cpp
  -0.0%      -3  [ = ]       0    ../../src/modules/sensors/vehicle_imu/VehicleIMU.cpp
  +0.1%     +15  [ = ]       0    ../../src/modules/sensors/vehicle_magnetometer/VehicleMagnetometer.cpp
 -100.0%     -51  [ = ]       0    [4 Others]
+0.0%    +201  [ = ]       0    .debug_ranges
  -2.6%      -8  [ = ]       0    ../../src/lib/version/version.c
  +2.1%    +208  [ = ]       0    ../../src/modules/commander/Commander.cpp
  +1.5%      +1  [ = ]       0    task/task_cancelpt.c
+0.1% +1.92Ki  [ = ]       0    .debug_str
  +0.1%     +17  [ = ]       0    ../../src/drivers/batt_smbus/batt_smbus.cpp
  +1.7% +1.92Ki  [ = ]       0    ../../src/modules/commander/Commander.cpp
  +0.0%     +11  [ = ]       0    ../../src/modules/flight_mode_manager/FlightModeManager.cpp
  -0.0%     -21  [ = ]       0    src/modules/ekf2/modules__ekf2_unity.cpp
  +0.0%      +1  [ = ]       0    src/modules/flight_mode_manager/FlightTasks_generated.cpp
-1.4%      -3  [ = ]       0    .shstrtab
+0.0%    +123  [ = ]       0    .strtab
  -8.1%     -32  [ = ]       0    ../../src/lib/version/version.c
  +3.1%    +123  [ = ]       0    ../../src/modules/commander/Commander.cpp
  +0.0%     +32  [ = ]       0    [section .strtab]
+0.0%     +96  [ = ]       0    .symtab
  +1.1%     +16  [ = ]       0    ../../src/drivers/optical_flow/paw3902/PAW3902.cpp
  -7.0%     -64  [ = ]       0    ../../src/lib/version/version.c
  +1.7%     +80  [ = ]       0    ../../src/modules/commander/Commander.cpp
  -3.3%     -16  [ = ]       0    ../../src/modules/commander/lm_fit.cpp
  +0.5%     +32  [ = ]       0    ../../src/modules/fw_pos_control/FixedwingPositionControl.cpp
  +0.7%     +16  [ = ]       0    ../../src/modules/mc_pos_control/MulticopterPositionControl.cpp
  -2.0%     -16  [ = ]       0    ../../src/modules/sensors/vehicle_optical_flow/VehicleOpticalFlow.cpp
  +0.1%     +64  [ = ]       0    [section .symtab]
  -2.2%     -16  [ = ]       0    src/modules/flight_mode_manager/FlightTasks_generated.cpp
-2.7%    -416  [ = ]       0    [Unmapped]
+0.0% +6.75Ki  +0.0%    +416    TOTAL

px4_fmu-v6x [Total VM Diff: 224 byte (0.01 %)]
    FILE SIZE        VM SIZE    
--------------  -------------- 
+0.0%    +224  +0.0%    +224    .text
  +1.1%    +220  +1.1%    +220    ../../src/modules/commander/Commander.cpp
  +0.0%     +59  +0.0%     +59    [section .text]
  +0.0%     +29  +0.0%     +29    ROMFS/nsh_romfsimg.c
  -0.1%      -4  -0.1%      -4    ../../src/modules/commander/accelerometer_calibration.cpp
  -0.3%     -80  -0.3%     -80    ../../src/lib/parameters/parameters.cpp
+0.0%     +56  [ = ]       0    .debug_abbrev
   +11%     +56  [ = ]       0    ../../src/lib/version/version.c
+0.0%      +8  [ = ]       0    .debug_aranges
  -5.0%      -8  [ = ]       0    ../../src/lib/version/version.c
  +1.8%     +16  [ = ]       0    ../../src/modules/commander/Commander.cpp
+0.0%     +60  [ = ]       0    .debug_frame
+0.0% +3.40Ki  [ = ]       0    .debug_info
  +0.0%      +8  [ = ]       0    ../../src/drivers/cdcacm_autostart/cdcacm_autostart.cpp
  +0.0%      +8  [ = ]       0    ../../src/drivers/distance_sensor/lightware_laser_i2c/lightware_laser_i2c.cpp
  +0.0%      +8  [ = ]       0    ../../src/drivers/dshot/DShot.cpp
  +0.0%      +8  [ = ]       0    ../../src/drivers/heater/heater.cpp
  +0.0%      +8  [ = ]       0    ../../src/drivers/lights/rgbled/rgbled.cpp
  +0.0%      +8  [ = ]       0    ../../src/drivers/lights/rgbled_is31fl3195/rgbled_is31fl3195.cpp
  +0.0%      +8  [ = ]       0    ../../src/drivers/lights/rgbled_lp5562/rgbled_lp5562.cpp
  +0.0%      +8  [ = ]       0    ../../src/drivers/lights/rgbled_ncp5623c/rgbled_ncp5623c.cpp
  +0.0%      +8  [ = ]       0    ../../src/drivers/osd/msp_osd/msp_osd.cpp
  +0.0%      +8  [ = ]       0    ../../src/drivers/power_monitor/ina226/ina226.cpp
  +0.0%      +8  [ = ]       0    ../../src/drivers/power_monitor/ina226/ina226_main.cpp
  +0.0%      +8  [ = ]       0    ../../src/drivers/power_monitor/ina228/ina228.cpp
  +0.0%      +8  [ = ]       0    ../../src/drivers/power_monitor/ina228/ina228_main.cpp
  +0.0%      +8  [ = ]       0    ../../src/drivers/power_monitor/ina238/ina238.cpp
  +0.0%      +8  [ = ]       0    ../../src/drivers/power_monitor/ina238/ina238_main.cpp
  +0.0%      +8  [ = ]       0    ../../src/drivers/power_monitor/pm_selector_auterion/PowerMonitorSelectorAuterion.cpp
  +0.0%      +8  [ = ]       0    ../../src/drivers/pwm_out/PWMOut.cpp
  +0.0%      +8  [ = ]       0    ../../src/drivers/px4io/px4io.cpp
  +0.0%      +8  [ = ]       0    ../../src/drivers/rc_input/RCInput.cpp
  +0.0%      +8  [ = ]       0    ../../src/drivers/uavcan/actuators/esc.cpp
 -100.0% +3.24Ki  [ = ]       0    [160 Others]
+0.0%    +343  [ = ]       0    .debug_line
  -0.3%     -66  [ = ]       0    ../../src/lib/parameters/parameters.cpp
  -1.3%     -25  [ = ]       0    ../../src/lib/version/version.c
  +1.4%    +440  [ = ]       0    ../../src/modules/commander/Commander.cpp
  -0.5%      -6  [ = ]       0    task/task_cancelpt.c
+0.0%    +558  [ = ]       0    .debug_loc
  -0.1%     -15  [ = ]       0    ../../src/drivers/px4io/px4io.cpp
  -0.1%     -15  [ = ]       0    ../../src/drivers/uavcan/remoteid.cpp
  -0.0%     -13  [ = ]       0    ../../src/drivers/uavcan/uavcan_servers.cpp
  +0.1%     +15  [ = ]       0    ../../src/lib/avoidance/ObstacleAvoidance.cpp
  +0.1%     +15  [ = ]       0    ../../src/lib/collision_prevention/CollisionPrevention.cpp
  +0.1%     +16  [ = ]       0    ../../src/lib/mixer_module/mixer_module.cpp
  +0.2%     +52  [ = ]       0    ../../src/lib/parameters/parameters.cpp
  -0.2%     -15  [ = ]       0    ../../src/lib/rtl/rtl_time_estimator.cpp
  +1.1%    +463  [ = ]       0    ../../src/modules/commander/Commander.cpp
  +0.0%      +1  [ = ]       0    ../../src/modules/commander/HealthAndArmingChecks/checks/externalChecks.cpp
  +0.1%     +13  [ = ]       0    ../../src/modules/commander/failure_detector/FailureDetector.cpp
  -0.3%     -15  [ = ]       0    ../../src/modules/flight_mode_manager/tasks/FlightTask/FlightTask.cpp
  +0.1%     +15  [ = ]       0    ../../src/modules/gyro_calibration/GyroCalibration.cpp
  +0.1%     +15  [ = ]       0    ../../src/modules/mag_bias_estimator/MagBiasEstimator.cpp
  -0.1%     -15  [ = ]       0    ../../src/modules/navigator/mission_base.cpp
  +0.1%     +15  [ = ]       0    ../../src/modules/navigator/rtl.cpp
  +0.1%     +75  [ = ]       0    ../../src/modules/sensors/vehicle_imu/VehicleIMU.cpp
  -0.1%     -15  [ = ]       0    ../../src/modules/sensors/vehicle_magnetometer/VehicleMagnetometer.cpp
  +0.1%     +15  [ = ]       0    ../../src/modules/sensors/vehicle_optical_flow/VehicleOpticalFlow.cpp
  -0.1%     -15  [ = ]       0    ../../src/modules/sensors/voted_sensors_update.cpp
 -100.0%     -34  [ = ]       0    [4 Others]
+0.0%    +143  [ = ]       0    .debug_ranges
  -0.4%     -56  [ = ]       0    ../../src/lib/parameters/parameters.cpp
  -2.6%      -8  [ = ]       0    ../../src/lib/version/version.c
  +2.1%    +208  [ = ]       0    ../../src/modules/commander/Commander.cpp
  -1.5%      -1  [ = ]       0    task/task_cancelpt.c
+0.1% +1.92Ki  [ = ]       0    .debug_str
  +0.1%     +17  [ = ]       0    ../../src/drivers/cdcacm_autostart/cdcacm_autostart.cpp
  +1.6% +1.92Ki  [ = ]       0    ../../src/modules/commander/Commander.cpp
  +0.0%     +12  [ = ]       0    ../../src/modules/navigator/navigator_main.cpp
  -0.0%     -21  [ = ]       0    src/modules/ekf2/modules__ekf2_unity.cpp
+0.0%    +112  [ = ]       0    .strtab
  -8.1%     -32  [ = ]       0    ../../src/lib/version/version.c
  +3.1%    +123  [ = ]       0    ../../src/modules/commander/Commander.cpp
  +0.0%     +21  [ = ]       0    [section .strtab]
+0.0%     +96  [ = ]       0    .symtab
  -7.0%     -64  [ = ]       0    ../../src/lib/version/version.c
  +1.7%     +80  [ = ]       0    ../../src/modules/commander/Commander.cpp
  +0.3%     +16  [ = ]       0    ../../src/modules/fw_pos_control/FixedwingPositionControl.cpp
  +0.1%     +64  [ = ]       0    [section .symtab]
-0.3%    -224  [ = ]       0    [Unmapped]
+0.0% +6.67Ki  +0.0%    +224    TOTAL

Updated: 2025-01-10T14:07:40

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant