312 Commits

Author SHA1 Message Date
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
Julian Oes
51ba80f33b commander: improve msg when trying to arm in air 2019-11-01 10:36:30 +01:00
Beat Küng
3198610f85 src/platforms: move all headers to platforms/common/include/px4_platform_common
and remove the px4_ prefix, except for px4_config.h.

command to update includes:
for k in app.h atomic.h cli.h console_buffer.h defines.h getopt.h i2c.h init.h log.h micro_hal.h module.h module_params.h param.h param_macros.h posix.h sem.h sem.hpp shmem.h shutdown.h tasks.h time.h workqueue.h; do for i in $(grep -rl 'include <px4_'$k src platforms boards); do sed -i 's/#include <px4_'$k'/#include <px4_platform_common\/'$k/ $i; done; done
for in $(grep -rl 'include <px4_config.h' src platforms boards); do sed -i 's/#include <px4_config.h/#include <px4_platform_common\/px4_config.h'/ $i; done

Transitional headers for submodules are added (px4_{defines,log,time}.h)
2019-10-30 11:48:47 +01:00
Julien Lecoeur
8f910f8435 ATTITUDE_QUATERNION: fill repr_offset_q for tailsitters (#13249)
* Conversions lib: add quaternion getter

* vehicle_status: add flag is_vtol_tailsitter

* ATTITUDE_QUATERNION: fill repr_offset_q for tailsitters
2019-10-28 09:27:53 +01:00
Daniel Agar
967446af4c clang-tidy: enable readability-simplify-boolean-expr and fix 2019-10-27 19:19:07 -04:00
Beat Küng
b5ba1665f6 commander: add COM_MOT_TEST_EN parameter to enable/disable motor testing 2019-10-24 09:27:29 +02:00
Beat Küng
0d91d4e702 commander: do not beep on successful commands
DO_MOTOR_TEST is sent continuously, which led to constant beeping
2019-10-24 09:27:29 +02:00
Beat Küng
f7b04d5cbc commander: answer to VEHICLE_CMD_DO_ORBIT 2019-10-24 09:27:29 +02:00
Beat Küng
285ae608a5 commander: add support for DO_MOTOR_TEST
- add an optional timeout to test_motor
- enforce a timeout when receiving DO_MOTOR_TEST
- limitation: DO_MOTOR_TEST can only control the MAIN outputs
2019-10-24 09:27:29 +02:00
Nick Steele
070d75496d Handle MAV_CMD_PREFLIGHT_REBOOT_SHUTDOWN 'Do nothing for autopilot' 2019-10-18 15:57:50 -04:00
Julian Oes
de90543d6f FlightTasks: add Descend task to land without GPS
This adds a flight task to catch the case where we want to do an
emergency descent without GPS but only a baro.

Previously, this would lead to the navigator land class being called
without position estimates which then made the flight tasks fail and
react with a flight task failsafe. This however meant that landed was
never detected and a couple of confusing error messages.

This applies if NAV_RCL_ACT is set to 3 "land".
2019-10-18 16:18:19 +02:00
Daniel Agar
97efbde6f4 WIP: commander re-evaluate RC mode switch when local position becomes valid 2019-10-14 14:16:24 +02:00
Dusan Zivkovic
ab2e235333 Commander: bugfix: get all available messages on the subsystem_info topic 2019-10-10 13:12:31 +02:00
Matthias Grob
ca711fecc7 Commander: improve message for RC override event 2019-10-09 15:34:46 +02:00
Matthias Grob
c1faea8d32 Commander: add const qualifiers for clarity 2019-10-09 08:03:07 +02:00
Daniel Agar
a5895e5a99
Revert "commander: update parameter strings to class enum"
This reverts commit c322f1d1568b73327916ce2363c80375e3b5485b.
2019-10-03 11:28:44 -04:00
Daniel Agar
c322f1d156 commander: update parameter strings to class enum 2019-10-02 19:43:32 -04:00
Daniel Agar
c8e59c4e39 parameter_update use uORB::Subscription consistently 2019-09-29 10:49:03 -04:00
bresch
6139812293 FailureDetector - use standard topic subscription for attitude topic and
pass vehicle_status from commander instead of subscribing to it.
2019-09-24 14:17:58 +02:00
Matthias Grob
412b44ff6e Commander: allow RC to override during RTL 2019-09-23 12:42:33 +02:00
Matthias Grob
4f44fde080 Commander: remove not disarming by RC message
Refactoring the condition to be more clear.
2019-09-23 12:42:33 +02:00