230 Commits

Author SHA1 Message Date
Daniel Agar
8d1b99be31
mavlink: telemetry status only log simple HEARTBEAT validity
* delete telemetry_heartbeat msg
 * delete unused _telemetry_status_mutex
2020-10-13 13:37:10 -04:00
Beat Küng
274ccaf57c system: include shutdown lock to BOARD_INDICATE_ARMED_STATE
BOARD_INDICATE_ARMED_STATE was only set during arming, so an external
component might have reset the board during param save, leading to param
loss.

This extends the API to trigger the arming state also while the shutdown
lock is taken.
2020-10-09 08:23:47 +02:00
Daniel Agar
08bf71b73d
drivers/tone_alarm and tune_control small improvements/cleanup
- drivers/tone_alarm: move to ModuleBase and purge CDev (/dev/tone_alarm0)
 - drivers/tone_alarm: only run on tune_control publication (or scheduled note) rather than continuously
 - drivers/tone_alarm: use HRT to schedule tone stop (prevents potential disruption)
 - msg/tune_control: add tune_id numbering
 - systemcmds/tune_control: add "error" special case tune_id
 - move all tune_control publication to new uORB::PublicationQueued<>
 - start tone_alarm immediately after board defaults are loaded to fix potential startup issues
 - for SITL (or other boards with no TONE output) print common messages (startup, error, etc)
2020-10-05 21:39:26 -04:00
Nicolas MARTIN
967f741a0e
commander: add parameter COM_REARM_GRACE to optionally disable re-arming grace period 2020-10-01 11:20:08 -04:00
Julian Oes
b454095776 commander: fix switch to loiter
Sometimes, the mission_result timestamp is the same as the
internal_state timestamp which would meant that we would not switch to
LOITER even though the takeoff is clearly done at that point.
2020-09-30 08:23:16 -04:00
Daniel Agar
2ccf664e95 commander: disarm from safety relax land detector timeout
- ensure land detector is updated before safety is checked
2020-09-25 09:41:53 -04:00
Matthias Grob
5d47a4c9e0
Commander: fix rc override threshold scaling (#15807)
Improve parameter description for threshold
and lower the threshold a bit.
2020-09-24 14:52:19 +02:00
Julian Oes
a9c4f269bd simulator: use failure injection to block GPS
This uses the new failure injection system using vehicle_commands
instead of specific parameters. For now it implements GPS only.
2020-09-16 12:51:56 -04:00
Matthias Grob
5eba25d2b5 Commander: remove duplicate flag changes 2020-09-08 11:42:30 +02:00
Matthias Grob
390edb770d Commander: separate failure detector cases
One case could lead to the action for the other!
2020-09-08 11:42:30 +02:00
Matthias Grob
c9b81eaf08 FailureDetector: simplify updated/changed check 2020-09-08 11:42:30 +02:00
Matthias Grob
25cdb383c6 Commander: simplify main failure detector condition 2020-09-08 11:42:30 +02:00
Daniel Agar
ca9b6bc137
commander: quick mag cal with fixed heading use MAV_CMD_FIXED_MAG_CAL_YAW message
- use proper Mavlink MAV_CMD_FIXED_MAG_CAL_YAW command for initiating magnetometer quick cal
 - MAV_CMD_FIXED_MAG_CAL_YAW allows specifying the yaw and optionally latitude and longitude if the vehicle doesn't have GPS
2020-09-06 19:25:11 -04:00
Daniel Agar
1ac31100cc
commander: HITL skip auto disarm if lockdown
- auto disarm when locked down was added in #14766 to prevent user confusion in regular usage, but also breaks HITL where lockdown is enabled for safety
 - fixes #15686
2020-09-06 18:38:05 -04:00
Daniel Agar
6ff361479c
uORB: introduce SubscriptionMultiArray for working with multi-instances 2020-09-02 12:46:47 -04:00
Daniel Agar
c76cdaf8a8 commander: mag calibration add simple offset only quick cal using GPS & attitude 2020-08-21 10:12:13 -04:00
Daniel Agar
f6ad9bdb64 commander: don't set RC lost during calibration 2020-08-21 10:12:13 -04:00
Daniel Agar
e6fd5a43bc commander: magnetometer calibration automatically set the rotation of external magnetometers relative to the first internal
- see #15120 for more detail
2020-08-21 10:12:13 -04:00
Daniel Agar
d92ddffa5d commander: add simple accelerometer quick calibration 2020-08-21 10:12:13 -04:00
Daniel Agar
e3e8c55e82 accel & gyro calibration helpers 2020-08-21 10:12:13 -04:00
Julian Kent
7958586f35 Only use roll/pitch not centered for RC override, and increase override threshold 2020-08-20 11:50:16 -04:00
Daniel Agar
97fc1db768 vehicle_local_position: rename yaw -> heading and add reset logic
- vehicle_global_position yaw removed (redundant)
2020-08-10 11:42:03 +02:00
bresch
33fb9d0c62 Commander: update home position yaw in case of EKF yaw reset
This makes sure the drone lands in the correct orientation
during RTL even if the initial yaw at takeoff was wrong.
2020-08-10 11:42:03 +02:00
Daniel Agar
3002e74b4f
mavlink: publish telemetry_status per instance with all HEARTBEATS from the same system
- one telemetry_status publication per mavlink instance
 - each telemetry_status has an array of HEARTBEATS
2020-08-07 12:23:52 -04:00
Beat Küng
dfc2160489 commander: update vehicle_status with at least 2Hz
So we're sure it's logged.
2020-08-04 10:53:20 -04:00
Beat Küng
5f8c6512b3 vehicle_status: add latest arming/disarming reason
Makes it easier to debug.
2020-08-04 10:53:20 -04:00
Daniel Agar
c40cf9a626
uORB: remove lost message count per DeviceNode
- update 'uorb status' to print basic info for all advertised DeviceNodes
 - report vehicle_command gaps in commander, navigator, mavlink
2020-08-04 10:34:11 -04:00
Daniel Agar
f5f2897486
land_detector: multicopter ground contact fixes, improvements, and cleanup
- if "landed" and "maybe_landed" states are false then both the "hit_ground" and the "low_thrust" condition need to be true in order to detect landing
 - ground contact MC NAN setpoint workaround
 - ground contact additionally check acceleration setpoint
 - schedule with vehicle_local_position updates (most updates require valid local position)
 - don't allow LNDMC_Z_VEL_MAX to exceed MPC_LAND_SPEED
 - ground contact horizontal movement checks default to failed if estimates aren't available
2020-08-02 13:37:23 -04:00
Matthias Grob
40883a06cf Commader: save 53 unnecessary characters of output string 2020-07-13 10:34:17 -04:00
daniele
f01195c13f make kill switch engaged a warning only if the vehicle is flying 2020-07-13 10:34:17 -04:00
daniele
be043d24a0 commander: rephrase or change message importance for some errors/warnings that happen often 2020-07-13 10:34:17 -04:00
Thomas Stauber
6d1ce57362
Add Land as Geofence Action 2020-07-09 10:32:10 -04:00
Claudio Micheli
743898d574 Commander: failure detector, automatically disarm on a ESC failure
Signed-off-by: Claudio Micheli <claudio@auterion.com>
2020-07-01 08:55:54 +02:00
Claudio Micheli
a7f2f2908b Commander: make optional tilt-check after takeoff (failure detector).
- Introduced COM_LKDOWN_TKO parameter
    - Introduced auto disarm for lockdown state
    - Do not trigger flight termiantion if system is in lockdown

Signed-off-by: Claudio Micheli <claudio@auterion.com>
2020-07-01 08:55:54 +02:00
Claudio Micheli
6358dd400a failure detector: added esc failures detection
Signed-off-by: Claudio Micheli <claudio@auterion.com>
2020-07-01 08:55:54 +02:00
Matthias Grob
e9eae1bd76 Refactor: Name manual_control_setpoint the same way everywhere 2020-06-22 12:06:27 -04:00
Daniel Agar
ade8a13203 commander: CMD_COMPONENT_ARM_DISARM don't block disarm if maybe_landed 2020-05-25 11:43:14 -04:00
Daniel Agar
05886e053f mavlink_log_info: always print to console and merge with mavlink_and_console_log_info 2020-05-12 08:53:51 +02:00
Daniel Agar
10b289b43c commander: only report manual control lost if found once 2020-05-06 13:53:54 -04:00
Daniel Agar
7bb256f4b7 commander: skip continuous preflight check if calibrating 2020-05-06 13:53:54 -04:00
Daniel Agar
6705ac3e3b commander: reject PREFLIGHT_CALIBRATION and PREFLIGHT_STORAGE if armed or shutting down 2020-05-06 13:53:54 -04:00
Daniel Agar
04113b4d57 commander: changes when USB connected
- skip avionics rail voltage check when USB connected
 - skip forced reboot on USB disconnect if circuit breaker set
 - avionics voltage preflight check don't silently fail if system_power unavailble
     - explicitly set supply check circuit breaker (CBRK_SUPPLY_CHK)
2020-05-06 13:53:54 -04:00
Daniel Agar
746a8f5cf9 commander: reboot/shutdown usability fixes
- always check with state machine before reboot/shutdown
 - respect BOARD_HAS_POWER_CONTROL (shutdown from command, low battery, power button)
 - px4_shutdown_request add optional delay and always execute from HPWORK
 - px4_shutdown_request split out px4_reboot_request
2020-05-06 13:53:54 -04:00
Lorenz Meier
18e78261ab Commander: Add more documentation around USB reboots
If the user disconnects USB we reboot the system to bring it back into a nominal condition before arming. Otherwise we would either have the USB stack running without a cable connected (code running for no reason, which is violating the principle of not running unnecessary code in aviation). Or we would not allow to arm at all if USB was ever connected, which can be confusing if the system is powered off a battery.
2020-04-08 14:11:09 -04:00
Beat Küng
6b0a2649c0 commander: set home position on takeoff
instead of when arming and on takeoff.

It is set on the first takeoff or if there was a disarm event between the
last and the current takeoff.
2020-04-08 14:59:26 +02:00
Beat Küng
80f0892de5 fix commander: set _was_landed before _land_detector topic update
Before _was_landed was set to the same value as the current
_land_detector.landed, thus outside of the update condition,
_was_landed && !_land_detector.landed could never be true.

This affects setting the home position, which is now set upon arming AND
upon takeoff.
2020-04-08 14:59:26 +02:00
Beat Küng
aa6f9280e1 fix commander: set _have_taken_off_since_arming when !landed upon arming
If arming and already !landed, _have_taken_off_since_arming will not be set
and thus auto-disarm after 10s will be triggered (with default config).

This can only happen due to quick state changes, as land detector generally
sets landed=true if !armed.
2020-04-08 14:59:26 +02:00
Julian Oes
f650b91718 battery: check source param inside battery lib
This moves the handling of the BAT%d_SOURCE param inside of the battery
library. Users of the library now pass the source instead of the flag
whether to publish. The battery library then checks if the source is
selected using the param and publishes accordingly.

Since we removed the strange system_source flag, we now need to look at
all batteries in commander.
For current estimation - I think - it makes sense to sum them up.
2020-04-06 15:56:54 +02:00
Beat Küng
1f60a86d32 fix commander: need to copy all battery states in a cycle
Previously if in a cycle only a disconnected battery status updated, the
battery health state would switch to unhealthy during that time.

Fixes intermittent 'Arming denied! Check battery' preflight failures on
v5x with 1 power module connected.
2020-04-02 12:42:00 +02:00
David Jablonski
6bd191a24e Mavlink: Implemented SET_CAMERA_ZOOM 2020-03-30 17:10:36 +02:00