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

Introduce boat vehicle type #24310

Open
wants to merge 10 commits into
base: main
Choose a base branch
from
Open

Introduce boat vehicle type #24310

wants to merge 10 commits into from

Conversation

TomasTwardzik
Copy link

@TomasTwardzik TomasTwardzik commented Feb 10, 2025

Motivation

Decoupling boat and rover to exists as separate entities within Navigator and Commander modules. Despite similarities, this should lead to more legible, self documented code. In the future, this also allows to make changes separately, without risking introducing unwanted behavior to other platforms.

Discovered Problem

Rover can be armed with high throttle, which is a significant risk.

Solution

Both Rover and Boat now require throttle stick near center to be armed.

Changelog Entry

For release notes:
VehickeStatus.msg -> new vehicle type VEHICLE_TYPE_BOAT
Navigator module -> boat explicitely mimics rover behavior, instead of relying on vehicle_type being VEHICLE_TYPE_ROVER
Control Allocator's module.yaml -> Adding new airframe types for boats (Singe, Twin engine and Differential)
commander_helper -> adding distinct separation for boat and rover instead of generic ground vehicle
Commander -> adding method for throttle near center detection, adding, adding mission override for boats, adding dedicated arm checks for rover and boats

@TomasTwardzik TomasTwardzik marked this pull request as ready for review February 10, 2025 10:20
Copy link

github-actions bot commented Feb 10, 2025

🔎 FLASH Analysis

px4_fmu-v5x [Total VM Diff: 304 byte (0.01 %)]
    FILE SIZE        VM SIZE    
--------------  -------------- 
+0.0%    +304  +0.0%    +304    .text
  +0.1%    +111  +0.1%    +111    ROMFS/nsh_romfsimg.c
  +0.5%    +104  +0.5%    +104    ../../src/modules/commander/Commander.cpp
  +0.0%     +46  +0.0%     +46    [section .text]
  +2.4%     +28  +2.4%     +28    ../../src/modules/commander/commander_helper.cpp
  +0.1%      +4  +0.1%      +4    ../../src/modules/commander/accelerometer_calibration.cpp
  +0.2%      +4  +0.2%      +4    ../../src/modules/navigator/mission.cpp
  +0.1%      +4  +0.1%      +4    ../../src/modules/navigator/mission_block.cpp
  +0.2%      +3  +0.2%      +3    ../../src/systemcmds/ver/ver.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
  +7.4%     +16  [ = ]       0    ../../src/modules/commander/commander_helper.cpp
+0.0%     +28  [ = ]       0    .debug_frame
+0.0% +1.37Ki  [ = ]       0    .debug_info
  +0.0%     +13  [ = ]       0    ../../src/drivers/distance_sensor/lightware_laser_i2c/lightware_laser_i2c.cpp
  +0.0%     +13  [ = ]       0    ../../src/drivers/osd/msp_osd/msp_osd.cpp
  +0.0%     +13  [ = ]       0    ../../src/drivers/osd/msp_osd/uorb_to_msp.cpp
  +0.0%     +13  [ = ]       0    ../../src/drivers/px4io/px4io.cpp
  +0.0%     +13  [ = ]       0    ../../src/drivers/rc/crsf_rc/CrsfRc.cpp
  +0.0%     +13  [ = ]       0    ../../src/drivers/rc/dsm_rc/DsmRc.cpp
  +0.0%     +13  [ = ]       0    ../../src/drivers/rc_input/RCInput.cpp
  +0.0%     +13  [ = ]       0    ../../src/drivers/rc_input/crsf_telemetry.cpp
  +0.1%     +13  [ = ]       0    ../../src/drivers/telemetry/frsky_telemetry/frsky_data.cpp
  +0.1%     +13  [ = ]       0    ../../src/drivers/telemetry/frsky_telemetry/sPort_data.cpp
  +0.0%     +13  [ = ]       0    ../../src/drivers/uavcan/remoteid.cpp
  +0.0%     +13  [ = ]       0    ../../src/drivers/uavcan/uavcan_main.cpp
  +0.0%     +13  [ = ]       0    ../../src/lib/avoidance/ObstacleAvoidance.cpp
  +0.0%     +13  [ = ]       0    ../../src/lib/battery/battery.cpp
  -0.2%      -4  [ = ]       0    ../../src/lib/version/version.c
  +0.0%     +13  [ = ]       0    ../../src/modules/airspeed_selector/airspeed_selector_main.cpp
  +0.0%     +13  [ = ]       0    ../../src/modules/battery_status/analog_battery.cpp
  +0.0%     +79  [ = ]       0    ../../src/modules/commander/Commander.cpp
  +0.0%     +13  [ = ]       0    ../../src/modules/commander/HealthAndArmingChecks/HealthAndArmingChecks.cpp
  +0.0%     +13  [ = ]       0    ../../src/modules/commander/HealthAndArmingChecks/checks/accelerometerCheck.cpp
 -100.0% +1.07Ki  [ = ]       0    [76 Others]
+0.0%    +190  [ = ]       0    .debug_line
  -1.3%     -25  [ = ]       0    ../../src/lib/version/version.c
  +0.3%    +109  [ = ]       0    ../../src/modules/commander/Commander.cpp
  +2.3%     +56  [ = ]       0    ../../src/modules/commander/commander_helper.cpp
  +0.3%     +31  [ = ]       0    ../../src/modules/navigator/mission_block.cpp
  +0.1%     +19  [ = ]       0    ../../src/modules/navigator/navigator_main.cpp
+0.0%     +92  [ = ]       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_main.cpp
  +0.0%      +3  [ = ]       0    ../../src/drivers/uavcan/uavcan_servers.cpp
  +0.1%     +15  [ = ]       0    ../../src/lib/battery/battery.cpp
  +0.1%     +58  [ = ]       0    ../../src/modules/commander/Commander.cpp
  +0.0%      +1  [ = ]       0    ../../src/modules/commander/HealthAndArmingChecks/checks/externalChecks.cpp
  +0.0%     +15  [ = ]       0    ../../src/modules/commander/accelerometer_calibration.cpp
  +1.2%     +15  [ = ]       0    ../../src/modules/commander/airspeed_calibration.cpp
  -0.7%     -15  [ = ]       0    ../../src/modules/commander/baro_calibration.cpp
  +6.7%     +74  [ = ]       0    ../../src/modules/commander/commander_helper.cpp
  -0.1%     -15  [ = ]       0    ../../src/modules/commander/mag_calibration.cpp
  +0.0%     +15  [ = ]       0    ../../src/modules/flight_mode_manager/tasks/Auto/FlightTaskAuto.cpp
  +0.0%      +3  [ = ]       0    ../../src/modules/flight_mode_manager/tasks/AutoFollowTarget/FlightTaskAutoFollowTarget.cpp
  -0.1%     -15  [ = ]       0    ../../src/modules/fw_att_control/FixedwingAttitudeControl.cpp
  -0.0%     -16  [ = ]       0    ../../src/modules/fw_pos_control/FixedwingPositionControl.cpp
  +0.0%     +15  [ = ]       0    ../../src/modules/fw_rate_control/FixedwingRateControl.cpp
  -0.3%     -15  [ = ]       0    ../../src/modules/land_detector/FixedwingLandDetector.cpp
  -0.2%     -15  [ = ]       0    ../../src/modules/navigator/rtl_direct.cpp
  -0.2%     -15  [ = ]       0    ../../src/modules/vtol_att_control/vtol_att_control_main.cpp
 -100.0%      -3  [ = ]       0    [2 Others]
+0.0%      +9  [ = ]       0    .debug_ranges
  -2.6%      -8  [ = ]       0    ../../src/lib/version/version.c
  -0.1%      -8  [ = ]       0    ../../src/modules/commander/Commander.cpp
  +8.0%     +16  [ = ]       0    ../../src/modules/commander/commander_helper.cpp
  +0.4%      +8  [ = ]       0    ../../src/modules/navigator/mission_block.cpp
  +1.6%      +1  [ = ]       0    task/task_cancelpt.c
+0.0%    +135  [ = ]       0    .debug_str
  +0.3%     +18  [ = ]       0    ../../src/drivers/distance_sensor/lightware_laser_i2c/lightware_laser_i2c.cpp
  +0.1%    +117  [ = ]       0    ../../src/modules/commander/Commander.cpp
-1.4%      -3  [ = ]       0    .shstrtab
+0.0%     +75  [ = ]       0    .strtab
  -8.1%     -32  [ = ]       0    ../../src/lib/version/version.c
   +10%     +75  [ = ]       0    ../../src/modules/commander/commander_helper.cpp
  +0.0%     +32  [ = ]       0    [section .strtab]
+0.0%     +64  [ = ]       0    .symtab
  -7.0%     -64  [ = ]       0    ../../src/lib/version/version.c
  +4.7%     +64  [ = ]       0    ../../src/modules/commander/commander_helper.cpp
  +0.3%     +16  [ = ]       0    ../../src/modules/fw_pos_control/FixedwingPositionControl.cpp
  +0.1%     +48  [ = ]       0    [section .symtab]
-2.7%    -304  [ = ]       0    [Unmapped]
+0.0% +2.01Ki  +0.0%    +304    TOTAL

px4_fmu-v6x [Total VM Diff: 336 byte (0.02 %)]
    FILE SIZE        VM SIZE    
--------------  -------------- 
+0.0%    +336  +0.0%    +336    .text
  +0.1%    +155  +0.1%    +155    ROMFS/nsh_romfsimg.c
  +0.5%    +104  +0.5%    +104    ../../src/modules/commander/Commander.cpp
  +0.0%     +37  +0.0%     +37    [section .text]
  +2.4%     +28  +2.4%     +28    ../../src/modules/commander/commander_helper.cpp
  +0.1%      +4  +0.1%      +4    ../../src/modules/commander/accelerometer_calibration.cpp
  +0.2%      +4  +0.2%      +4    ../../src/modules/navigator/mission.cpp
  +0.1%      +4  +0.1%      +4    ../../src/modules/navigator/mission_block.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
  +7.4%     +16  [ = ]       0    ../../src/modules/commander/commander_helper.cpp
+0.0%     +28  [ = ]       0    .debug_frame
+0.0% +1.33Ki  [ = ]       0    .debug_info
  +0.0%     +13  [ = ]       0    ../../src/drivers/distance_sensor/lightware_laser_i2c/lightware_laser_i2c.cpp
  +0.0%     +13  [ = ]       0    ../../src/drivers/osd/msp_osd/msp_osd.cpp
  +0.0%     +13  [ = ]       0    ../../src/drivers/osd/msp_osd/uorb_to_msp.cpp
  +0.0%     +13  [ = ]       0    ../../src/drivers/px4io/px4io.cpp
  +0.0%     +13  [ = ]       0    ../../src/drivers/rc_input/RCInput.cpp
  +0.0%     +13  [ = ]       0    ../../src/drivers/rc_input/crsf_telemetry.cpp
  +0.0%     +13  [ = ]       0    ../../src/drivers/uavcan/remoteid.cpp
  +0.0%     +13  [ = ]       0    ../../src/drivers/uavcan/uavcan_main.cpp
  +0.0%     +13  [ = ]       0    ../../src/lib/avoidance/ObstacleAvoidance.cpp
  +0.0%     +13  [ = ]       0    ../../src/lib/battery/battery.cpp
  -0.2%      -4  [ = ]       0    ../../src/lib/version/version.c
  +0.0%     +13  [ = ]       0    ../../src/modules/airspeed_selector/airspeed_selector_main.cpp
  +0.0%     +13  [ = ]       0    ../../src/modules/battery_status/analog_battery.cpp
  +0.0%     +79  [ = ]       0    ../../src/modules/commander/Commander.cpp
  +0.0%     +13  [ = ]       0    ../../src/modules/commander/HealthAndArmingChecks/HealthAndArmingChecks.cpp
  +0.0%     +13  [ = ]       0    ../../src/modules/commander/HealthAndArmingChecks/checks/accelerometerCheck.cpp
  +0.0%     +13  [ = ]       0    ../../src/modules/commander/HealthAndArmingChecks/checks/airspeedCheck.cpp
  +0.0%     +13  [ = ]       0    ../../src/modules/commander/HealthAndArmingChecks/checks/armPermissionCheck.cpp
  +0.0%     +13  [ = ]       0    ../../src/modules/commander/HealthAndArmingChecks/checks/baroCheck.cpp
  +0.0%     +13  [ = ]       0    ../../src/modules/commander/HealthAndArmingChecks/checks/batteryCheck.cpp
 -100.0% +1.03Ki  [ = ]       0    [73 Others]
+0.0%    +189  [ = ]       0    .debug_line
  -1.3%     -25  [ = ]       0    ../../src/lib/version/version.c
  +0.3%    +109  [ = ]       0    ../../src/modules/commander/Commander.cpp
  +2.3%     +56  [ = ]       0    ../../src/modules/commander/commander_helper.cpp
  +0.3%     +31  [ = ]       0    ../../src/modules/navigator/mission_block.cpp
  +0.1%     +19  [ = ]       0    ../../src/modules/navigator/navigator_main.cpp
  -0.1%      -1  [ = ]       0    task/task_cancelpt.c
-0.0%     -79  [ = ]       0    .debug_loc
  -0.0%     -15  [ = ]       0    ../../src/drivers/uavcan/uavcan_main.cpp
  +0.0%     +14  [ = ]       0    ../../src/drivers/uavcan/uavcan_servers.cpp
  +0.1%     +43  [ = ]       0    ../../src/modules/commander/Commander.cpp
  -0.2%     -15  [ = ]       0    ../../src/modules/commander/HealthAndArmingChecks/checks/batteryCheck.cpp
  -1.2%     -15  [ = ]       0    ../../src/modules/commander/airspeed_calibration.cpp
  +0.7%     +15  [ = ]       0    ../../src/modules/commander/baro_calibration.cpp
  +6.7%     +74  [ = ]       0    ../../src/modules/commander/commander_helper.cpp
  +0.1%     +15  [ = ]       0    ../../src/modules/commander/mag_calibration.cpp
  -0.2%     -15  [ = ]       0    ../../src/modules/flight_mode_manager/FlightModeManager.cpp
  -0.0%     -16  [ = ]       0    ../../src/modules/flight_mode_manager/tasks/AutoFollowTarget/FlightTaskAutoFollowTarget.cpp
  -0.0%     -16  [ = ]       0    ../../src/modules/fw_autotune_attitude_control/fw_autotune_attitude_control.cpp
  -0.0%     -15  [ = ]       0    ../../src/modules/fw_pos_control/FixedwingPositionControl.cpp
  -0.1%     -15  [ = ]       0    ../../src/modules/navigator/mission_base.cpp
  -0.1%     -15  [ = ]       0    ../../src/modules/navigator/rtl.cpp
  -0.2%     -15  [ = ]       0    ../../src/modules/navigator/rtl_direct_mission_land.cpp
  -0.0%     -66  [ = ]       0    [section .debug_loc]
  -0.0%     -22  [ = ]       0    src/modules/ekf2/modules__ekf2_unity.cpp
+0.0%      +8  [ = ]       0    .debug_ranges
  -2.6%      -8  [ = ]       0    ../../src/lib/version/version.c
  -0.1%      -8  [ = ]       0    ../../src/modules/commander/Commander.cpp
  +8.0%     +16  [ = ]       0    ../../src/modules/commander/commander_helper.cpp
  +0.4%      +8  [ = ]       0    ../../src/modules/navigator/mission_block.cpp
+0.0%    +135  [ = ]       0    .debug_str
  +0.3%     +18  [ = ]       0    ../../src/drivers/distance_sensor/lightware_laser_i2c/lightware_laser_i2c.cpp
  +0.1%    +117  [ = ]       0    ../../src/modules/commander/Commander.cpp
+0.0%     +64  [ = ]       0    .strtab
  -8.1%     -32  [ = ]       0    ../../src/lib/version/version.c
   +10%     +75  [ = ]       0    ../../src/modules/commander/commander_helper.cpp
  +0.0%     +21  [ = ]       0    [section .strtab]
+0.0%     +64  [ = ]       0    .symtab
  -7.0%     -64  [ = ]       0    ../../src/lib/version/version.c
  +4.7%     +64  [ = ]       0    ../../src/modules/commander/commander_helper.cpp
  +0.3%     +16  [ = ]       0    ../../src/modules/fw_pos_control/FixedwingPositionControl.cpp
  +0.1%     +48  [ = ]       0    [section .symtab]
-0.5%    -336  [ = ]       0    [Unmapped]
+0.0% +1.79Ki  +0.0%    +336    TOTAL

Updated: 2025-02-12T10:15:53

@sfuhrer sfuhrer self-requested a review February 10, 2025 12:39
@Pedro-Roque Pedro-Roque requested a review from MaEtUgR February 10, 2025 22:17
@Pedro-Roque
Copy link
Member

@TomasTwardzik can you update with latest main changes through rebase?

@MaEtUgR do these changes require further action on the rover type?

@sfuhrer sfuhrer changed the title Pr_boat_decoupling Introduce boat vehicle type Feb 19, 2025
@@ -94,6 +94,7 @@ uint8 VEHICLE_TYPE_ROTARY_WING = 1
uint8 VEHICLE_TYPE_FIXED_WING = 2
uint8 VEHICLE_TYPE_ROVER = 3
uint8 VEHICLE_TYPE_AIRSHIP = 4
uint8 VEHICLE_TYPE_BOAT = 5
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Before we introduce the new type type here, let's discuss the meaning of this field, see #24367

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree with the points made. As is it currently stands, the code is a bit confusing what is what and these changes should clear it up.

Copy link
Contributor

@sfuhrer sfuhrer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for kicking off this discussion!

@DronecodeBot
Copy link

This pull request has been mentioned on Discussion Forum for PX4, Pixhawk, QGroundControl, MAVSDK, MAVLink. There might be relevant details there:

https://discuss.px4.io/t/px4-sync-q-a-feb-19-2025/43827/1

@Pedro-Roque Pedro-Roque mentioned this pull request Feb 19, 2025
30 tasks
@sfuhrer
Copy link
Contributor

sfuhrer commented Mar 4, 2025

@TomasTwardzik please rebase on main (e.g. #24367 came in now), and remove the CA_* params for now (until boat controllers are added).

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.

5 participants