2626 Commits

Author SHA1 Message Date
Silvan Fuhrer
6d84da5cf1 Commander: add max flight time warning (starting at 90%)
Signed-off-by: Silvan Fuhrer <silvan@auterion.com>
2023-02-01 08:48:09 +01:00
Beat Küng
b1709743f7 commander: add wind or flight time limit exceeded mode requirement
This prevents switching into any of these modes once the condition is set.
2023-02-01 08:48:09 +01:00
Beat Küng
a8628c9d9c fix commander: clear takeoff_time only on disarm
Otherwise the flight time restriction flag gets cleared too early, before
disarming (which puts the vehicle into the previous mode and it might
take off again).
2023-02-01 08:48:09 +01:00
Beat Küng
8e4c5884ec fix commander: need to check for valid mode change even if already the same
Fixes the following case:
- user intention set to X
- failsafe triggers, mode = Y
- can_run for X becomes false
- user tries to switch to X
  -> need to re-evaluate can_run
2023-02-01 08:48:09 +01:00
Beat Küng
7988491e37 failsafe simulator: improve spacing for multi-line checkboxes
Reduces line-height to 100% in that case.
2023-02-01 08:48:09 +01:00
Hamish Willee
f25abbc80a Fix magnetometer typo 2023-01-30 10:24:16 +01:00
Silvan Fuhrer
a210c96aa9 Commander: ssimplify error messages for LOITER rejection
Signed-off-by: Silvan Fuhrer <silvan@auterion.com>
2023-01-25 16:40:27 +01:00
Silvan Fuhrer
148ffe4e25 add support for DO_CHANGE_ALTITUDE
Do the same as DO_REPOSITION wit only the altitude field populated
and MAV_DO_REPOSITION_FLAGS set, which means:
- switch to Loiter mode if not already in it
- set the current altitude to what is specified in the altitdue field,
keep current altitude setpoint otherwise
- keep current position setpoint
- fall back to current estimated position in case a position setpoint
is not finite

Signed-off-by: Silvan Fuhrer <silvan@auterion.com>
2023-01-25 16:40:27 +01:00
Daniel Agar
bd9d09663f
commander: avoid uint64 timestamp implicit float conversions
- 64 bit time in microseconds stored in a 32 bit float quickly becomes problematic
 - fixes https://github.com/PX4/PX4-Autopilot/issues/20944
2023-01-19 17:48:40 -05:00
Silvan Fuhrer
623c1418bb Commander: improve messaging for vtol fixed-wing system failure arming check
Signed-off-by: Silvan Fuhrer <silvan@auterion.com>
2023-01-13 19:02:21 +03:00
Silvan Fuhrer
303b879748 VTOL/Commander: rename transition_failsafe to vtol_fixed_wing_system_failure
Signed-off-by: Silvan Fuhrer <silvan@auterion.com>
2023-01-13 19:02:21 +03:00
bresch
3d50a7ce44 CAL_MAG_SIDES: do not save with factory cal 2023-01-13 10:48:01 -05:00
Mathieu Bresciani
767fcb2774
sensors: prefix mag config param SENS instead of CAL (#20723)
* sensors: prefix mag config param SENS instead of CAL
* mag sides: keep CAL_MAG_SIDES required by QGC
2023-01-12 09:42:36 -05:00
Silvan Fuhrer
bc9abf8c36 Commander: always update parameters, not just if disarmed
Signed-off-by: Silvan Fuhrer <silvan@auterion.com>
2023-01-11 10:01:08 +01:00
murata,katsutoshi
d821404e4f
commander: failsafe define enums for actions (#20880) 2023-01-07 10:10:57 -05:00
Beat Küng
5217bedd4b commander: make SYS_HAS_MAG a count param and ensure system has N calibrated + enabled mags 2022-12-14 07:55:04 +01:00
Thomas Stastny
c5dc1221b6 failure detector: use multiplication instead of division
Co-authored-by: Daniel Agar <daniel@agar.ca>
2022-11-30 14:51:07 -05:00
Thomas Stastny
4e8381e8cf failure detector: negative guard sqrt in std dev calc 2022-11-30 14:51:07 -05:00
Thomas Stastny
eb80e0410c failure detector: fix imbalanced prop metric time interval 2022-11-30 14:51:07 -05:00
Matthias Grob
331cb21dee manual_control_setpoint: change stick axes naming
In review it was requested to have a different name for
manual_control_setpoint.z because of the adjusted range.

I started to investigate what naming is most intuitive and found
that most people recognize the stick axes as roll, pitch, yaw, throttle.
It comes at no surprise because other autopilots
and APIs seem to share this convention.

While changing the code I realized that even within the code base
the axes are usually assigned to a variable with that name or
have comments next to the assignment clarifying the axes
using these names.
2022-11-28 19:25:55 +01:00
Matthias Grob
83246c84cf Switch manual_control_setpoint.z scaling from [0,1] to [-1,1]
To be consistent with all other axes of stick input and avoid future
rescaling confusion.

Note: for the MAVLink message 69 MANUAL_CONTROL it's using the full range
according to the message specs now [-1000,1000].
2022-11-28 19:25:55 +01:00
Matthias Grob
fbe5024fa8 commander_params: remove deprecated COM_RCL_ACT_T
It's now covered with COM_FAIL_ACT_T
2022-11-16 08:11:09 +01:00
Silvan Fuhrer
c04a67401e Remove some @decimal and @increment from integer parameters
Signed-off-by: Silvan Fuhrer <silvan@auterion.com>
2022-11-14 16:25:46 +01:00
Matthias Grob
30d74f124d commander_params: make disarm timeouts more explicit decimals
of 100ms increment
2022-11-14 16:25:46 +01:00
Silvan Fuhrer
464a7fcbed Commander params: add @decimal to COM_SPOOLUP_TIME
Signed-off-by: Silvan Fuhrer <silvan@auterion.com>
2022-11-14 16:25:46 +01:00
Beat Küng
640f9cc801 commander: fix initialization order of _failsafe_flags
In this case it did not cause any problems.
Fixes a compiler warning:
/src/modules/commander/HealthAndArmingChecks/HealthAndArmingChecks.cpp:39:21: error: member ‘HealthAndArmingChecks::_failsafe_flags’ is used uninitialized [-Werror=uninitialized]
   39 |           _reporter(_failsafe_flags)
      |                     ^~~~~~~~~~~~~~~
2022-11-14 11:27:23 +01:00
Thomas Stastny
6b9d86680b commander: fix hold after mission logic
previous change in logic to hold after mission clear also broke rtl, as non-mission takeoff still published a mission result which allowed entering the mission finished condition and always changing state to loiter (ignoring rtl). new logic only switches navigation states if mission is finish and the nav state is explicitly in takeoff state, or in mission state
2022-11-10 16:17:18 +01:00
Thomas Stastny
6dad3a5150 commander: hold after mission clear 2022-11-10 12:08:05 +01:00
Damien SIX
9246d38667
commander: fix offboard disarm failsafe 2022-11-09 08:20:45 +01:00
Damien SIX
5910f8982a fix warning (mavlink): connection to gcs 2022-11-08 13:02:23 +01:00
Beat Küng
6511866408 fix commander: check that offboard_control_mode data is recent
This is a regression from https://github.com/PX4/PX4-Autopilot/pull/20172
2022-11-02 10:11:29 -04:00
Beat Küng
0996e5319f commander: add preflight check for hardfault files on SD card 2022-11-02 09:59:00 -04:00
JaeyoungLim
3f5d7f38cd
Handle waypoint altitude acceptance radius for boats (#20508)
This corrects the waypoint handling logic to include boat type vehicles
2022-10-31 09:13:13 +01:00
Daniel Agar
c32cf21b63 commander: estimator check shorten messages
- otherwise these are awkwardly split in mavlink
2022-10-25 08:02:47 +02:00
Daniel Agar
a7b909234b commander: estimator nav test is not an arming check 2022-10-25 08:01:30 +02:00
Daniel Agar
fe80e7aa46
commander: respect COM_CPU_MAX for overload and adjust default threshold 2022-10-19 20:25:06 -04:00
Daniel Agar
309465858a
commander: elapsed time checks avoid subtracting unsigned integers
- avoid the possibility of unsigned underflow from subtracting two HRT timestamps (uint64_t)
 - most of these aren't problematic, but people tend to replicate the pattern, so it's better to be safe
 - likely wasn't a problem when people were using hrt_absolute_time() in place, but if using an existing timestamp there's the possibility it's older than a more recent topic update
2022-10-19 20:21:36 -04:00
Daniel Agar
cea185268e
msg ROS2 compatibility, microdds_client improvements (timesync, reduced code size, added topics, etc), fastrtps purge
- update all msgs to be directly compatible with ROS2
 - microdds_client improvements
   - timesync
   - reduced code size
   - add to most default builds if we can afford it
   - lots of other little changes
 - purge fastrtps (I tried to save this multiple times, but kept hitting roadblocks)
2022-10-19 19:36:47 -04:00
Daniel Agar
e211e0ca0e commander: limit some estimator checks to prearm 2022-10-19 19:06:56 -04:00
Matthias Grob
5ca28dd6dc Use isAllFinite() in all places that check finiteness on entire vectors or matrices 2022-10-19 19:09:20 +02:00
Beat Küng
3c290d812d commander: use printRejectMode() also for rtl, takeoff, land & mission commands 2022-10-13 16:05:25 -04:00
Beat Küng
d542ffc10c refactor vehicle_status_flags: rename to failsafe_flags 2022-10-13 16:05:25 -04:00
Beat Küng
f7819f5dba commander: reorder update calls
Moves the arming checks before the command handling.
This reduces the chance of race conditions. However it does not prevent
them! The SDK will need to check when offboard is ready to run/arm to fix
this.
Specifically this is for sitl offboard tests, where offboard_control_mode
is updated and immediately after a mode switch into offboard is commanded.
2022-10-11 22:31:20 -04:00
Beat Küng
38d3739b6d refactor commander: rename rc_signal_lost -> manual_control_signal_lost, data_link_lost -> gcs_connection_lost 2022-10-11 22:31:20 -04:00
Beat Küng
e2d8ca73a5 commander: add unit tests for failsafe state machine 2022-10-11 22:31:20 -04:00
Beat Küng
3d1da597dd commander: run arming checks on _offboard_control_mode_sub update 2022-10-11 22:31:20 -04:00
Beat Küng
acaa50a448 geofence: add and report reason for violation 2022-10-11 22:31:20 -04:00
mcsauder
ebc88afe46 Apply Google Style to Commander Private methods, rename geofence message geofence_violation to primary_geofence_breached. 2022-10-11 22:31:20 -04:00
Beat Küng
693af897b3 commander: check if battery was already disconnected on arming
If so, don't report.
Happens e.g. with USB powered pixhawk.
2022-10-11 22:31:20 -04:00
Beat Küng
24142bc014 commander: RcCalibrationChecks: avoid param access on each cycle
reduces cpu usage a bit
2022-10-11 22:31:20 -04:00