14345 Commits

Author SHA1 Message Date
Silvan Fuhrer
4e3fa7cf35 VTOL: rework forward actuation assist
-allow positive pitch offsets in hover
-add param for min pitch during LAND

Signed-off-by: Silvan Fuhrer <silvan@auterion.com>
2021-10-06 11:27:19 -04:00
Silvan Fuhrer
f0de88fada vtol_type: fix motor_state::VALUE
Signed-off-by: Silvan Fuhrer <silvan@auterion.com>
2021-10-06 11:26:39 -04:00
Matthias Grob
a461bb971a FlightTask: preserve vertical velocity during reactivation
to allow descending by stick for reliable land detection.
Issue:
Stick smoothing gets completely reset to state when not taken off
-> downwards velocity setpoint is gone when not taken off
-> in_descend flag of land detection is never true when not taken off
-> when landing but falling out of landing it landing detection fails
bafore taking off and landing again
2021-10-06 11:25:51 -04:00
Matthias Grob
c20e5e3a00 FlightTaskManualAltitudeSmoothVel: remove separate reactivate handling
It was added before the activation was able to work with the previous
setpoint.
2021-10-06 11:25:51 -04:00
Matthias Grob
9b92862980 MulticopterLandDetector: correct in_descend comment 2021-10-06 11:25:51 -04:00
bresch
d95e387d79 angular acceleration: change 2nd order to 1st order LPF
Having a 2nd order low-pass filter in the derivative loop reduces
stability at low cutoff values as too much phase is lost through
the filter. Using a 1st order filter avoids this issue because its
maximum phase loss is 90 degrees instead of 180 degrees for a 2nd order
lpf.
2021-10-06 16:26:03 +02:00
Daniel Agar
ddd1dea4f0
ekf2: avoid uint64 timestamp conversion to float 2021-10-06 09:27:06 -04:00
Julian Oes
6b8840a01b commander: fix switch to ALTCTL when RC regained
This fixes the case where we sometimes switch to altitude control
instead of position control when RC is regained.

What happens is that we detect that the pilot wants to take over control
right when RC comes back. This means that we try to go in position
control in main_state_transition, however, we are already in position
control because we come back from the failsafe state. The result of
main_state_transition is then TRANSITION_NOT_CHANGED, and therefore we
"fall back" to altitude control even though being already in position
control would have been fine.

This fix checks the return result of main_state_transition correctly and
only reacts to TRANSITION_CHANGED and TRANSITION_DENIED but ignores
TRANSITION_NOT_CHANGED.
2021-10-06 10:30:08 +02:00
Silvan Fuhrer
2dca51216c vtol: change message for transition timeout warning
Signed-off-by: Silvan Fuhrer <silvan@auterion.com>
2021-10-05 18:19:33 -04:00
Silvan Fuhrer
bdc57178d4 Tailsitter: add add transition timeout (abort transition after VT_TRANS_TMEOUT, Quadchute)
Signed-off-by: Silvan Fuhrer <silvan@auterion.com>
2021-10-05 18:19:33 -04:00
Silvan Fuhrer
1a1bb2629d tiltrotor: add transition timeout (abort transition after VT_TRANS_TIMEOUT, Quadchute)
Signed-off-by: Silvan Fuhrer <silvan@auterion.com>
2021-10-05 18:19:33 -04:00
Silvan Fuhrer
98c7f664c1 FW Position control: add roll slewrate also in manual Position flight mode
Signed-off-by: Silvan Fuhrer <silvan@auterion.com>
2021-10-05 18:06:49 -04:00
Matthias Grob
2edd97102b Sticks/StickYaw: refactor to use constructor properly 2021-10-05 18:05:54 -04:00
Matthias Grob
0cc13f0799 FlightTaskAutoMapper: add horizontal and yaw nudging during final descent 2021-10-05 18:05:54 -04:00
Matthias Grob
bb9f167d79 StickAccelerationXY: add reseting position to specified coordinates 2021-10-05 18:05:54 -04:00
Thomas Stauber
983dd4db29
don't switch to SETPOINT_TYPE_LOITER during transitions (#18350) 2021-10-05 14:40:14 +02:00
Julian Oes
75b8e11b90 commander: make LAND failsafe stick
By default we would leave the LAND failsafe as soon as a link comes
back. With this change, we switch to the LAND failsafe like a proper
mode change, immediately disabling the failsafe as such.
This is as the same that is done for RTL in fact.

This is not optimal but a workaround for the problem where we switch out
of failsafe right on landing and then discover takeoff again and start
looping through it again and again without ever disarming.
2021-10-05 14:02:22 +02:00
Julian Oes
4701a513c2 mavlink: fix errno for rename 2021-10-04 17:38:31 -04:00
Julian Oes
59b56dd06f mavlink: add more error messages 2021-10-04 17:38:31 -04:00
Julian Oes
74b2fe326d mavlink: don't (mis)use errno as global variable
I think it was not the best idea to use errno as a global variable to
keep track of the error code. I saw the errno change from where it was
set to where it was actually used, maybe because part of it is called in
the receive thread and part in the regular update/send() thread.

To be safe, I just created a class variable instead.
2021-10-04 17:38:31 -04:00
Julian Oes
96388f07fd mavlink: improve debugging around MAVLink FTP
- Remove ifdefs with MAVLINK_FTP_DEBUG and use PX4_DEBUG instead
- Add a couple of more PX4_DEBUG lines
2021-10-04 17:38:31 -04:00
Daniel Agar
cc4152e10d gyro_fft: require higher SNR for initially tracking a peak
- initial frequency peak tracking SNR increased from 10->15 db
 - after initial detection the threshold decreases to SNR 5db
 - gyro_fft large method refactored into smaller pieces
 - sensors/vehicle_angular_velocity: dynamic notch FFT make sample rate
check a percentage and relax lower bound safety threshold
2021-10-04 10:17:16 -04:00
Daniel Agar
6d78054f50
mavlink USB auto start/stop on boards with VBUS
- no longer start sercon or mavlink usb by default
 - on USB connection (VBUS) monitor serial USB at low rate and start Mavlink if there's a HEARTBEAT or nshterm on 3 consecutive carriage returns
 - the mavlink USB instance is automatically stopped and serdis executed if USB is disconnected
 - skipping Mavlink USB (and sercon) saves a considerable amount of memory on older boards
2021-10-03 15:32:54 -04:00
bresch
07e307b074 FieldSensorBiasEst: fix bias learning equation
Also compensate the tuned learning gains for the new equation to keep
the same tuning
2021-10-02 21:25:21 -04:00
bresch
e0bcc17f5b mbe: integrate pre-takeoff mag bias estimate in VehicleMagnetometer 2021-10-02 21:25:21 -04:00
bresch
ec178c8745 create new mag_bias_estimator module
Co-authored-by: Daniel Agar <daniel@agar.ca>
2021-10-02 21:25:21 -04:00
bresch
5874b1f87c mc atune: add module to all targets
- adjust flash constrianed targets to fit
2021-10-02 18:12:05 -04:00
bresch
61dabca4c8 mavlink_receiver: Add mavlink handler with progress report 2021-10-02 18:12:05 -04:00
bresch
d463dfe2d8 mavlink_receiver: handle auto-tuning command 2021-10-02 18:12:05 -04:00
bresch
9681f819a8 mc_att: inject identification signal in att control output 2021-10-02 18:12:05 -04:00
bresch
0498ee92d0 mc atune: add multicopter attitude auto-tuner module 2021-10-02 18:12:05 -04:00
bresch
d504b49695 mc_rate: compute control energy and publish to status msg 2021-10-02 18:12:05 -04:00
Daniel Agar
a53946649a sensors/vehicle_magnetometer: only check if sensor enabled after parameters loaded 2021-10-01 20:30:46 -04:00
marcojob
68a13326f0
mavlink: remove unused strncpy (#18300) 2021-10-01 10:58:25 +02:00
David Sidrane
25a27d26e0 logger:log_writer_file Do not try to store ulog name on systems without hardfault logging 2021-09-29 23:51:25 -04:00
Daniel Agar
c39a21aa54 ekf2: selector remove special timeout condition
- this mainly produces false positives when disarmed and bench testing
2021-09-29 09:59:08 -04:00
Paul Riseborough
ed7c5991eb ekf2: Fix dimensional error in gyro and accel bias variance conversions 2021-09-29 09:58:41 -04:00
Nicolas Martin
b24e5fc0af clean remaining offboard_control_signal_found_once
offboard_control_signal_found_once is not used any more
2021-09-28 09:25:04 -04:00
Nicolas Martin
417a50b2cc fix typo in comment 2021-09-28 09:24:47 -04:00
Jukka Laitinen
6cae4c92e7 Add a header to logfile encryption key exchange file
Signed-off-by: Jukka Laitinen <jukkax@ssrc.tii.ae>
2021-09-27 17:45:07 +02:00
Jukka Laitinen
9a4ef709ca Add parameters for configuring the logfile encryption
SDLOG_ALGORITHM for selecting the crypto algorithm
SDLOG_KEY for selecting the key in keystore to use with the algorithm.
  for symmetric algorithms which are currently supported, this is just a free
  slot to be used, the key is generated at logging start
SDLOG_EXCH_KEY for selecting an RSA2048 key for encrypting the SDLOG_KEY

Signed-off-by: Jukka Laitinen <jukkax@ssrc.tii.ae>
2021-09-27 17:45:07 +02:00
Jukka Laitinen
9472f79307 Take crypto interfaces into use in logger, to encrypt ulog data
- Generate a symmetric encryption key and a nonce value
- Use a public key in keystore to encrypt the symmteric key
- Write the encrypted key and the nonce value to disk into .ulgk, name matching with the encrypted log file
- use quick stream encryption to crypt the .ulg file contents

Signed-off-by: Jukka Laitinen <jukkax@ssrc.tii.ae>
2021-09-27 17:45:07 +02:00
Julian Oes
9290ea974e commander: allow force disarming
Allows to do commander disarm -f to disarm no matter what.
2021-09-27 09:58:03 -04:00
Daniel Agar
333f539900 mavlink: add simple incoming message stats to status 2021-09-27 09:48:00 -04:00
Julian Oes
e81214a22f mavlink: avoid double trigger using sequence
By adding the sequence number we can avoid double triggering due to
command retransmissions. This is according to the mavlink spec for
MAV_CMD_IMAGE_START_CAPTURE.
2021-09-25 20:18:07 -04:00
bresch
904ed57aba HTE: decrease sensitivity with speed
VTOL planes are getting lift from the wing when flying in MC mode at
high speed. They (and some other drones) also get extra drag when
climbing and descending at high speed, corrupting the hover thrust
estimate.

To avoid this, two speed thresholds (vertical and horizontal) are defined
above which the sensitivity of the estimator is decreased by linearly
increasing the observation noise.
2021-09-25 20:07:28 -04:00
Beat Küng
1b0bfd6381 dataman: remove nonexisting SYS_RESTART_TYPE param 2021-09-25 19:15:05 -04:00
Daniel Agar
089c962d92 px4io: moving mixing to FMU side
Using mixers on the IO side had a remote benefit of being able to
override all control surfaces with a radio remote on a fixed wing.
This ended up not being used that much and since the original design
10 years ago (2011) we have been able to convince ourselves that the
overall system stability is at a level where this marginal benefit,
which is not present on multicopters, is not worth the hazzle.

Co-authored-by: Beat Küng <beat-kueng@gmx.net>
Co-authored-by: Daniel Agar <daniel@agar.ca>
2021-09-25 19:15:05 -04:00
Igor Mišić
9ad0e5b357 mavlink_receiver: updated sens flow parameters to be dynamically handle 2021-09-23 09:23:22 +02:00
Beat Küng
6f902e54f9 mavlink: correctly lock radio status
- hrt_elapsed_time_atomic is not atomic on posix
- other fields like _radio_status_mult need protection as well
2021-09-23 09:23:08 +02:00