282 Commits

Author SHA1 Message Date
Matthias Grob
c16b48fd2c Commander: Replace manual_control_setpoint use 2021-03-04 10:41:21 +01:00
Matthias Grob
49c240f49e Commander: simplify rc arming disabling logic 2021-03-04 10:41:21 +01:00
Matthias Grob
37ea78a7ff Commander: move rc arming to ManualControl class
Separating the different arming methods is the next step.
2021-03-04 10:41:21 +01:00
Matthias Grob
ee2d408edc Commander: move rc availability to ManualControl 2021-03-04 10:41:21 +01:00
Matthias Grob
0e1f1a9f57 Commander: use parameters directly in ManualControl 2021-03-04 10:41:21 +01:00
Matthias Grob
dda895c94b Commander: split out rc override logic into ManualControl 2021-03-04 10:41:21 +01:00
Matthias Grob
a4da15edf5 Commander: RC override back to stick change
Instead of deflection mainly because:
- Spring loaded throttle -> bad user experience
- Stale RC data -> Vehicle not savable
2021-03-04 10:41:21 +01:00
Matthias Grob
3d87982bba Commander: reintroduce last stick position 2021-03-04 10:41:21 +01:00
Julian Kent
cdadfabccc Bring back RC throttle override with a parameter to disable it 2021-03-04 10:41:21 +01:00
Matthias Grob
c2151cb4fa Commander: remove unused arm mode command residue 2021-02-26 07:38:02 -05:00
Julian Oes
e6b1775bb6 vmount/navigator/mavlink: gimbal v2 changes
This is a collection of commits all having to do with changes in the
Mavlink gimbal v2 protocol as described in:
https://mavlink.io/en/services/gimbal_v2.html
2021-02-17 13:54:34 -05:00
Daniel Agar
5abf29d93c
commander: auto TAKEOFF to LOITER/MISSION minor fix to avoid failsafe confusion
- base on nav_state rather than main_state
2021-02-16 13:02:14 -05:00
Daniel Agar
0618f048f2
commander: use control mode flags and cleanup arm_disarm
- keep `vehicle_control_mode` last state in commander and use appropriate flags in place of various main_state and nav_state checks
 - consolidate scattered arming requirements in `arm_disarm()`
   - there were a number of different requirements from arming via RC vs Mavlink that don't make any sense
        - if geofence enabled require valid home before arming
        - throttle requirements for manual modes
 - remove unnecessary mavlink feedback that differs between arming interfaces (mavlink vs RC)
      - let the preflight/prearm checks respond directly in most cases 

Co-authored-by: Matthias Grob <maetugr@gmail.com>
2021-02-15 12:03:21 -05:00
bresch
9d3ff12a94 commander: reword nav failure message 2021-02-11 16:20:30 -05:00
bresch
5726e8e0a3 commander: do not fail nav check on GPS position glitch
In case of a diverge of the nav filter, both position and velocity test
ratios are large. If only one of them is too large, the nav filter is
most likely not diverging but is encountering a GNSS position reset and
it is still safe to fly in position mode.
2021-02-11 16:20:30 -05:00
bresch
b1b032d6e1 commander: rework nav failure check
Allows to recover from a failed test with a stricter test
2021-02-11 16:20:30 -05:00
Daniel Agar
6633ff5089 commander: vehicle_status_flags add attitude and angular velocity 2021-02-05 20:11:13 +01:00
Matthias Grob
b44b770972 commander: RC loss delay renaming/reordering 2021-02-04 10:54:52 +01:00
Matthias Grob
26d74bf57d Commander: enable failsafe delay for position and mission mode
Instead of directly doing the link loss reaction which by default is RTL a delay
can be configured such that the drone first switches to hold and waits
for the link to be regained.
2021-02-04 10:54:52 +01:00
Claudio Micheli
c2154df2f6 ekf2checks: split GPS checks from AHRS checks - minor cleanup
Signed-off-by: Claudio Micheli <claudio@auterion.com>
2021-02-01 09:02:19 +01:00
Daniel Agar
d1dfa26903 consume all available queued vehicle_commands 2021-01-26 12:00:18 -05:00
Julian Kent
af8d178ae5 Fix spurious RTL triggers
Two sources:
1. global to local conversion was sometimes giving issues, so do everything in global
2. on startup the RTL didn't check if the home position was valid before processing it
2021-01-18 16:26:53 +01:00
Julian Kent
7482413005 Add Range-based RTL 2021-01-18 16:26:53 +01:00
Jaeyoung-Lim
d2b0f63e1f Handle offboard mode with acceleration setpoints
The case when acceleration setpoints were being passed in offboard mode was triggering control_climbrate_mode. This prevented the vehicle from taking off, since it made the vehicle skip the rampup phase of the takeoff
This commit fixes this by handling the case properly
2021-01-06 20:38:18 +01:00
Lorenz Meier
4237c8be25 Commander: Do not acknowledge binding
This is now done in the respective modules directly and based on implementation and execution state.
2020-12-31 13:22:52 +01:00
Daniel Agar
49d4cc7d5b commander: CMD_NAV_LAND/CMD_NAV_PRECLAND reply RESULT_ACCEPTED unless transition is denied 2020-12-30 12:05:41 +01:00
Daniel Agar
91f5f26618 commander: main_state_transition call trivial style fixes 2020-12-30 00:26:14 +01:00
Nicolas MARTIN
e06d218ff2
commander: disable arm_auth request for prearm status continuous publication 2020-12-27 16:23:05 -05:00
Lorenz Meier
4b0d8efbc1 Commander: move static overload_start to class 2020-12-27 13:44:32 -05:00
Daniel Agar
336176b2f0 Mavlink FLIGHT_INFORMATION fix arming time (ms -> us) and add takeoff time
- fixes https://github.com/PX4/PX4-Autopilot/issues/16393
2020-12-16 09:38:05 -05:00
Daniel Agar
ae2b1a265c commander: POSCTL optical flow aiding continue updating GPOS validity
- updating the global position validity should happen regardless of
being in manual position control mode with only optical flow
 - condition_global_position_valid needs to be accurate to adjudicate
main state changes (eg going into AUTO MISSION)
2020-12-11 15:33:50 -05:00
Daniel Agar
6bda8af97c commander: merge duplicated position and velocity validity checks 2020-12-11 15:33:50 -05:00
Daniel Agar
5cd4a9c73f commander: global position validity respect local position xy_valid 2020-12-11 15:33:50 -05:00
Daniel Agar
ef6209ba03
new manual_control_switches msg (split out of manual_control_setpoint) (#16270)
- split out switches from manual_control_setpoint into new message manual_control_switches
 - manual_control_switches published at minimal rate (~ 1 Hz) or immediately on change
 - simple switch debounce in rc_update (2 consecutive identical decodes required)
 - manual_control_switches logged at full rate rather than sampled at (5-10% of messages logged)
 - manual_control_setpoint publish at minimal rate unless changing
 - commander handle landing gear switch for manual modes
 - processing of mode_slot and mode_switch is now split so we only do one or the other (not both)
     - a future step will be to finally drop mode_switch and accompanying switches entirely

Co-authored-by: Matthias Grob <maetugr@gmail.com>
2020-12-11 12:11:35 -05:00
Igor Campos
c316af6ec7 update to match new feature as a new mavlink command Oblique Survey 260 2020-12-09 17:54:53 +01:00
Daniel Agar
cd1ffa63cd
commander: auto transition to LOITER if disarmed with no RC only requires a valid global position 2020-12-08 18:26:03 -05:00
bresch
711bd2ce87 Commander: use helper to set home position 2020-12-07 10:24:23 -05:00
bresch
f3e5b86b06 Commander: set home position in air
en/dis-able in-air home position via parameter COM_HOME_IN_AIR
2020-12-07 10:24:23 -05:00
Daniel Agar
c305774fae commander: move vehicle_status into class 2020-12-02 10:20:50 +01:00
Daniel Agar
b7de10fca3 commander: move vehicle_status_flags to class 2020-12-02 10:20:50 +01:00
Daniel Agar
dc435c4c90 commander: control_status_leds() use _armed directly 2020-12-02 10:20:50 +01:00
Daniel Agar
8ac2581d7b commander: handle_command() use _armed directly 2020-12-02 10:20:50 +01:00
Daniel Agar
741a0b43e8 commander: move mavlink_log_pub into class 2020-12-02 10:20:50 +01:00
Daniel Agar
a03b91c01e commander: move answer_command() to class 2020-12-02 10:20:50 +01:00
Daniel Agar
d5dc7e2873 commander: move actuator_armed state into class 2020-12-02 10:20:50 +01:00
Beat Küng
05a3492174 commander: remove low priority thread, run tasks in a worker thread on demand
- removes race conditions
- removes dependencies on static data & methods
- reduces RAM usage by ~3.8KB
2020-11-30 11:53:22 -05:00
Beat Küng
419b336a15 commander: fix ModuleBase usage, remove volatile flag 2020-11-30 11:53:22 -05:00
Ricardo Marques
3215c50660 commander: Fix comment typos.
Signed-off-by: Ricardo Marques <marques.ricardo17@gmail.com>
2020-11-27 10:25:32 +01:00
Daniel Agar
ec9f8998a7
commander: limit mode switch re-evaluation logic on estimate validity changes
- re-evaluating mode switches on altitude or position validity change can create confusing when also relying on mode changes via mavlink
 - limiting this logic to only apply when disarmed solves the original problem (respecting initial switch position) without introducing potential problems mid-flight
 - fixes https://github.com/PX4/PX4-Autopilot/issues/16235
2020-11-25 21:14:55 -05:00
Daniel Agar
0f411d6820
Multi-EKF support (ekf2)
- ekf2 can now run in multi-instance mode (currently up to 9 instances)
    - in multi mode all estimates are published to alternate topics (eg estimator_attitude instead of vehicle_attitude)
 - new ekf2 selector runs in multi-instance mode to monitor and compare all instances, selecting a primary (eg N x estimator_attitude => vehicle_attitude)
 - sensors module accel & gyro inconsistency checks are now relative to the mean of all instances, rather than the current primary (when active ekf2 selector is responsible for choosing primary accel & gyro)
 - existing consumers of estimator_status must check estimator_selector_status to select current primary instance status
 - ekf2 single instance mode is still fully supported and the default

Co-authored-by: Paul Riseborough <gncsolns@gmail.com>
2020-10-27 10:56:11 -04:00