196 Commits

Author SHA1 Message Date
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
bresch
1f4b2d1d53 Commander: replace deprecated warnx by PX4_WARN 2020-03-23 13:45:00 +01:00
bresch
c23ef0af4b Flight termination: lockdown if failure is detected on takeoff
During the first few seconds after takeoff, the failure detector is allowed to
trigger motor lockdown.
This is done for safety reasons to detect tipping-over or unstable
tuning gains
2020-03-23 13:45:00 +01:00
Lorenz Meier
9275937b44 Commander: Exclude shell commands for constrained flash
These are convenience commands for developers and are not required for flash constrained targets.
2020-03-17 00:17:11 +01:00
Lorenz Meier
aea68f06f9 Commander: Streamline preflight and arming checks
The checks did previously only report the first failure (to not overload the radio link). As we are moving to buffered messages and higher bandwidth links this design choice is not any more in the best interest of the drone operator. We are now reporting all detected failures. To ensure architectural consistency more checks have been moved from the commander mainloop into the respective classes.
2020-03-17 00:17:11 +01:00
Lorenz Meier
bf3b55cac7 Commander: Add function to print health flags consistently
This enables us to have better situational awareness during development and when inspecting a system in the field as to which subsystem is currently faulty. These flags are from standard MAVLink and are not sufficient nor do they match well the actual critical path to a safe flight. This will be addressed in a second step with the addition of a new MAVLink message and new flags.
2020-03-17 00:17:11 +01:00
Lorenz Meier
9d5aebd235 Commander: Run continuous pre-flight checks silently
As we are checking the current pre-flight state and validate wether the system could be armed, we do not want to spam the console or user with continously failing checks. These checks are reported to the GCS separately and are processed and displayed there.
2020-03-17 00:17:11 +01:00
Lorenz Meier
21435bd32b Report preflight and pre-arm checks from period checks
With this change we are reporting any issues we find with the periodic check.

Co-Authored-By: Beat Küng <beat-kueng@gmx.net>
2020-03-17 00:17:11 +01:00
Lorenz Meier
ed0a01d5da Commander: Add reporting of preflight and prearming state
This is essential for the operator to know if the system is ready to fly.
2020-03-17 00:17:11 +01:00
Daniel Agar
0eca583ecf sensors: move baro aggregation to new sensors/vehicle_air_data 2020-03-12 19:06:34 -04:00
Daniel Agar
5d33b9e999
delete Outback Challenge (OBC) AUTO_RTGS (datalink loss) and AUTO_RCRECOVER (rc loss) 2020-03-11 22:45:55 -04:00
Daniel Agar
9585055e9e
uORB: add bitset for faster orb_exists check and remove uORB::Subscription lazy subscribe hack/optimization
- add PX4 bitset and atomic_bitset with testing
 - add uORB::Subscription constructor to take ORB_ID enum
 - move orb test messages into msg/
2020-03-11 09:06:33 -04:00
Julian Oes
874c6f385b commander: unify offboard timeouts
The implementation before this change had two timeouts, a hard-coded
timeout of 0.5 seconds as well as a by param configurable timeout with
certain failsafe actions set.

This change aims to fix two problems:
1. The hard-coded offboard timeout can be triggered easily with sped up
   lockstep simulation. Since i t is hard-coded it can't be adapted to
   the speed factor.
2. The offboard signal can time out but no action will be taken just
   yet. This means we end up in an in-between stage where no warning or
   failsafe action has happened yet, even though certain flags are set
   to a timeout state.

This patch aims to fix this by unifying the two timeouts to the existing
configurable param. The convoluted double timeout logic is replaced by a
simple hysteresis.

For anyone that has previously not changed the default timeout param (0),
the param will now be changed to 0.5 seconds which reflects the
previously hardcoded time. For anyone with a specific timeout
configured, the behaviour should remain the same.

Also, going forward, timeouts lower than 0.5 seconds should be possible.
2020-03-04 09:35:14 +01:00
Julian Kent
e173df80a1 Improve readibility of ternary 2020-03-02 18:10:52 +01:00
Martina Rivizzigno
aee1e70642 check avoidance status in commander and set sys status
remove mavlink log
2020-03-02 16:49:56 +01:00
Matthias Grob
46f76cb621 Commander: enable RC override in takeoff
and remaining auto modes which are used more rarely.
2020-02-26 10:22:33 +01:00
Timothy Scott
4c1adc088f Removed all swapping of uORB instances 2020-02-21 22:38:26 -08:00
Timothy Scott
6452b7e014 Changed commander to check every battery publication for prearm checks 2020-02-21 22:38:26 -08:00
Matthias Grob
1d89351149 Commander: clarify the rc override message
Message says novice understanable what happened.
2020-02-20 17:25:53 +01:00
Beat Küng
116a094e31 commander: fix broken 'commander arm/disarm' CLI
Regression from https://github.com/PX4/Firmware/pull/13613.

VEHICLE_CMD_COMPONENT_ARM_DISARM from CLI would enter the
ARMING_STATE_IN_AIR_RESTORE logic. This was never intended for disarming
(and leads to state machine transition failures), and IMO it is also not
intended for commands from CLI.
2020-02-20 10:06:07 -05:00
Nicolas de Palezieux
a570aa9fac Commander: fix preflight check condition to fail if not in HIL mode 2020-02-20 08:46:30 +01:00
Silvan Fuhrer
4fa64f686a pre arm check: add circuit breaker for the VTOL arming in fixed-wing mode prevention
Added a new circuit breaker that, if set, enables arming in fixed-wing mode for VTOLs.

Signed-off-by: Silvan Fuhrer <silvan@auterion.com>
2020-01-28 00:30:24 +01:00
Daniel Agar
3545ba97ca commander: don't run preflightCheck during calibration on reconnect 2020-01-27 09:10:22 +01:00
Beat Küng
db49e5abcd fix commander: run preflight checks on GCS connection
Regression from 6dec451babf1b4c6394fbf8678585d66932adefb, leading to
preflight failures not being reported at all. Only after a failed arming
attempt the messages would be sent. And for GPS check failures, in case
they are set to optional (default), arming would be possible, but switching
to position would be rejected w/o error.

We need to run the preflight checks periodically, but this at least restores
the previous behavior.
2020-01-25 11:17:33 +01:00
Beat Küng
9e7dcd4b06 commander: fix prearm flag to preflightCheck
This was inverted, i.e. set to false in most cases, whereas it should be
true.

As a consequence, both powerCheck and airspeed.confidence checks were not
executed.
2020-01-25 11:17:33 +01:00
Beat Küng
db36edffe8 commander: fix mission topic publication
The local scope caused the topic to be unadvertised, which in turn caused
a copy() failure in navigator and 'mission update failed' printf error.
2020-01-22 12:08:32 -05:00
Beat Küng
c61e44f55b commander: fix variable naming 2020-01-22 12:07:51 -05:00
Beat Küng
8bfbfa033c fix commander: avoid LED printf errors on every SITL startup 2020-01-22 12:07:51 -05:00
Daniel Agar
cf195b0755 commander: safety button disarm require land detector
- landed, maybe_landed, or ground_contact required before the safety
button is able to disarm
 - this reduces the risk of a faulty safety button triggering in regular
flight
2020-01-21 23:35:25 +01:00
Daniel Agar
4f868fc565 commander: use arm_disarm() helper for safety button disarm 2020-01-21 23:35:25 +01:00
Claudio Micheli
288725684c Commander: remove variable duplication for geofence and rc override
Signed-off-by: Claudio Micheli <claudio@auterion.com>
2020-01-14 22:54:16 +01:00
Tal Zaitsev
d54ab5f6eb Change RC override to affect offboard mode as well
-Defines COM_RC_OVERRIDE as a bitmask
-Changes RC override to affect auto modes, offboard mode, or both
2020-01-09 18:26:39 +01:00
tzai
fee7f69d63 commander: fix regression issue preventing RC override from working
Boolean variable name was refactored to represent the opposite state
without a change in logic.
2020-01-09 18:26:39 +01:00
CarlOlsson
13a9b552c5 Remove unused GPS fail circuit breaker
Signed-off-by: CarlOlsson <carlolsson.co@gmail.com>
2020-01-08 10:50:26 -05:00
Daniel Agar
0e70578052
commander: move most static variables and parameters to class 2019-12-23 23:38:10 -05:00