934 Commits

Author SHA1 Message Date
Lorenz Meier
1b7d3883a4 Commander: Obey override / manual reversion mode from external override device
This change will force commander into manual reversion mode when an external override device (like PX4IO) overrides the system externally. This is not a functional change on the outputs, as they were in override mode even without this patch. However, this change ensures that the system state is consistent with the output state and also ensures that the pilot and operator has better situational awareness when he / she triggers the manual reversion without realizing it.
2017-12-02 11:39:52 +00:00
Nicolas de Palezieux
a6ae1fbcaa vehicle command ROI: do not erroneously report command unsupported; handle VEHICLE_CMD_DO_SET_ROI and VEHICLE_CMD_NAV_ROI identically (#8377) 2017-11-27 15:43:39 -05:00
Beat Küng
9c8dc3941d commander: fix 'commander arm' not working in HIL mode
This got introduced with 61b0a81bf9. Due to the removed startup_in_hil flag,
this check does not work anymore, so remove it completely.
2017-10-30 20:53:58 +01:00
Beat Küng
dbb0414e01 commander: remove unused SYS_AUTOSTART param 2017-10-27 10:43:15 +02:00
Beat Küng
8cbd772489 commander: fix wrong parameter types (these are defined as float, not int) 2017-10-27 10:43:15 +02:00
Beat Küng
d74f792784 commander: fix type passed to param_get() 2017-10-27 10:43:15 +02:00
Beat Küng
85e82dca0d commander: add COM_FLIGHT_UUID param, increased upon disarm 2017-10-17 09:56:01 +02:00
Beat Küng
fa8453443f fix commander: remove arming_state_changed, check for was_armed != armed.armed instead
arming_state_changed was not set in all places where an arming transition
occurred, for example when calling arm_disarm() from auto-disarm.

We did not notice because the state is published with at least 5 Hz already.
2017-10-17 09:56:01 +02:00
Daniel Agar
2495f8942b preflightcheck EKF2 GPS requirement after 20s 2017-10-06 16:22:53 -07:00
Daniel Agar
9a9923c517 commander simplify sensors PreflightCheck 2017-10-06 16:22:53 -07:00
Daniel Agar
263b7ea009 commander battery failsafe only error if TRANSITION_DENIED 2017-10-06 20:11:59 +02:00
Daniel Agar
80dd87536e navigator fix vehicle_command_ack (don't copy external) 2017-10-06 20:11:19 +02:00
Daniel Agar
3c18be387c ROI - move handling to navigator (#7939) 2017-09-26 12:25:02 -04:00
James Goppert
13e64d00a8 commander handle shutdown command (#8000) 2017-09-23 10:35:36 -04:00
Henry Zhang
4778c79201 commander: removed CONFIG_ARCH_BOARD_xxx usage 2017-09-20 18:40:55 -10:00
Julian Oes
ee6a79279f commander: require local position for home
This fixes (or at least works around) a race condition where the
`status_flags.condition_local_position_valid` is still `false` but the
`status_flags.condition_global_position_valid` is already `true`.

The way to reproduce it is t:
1. Poll home position to check if home is initialized
2. Send arm and takeoff command as soon as home is initialized

Then arming will succeed but takeoff will fail because there is a check
for `status_flags.condition_local_position_valid` in
`main_state_transition()` to enter TAKEOFF.
2017-09-13 10:06:40 +02:00
David Sidrane
34cd7563fb commander:Removed PX4FMUv1 LED support 2017-09-10 13:37:23 -04:00
Daniel Agar
e15afcca7a vehicle_command commands are uint16, not uint32 2017-09-08 09:06:30 +02:00
Paul Riseborough
c3b1ec8b24 commander: Changes resulting from code review
Change units of parameters from uSec to sec.
Change recommended FW value for COM_POS_FS_GAIN from 2 to 0
Fix error in parameter description for COM_POS_FS_PROB
Fix error in unit for COM_POS_FS_GAIN
2017-09-01 11:53:41 +02:00
Paul Riseborough
491ba08af1 commander: Add parameters to control position failsafe behaviour
This is required because the hardcoded values were too sensitive for fixed wing use and bad initial mag heading could trigger the failsafe and lead to crashes on launch. The defaults have been left unchanged. Suitable values for fixed wing use will need to be implemented in the airframe specific config file.
2017-09-01 11:53:41 +02:00
José Roberto de Souza
3fd7e3f89c modules: commander: Implement arm authorization request
If the second bit of COM_ARM_MIS_EXT_REQ is set the vehicle
will only arm after receive an authorization.

The authorization flow:
vehicle/external -> command: arm authorization request -> arm authorizer
vehicle <- command ack with result in progress <- arm authorizer
vehicle <- any data request <- arm authorizer
vehicle -> data response -> arm authorizer
vehicle <- command ack authorizing or denying <- arm authorizer

Right now there is 2 ways to start the arm authorization request,
that can be configured by COM_ARM_AUTH parameter.
- One arm: When pilot request the vehicle to arm, it will request
authorization blocking the arm process up to the timeout defined in
COM_ARM_AUTH parameter.
- Two arms request: The first arm request will request the
authorization and will deny the first arm request, if authorizer
approved the request, pilot can arm again within the authorized
time and arm without any block.

The arm authorizer can be running anywhere(compute board or PX4
itself) and it is responsible to request the mission list or any
other information to vehicle before send a final response, it
should send to vehicle a COMMAND_ACK with
result = MAV_RESULT_IN_PROGRESS as soon as it receive the arm
authorization request and the final result
as after it got all the data that it needs authorize or deny the
request.
2017-08-28 08:28:57 +02:00
José Roberto de Souza
7e3ab95975 modules: commander: Group arm requirements in just one byte and add a new requirement
Instead of having several bools to each requirement to arm, lets group then
in a byte and use bitmask.
This also add a new arm requirement "arm authorization" that
will be implemented in another patch.
2017-08-28 08:28:57 +02:00
Daniel Agar
4b97e15714 commander remove orb_exists telemetry check 2017-08-21 01:30:17 +02:00
José Roberto de Souza
4462869432 Add support to new fields in command_ack 2017-08-19 09:04:52 +02:00
José Roberto de Souza
925efe990d Initialize all outgoing vehicle_command_ack_s and vehicle_command_s
This will initialize those structs with zero in all fields not set
and all fields set will only be change once to the final value not
wasting CPU time zeroing it.

This will guarantee that no non-unitialized structs will have
a trash value on from_external causing it to be sent to the
MAVLink channel without need it.
2017-08-08 21:46:30 +02:00
José Roberto de Souza
89a428fbfe commander: Keep vehicle_command_ack_s local
No need to keep this struct as global or alive while looping.
2017-08-08 21:46:30 +02:00
Beat Küng
65e0d63ba6 commander: avoid duplicated publish, cleanup log output for offboard_mission update
- orb_advertise already publishes a struct, no need for orb_publish
- mavlink_log_critical goes to the console too
2017-08-04 18:08:51 +02:00
Lorenz Meier
c94e54bbab Commander: Handle HITL state in all places consistently 2017-08-02 15:12:25 +02:00
Beat Küng
007b6dd8d7 commander: make sure the power_button_state topic is advertised on startup
Otherwise the publication from IRQ context won't work
2017-07-29 23:10:47 +02:00
Beat Küng
2815c62acf fix power button shutdown: use an orb topic instead of a work queue call
px4_shutdown_request() was called from the power button IRQ callback, which
invoked a work queue callback. But on NuttX, the work queue uses a
semaphore, and thus it cannot be called from IRQ context.
This patch switches to publishing an uORB msg instead, which is handled in
the commander main thread.

To increase failure resistance, we could subscribe to the same topic in
another module for redundancy, in case commander runs wild.
2017-07-29 23:10:47 +02:00
Lorenz Meier
61b0a81bf9 HITL startup: Further simplification of boot logic in commander 2017-07-29 23:06:50 +02:00
Lorenz Meier
5838556742 HITL handling: Enforce the use of the activation parameter for HITL configuration 2017-07-29 23:06:50 +02:00
Lorenz Meier
4ca7187e42 Commander: Do not allow to set mission mode if the mission is failing feasibility checks. Provide clear feedback if telemetry is online and home is set about an invalid mission state. 2017-07-09 14:43:24 +02:00
Daniel Agar
1a6a871689 commander properly set boot timestamp 2017-07-08 21:54:04 +02:00
Daniel Agar
f11bb401f4 CMD_MISSION_START allow first_item=-1 to leave index unchanged 2017-07-08 19:49:52 +02:00
Julian Oes
9854fc0d84 Set timestamp with vehicle commands
The vehicle_command uORB messages had the timestamp unset at 0.
2017-07-08 11:52:23 +02:00
Lorenz Meier
13bf312263 Commander: Be less verbose 2017-06-21 21:43:28 +02:00
Lorenz Meier
7d23a52871 Commander: Remove debug output 2017-06-19 09:28:38 +02:00
Matthias Grob
e28f8bff67 commander: make commonly spoken strings more user friendly
these technical messages might not be suitable for the user of a product
2017-06-15 07:50:41 +02:00
Lorenz Meier
a1a0dd37dc Commander: Only report GPS lost errors if armed 2017-06-11 11:19:25 +02:00
Daniel Agar
8d5c955af4 remove partial CMD_OVERRIDE_GOTO implementation (#7356)
- closes #7326
2017-06-08 22:03:50 -04:00
Mohammed Kabir
ad5fe5f44a Add support for SET_CAMERA_MODE command; Not used yet. 2017-05-12 22:11:17 +02:00
Mohammed Kabir
2e92a3946d camera_trigger : completely refactor state handling 2017-05-12 22:11:17 +02:00
Paul Riseborough
341bd6e836 commander: add timeout test for global position data 2017-05-08 09:21:38 +02:00
Paul Riseborough
00a42abc69 commander: Add parameter to control postal fallback after loss of navigation accuracy
Also remove else if branch that cannot be accessed.
2017-05-08 09:21:38 +02:00
Paul Riseborough
b85c8fa135 commander: fix bug in pos vel validity transition
This ensures that a mode change will occur immediately when the EKF reports the solution as invalid.
2017-05-08 09:21:38 +02:00
Paul Riseborough
1a2ef45a4b commander: remove unused pos vel validity check functions 2017-05-03 08:37:14 +02:00
Paul Riseborough
625cc4aa83 commander: Use generic function for checking position and velocity validity 2017-05-03 08:37:14 +02:00
Paul Riseborough
8421ad3dfd commander: Changes following code review 2017-05-03 08:37:14 +02:00
priseborough
8ea0b2d3c5 commander: rework posvel validity checks
Move into functions.
Reset probation time and recalculate checks if a mode change is demanded to give the operator ability to regain control as soon as possible after nav performance is regained. (+11 squashed commits)
Squashed commits:
[a4bb800] commander: enable pilot to quickly recover from loss of position accuracy
[19e16a0] commander: rework postal probation time
[f96284e] commander: rework bad pos and vel test probation time
[00d5f0c] commander: Allow EKF preflight checks to pass with moving vehicle

Separates the 'is using GPS' and the GPS quality checks.
Uses a reasonable subset of the GPS quality checks which allows checks to pass if the vehicle is moving.
[4cdfb5c] commander: remove unused variable
[349385a] commander: add EKF GPS quality checks to pre-arm checking

Only perform check if GPs checking is activated by parameter setting.
Display fault messages that makes it clear if EKF quality checks are failing or the EKF is not using GPS for another reason. We do not want to confuse this with GPS lock.
[340ae29] commander: make position invalid fail-safe more sticky

Require check to pass for 7 seconds before exiting failsafe. This is required because if GPs is failing innovation tests for a prolonged period, the EKF will periodically reset to the GPS and report good accuracy at the time of reset.
Adding this delay gives time for an underlying error condition (eg bad IMU or compass) to be re-detected.
[b04ac95] commander: Increase RAM allocation to eliminate low stack warnings
[9dca12f] commander: add missing position invalid fail-safe responses
[69f264d] commander: Update position invalid fail-safe responses

Replace separate logic for each case with a generic function
Add velocity checks.
[8e8cef1] commander: rework position validity checks

Consolidate existing checks for global and local position validity and add checking of velocity accuracy.
Enable checks to be bypassed using the CBRK_VELPOSERR parameter.
2017-05-03 08:37:14 +02:00