182 Commits

Author SHA1 Message Date
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
Matthias Grob
de95e3d274 commander: remove manual mode before geofence handling 2019-12-23 12:18:27 -05:00
David
020215f146 commander: don't allow arming during VTOL transition 2019-12-17 12:21:11 -08:00
RomanBapst
133a6e38cc commander: make battery warning state sticky while armed
Signed-off-by: RomanBapst <bapstroman@gmail.com>
2019-11-29 10:23:08 +03:00
daniele
07938692d4 fix for issue where flight_uuid in flight_information mavlink message wouldn't update at every disarm because the param update was not notified 2019-11-27 07:48:57 +01:00
Daniel Agar
a8ea55d9b6
remove all <cmath> usage
* the NuttX c++ library is incomplete, let's avoid including it until we have a real standard library in place
2019-11-25 10:04:04 -05:00
Silvan Fuhrer
ebdc29bc5f Airspeed Selector: enable airspeed_validated in control modules (#12887)
* FW attitude controller, FW position controller and VTOL attitude controller subscribe to airspeed_validated topic
* add possibility to switch off the airspeed valid checks
* remove airspeed valid checks from commander
* clean up of VTOL transition logic
* Airspeed Selector: remove dynamic allocation of airspeed validators (depending on number of connected sensors) but do it statically for the maximum number allowed. Check for number of connected sensors not only during start up, but always when vehicle is disarmed.
* Airspeed Selector: change work queue from lp to att_pos_ctrl as this module is safety-critical
* add airspeed selector to px4_fmu-v2 defaults
2019-11-21 14:14:25 -05:00
Daniel Agar
a2bd65460d commander: add vehicle-status nav_state change timestamp 2019-11-19 10:24:52 -05:00
Claudio Micheli
ba99ef0d3b Commander: Add COM_ARM_AUTH_REQ for enabling Arm Authorization
Signed-off-by: Claudio Micheli <claudio@auterion.com>
2019-11-17 11:22:36 +01:00
Jacob Dahl
b943bd72ab commander: Added a parameter to control the timeout period for disarming after the kill switch is engaged. (#13325) 2019-11-07 10:03:59 -05:00
Matthias Grob
1a79f75f94 Commander: start pulling arming related parts into separate folder
* PreFlightCheck: remove unused reportFailures flag
* Commander: pull all pre flight checks together on the PreFlightCheck class
* PreFlightCheck: separate checks into their own files
2019-11-05 11:25:59 -05:00
Daniel Agar
a475d71ca9
astyle shift module documentation to bottom of files
- Astyle chokes on the module description strings, so for now we can keep them near the bottom of each file.
2019-11-02 10:58:47 -04:00
Julian Oes
87415d36a2 commander: check center throttle for POSCTL/ALTCTL
When flying POSCTL and ALTCTL the throttle stick is usually spring
loaded and therefore centered. Therefore, it makes more sense to check
for above center instead of above low.
2019-11-01 10:36:30 +01:00
Julian Oes
283a57054a commander: add missing manual modes
We prevent arming when in a "manual" mode with throttle high. However,
POSCTL and ALTCTL were missing.
2019-11-01 10:36:30 +01:00
Julian Oes
300bc0a332 commander: fully support MAVLink force arming
When a magic number is added as param2 for the MAVLink ARM_DISARM
command not just disarming but also arming should be enforced.
2019-11-01 10:36:30 +01:00