Commit Graph

24394 Commits

Author SHA1 Message Date
Peter van der Perk 8c4b900f9a uavcan_v1: Correct transmission deadline check & fix SocketCAN tx deadline 2021-06-10 02:26:28 +00:00
Julian Oes ca86416ce6 mavlink: don't read garbage target sysid/compid
This fixes a tricky bug that we discovered in MAVSDK:
https://github.com/mavlink/MAVSDK/pull/1464

It turns out the target_system and target_component fields can
potentially be:
1. at the end of a message payload,
2. and zero,

and therefore they get trimmed. When you then try to read it you
potentially read some garbage from the CRC fields.
2021-06-09 15:40:46 -04:00
echoG 6bc09138c1 Adding BatMon smart battery as a module and refactoring SMBUS based SBS 1.1 spec to a library 2021-06-09 12:17:45 -04:00
bresch 514845592b en-/disable mc position controller using explicit control mode flag 2021-06-09 18:10:22 +02:00
Daniel Agar 328c5cb1cf mavlink: properly cleanup instance on exit 2021-06-09 10:58:34 -04:00
Hamish Willee 665d2ea74e markdownout for parameters - makes link internal 2021-06-09 11:09:48 +02:00
JacobCrabill 0931ff10d5 uavcan_v1: Clean up handling of invalid port IDs
Always convert 'invalid' port ID values (e.g., the default PX4 port-ID
parameter value of -1) to CANARD_PORT_ID_UNSET in all comparisons.
2021-06-08 20:13:19 -04:00
JacobCrabill 73ef22ae77 uavcan_v1: Fix heartbeat pub timestamp
The hrt_abstime value used to control the 1s pub rate was the value of
the timestamp_usec of the CanardTransfer, which has a timeout of 100ms
added to it.

Since hrt_abstime is an unsigned datatype, if the hrt_elapsed_time()
check was called <100ms apart, the negative value would result in a
large hrt_elapsed_time, and the bus would be spammed with Heartbeat
messages (or error messages from canardTxPush).
2021-06-08 20:13:19 -04:00
Daniel Agar 251f1a069b ekf2: update message lost error messages to perf counters
- only allocate these perf counters if data source is present
2021-06-08 20:12:17 -04:00
bresch 841914462d MC pos control: use vz<->z_deriv blending in pure vel mode only
This logic was introduced to avoid large altitude drifts in velocity
mode (altitude not controlled) due to potential velocity estimate bias
in case of IMU problems (see PR #8445). After some refactorings,
the logic started to be used in altitude-controlled modes as well, which is not needed.
2021-06-08 14:58:14 +02:00
honglang 8b1d2b8551 change fmu-v5's uavcan timer5 to timer6 2021-06-07 20:07:03 +02:00
achim 00229c4fd2 drv_pwm_output.h: increase highest max pwm limit from 2150 to 2500
- servo linkages in vtol often need further travel of the servos to cover the full tilt travel
2021-06-07 09:13:39 -04:00
Daniel Agar 578c003c13 ekf2: selector handle uninitalized test ratios
- choose the best instance regardless of tilt or yaw alignment
2021-06-07 08:56:37 -04:00
Matthias Grob ed62ae0e4f mavlink: add actuator_armed header to heartbeat 2021-06-07 08:55:49 -04:00
Julian Oes 446598d003 mc_pos_control: omit initial warning 2021-06-07 08:54:19 -04:00
Daniel Agar 4f850c7cd0 sensors: preserve all valid calibration parameters even if sensor currently missing
- mark calibration slots active for first N sensors found
 - calibration procedure don't bother resetting unused slots
2021-06-07 08:50:32 -04:00
Daniel Agar 2ccd86102b ekf2: add command line option to manually select instance 2021-06-07 08:47:17 -04:00
Daniel Agar 4f8f1a5f7e mavlink: streams HEARTBEAT fix code style 2021-06-04 20:43:25 -04:00
Matthias Grob faabe2d431 mavlink: make sure heartbeat reports flight termination 2021-06-04 12:48:22 -04:00
Matthias Grob 70050ae4f5 mc_pos_control_params: correct MPC_POS_MODE docs since 1 is depracated 2021-06-04 09:32:03 -04:00
Peter van der Perk 9756c70491 UAVCANv1 Iteration, dynamic subscribers and decoupling (#17624)
* Update to use libcanard callback
Reworked param system with lambda

* Use callback instead of lambda saves 500 bytes of flash

* [UAVCANv1] Added ServiceRequest class, subscribers decoupled

* PX4 UAVCANv1 portID param default CANARD_PORT_ID_UNSET (65535U)

* [UAVCANv1] uORB sensor_gps modify timestamp for now untill we've got timesync working

* UAVCANv1 update parameter definition to use -1 as unset
2021-06-04 09:30:17 -04:00
Daniel Agar 470c3cfa6e mavlink: streams HEARTBEAT fix vehicle_control_mode copy 2021-06-04 15:19:34 +02:00
CUAVmengxiao 98fb373590 mavlink: 14S battery support 2021-06-04 09:15:40 -04:00
RomanBapst ad9288536b TECS: enable direct height-rate control
Signed-off-by: RomanBapst <bapstroman@gmail.com>
2021-06-04 14:51:27 +02:00
RomanBapst f6de99d42e FixedWingPositionControl: control only height rate when using pitch stick
in manual altitude controlled modes

Signed-off-by: RomanBapst <bapstroman@gmail.com>
2021-06-04 14:51:27 +02:00
Silvan Fuhrer 3d87bfcc0a rename FW_T_CLIMB_R_SP to FW_T_CLMB_R_SP
Signed-off-by: Silvan Fuhrer <silvan@auterion.com>
2021-06-04 14:51:27 +02:00
RomanBapst 19449a4e75 FixedWingPositionControl: use target climb/sink rate parameters as maximum
rates in manual altitude controlled modes

Signed-off-by: RomanBapst <bapstroman@gmail.com>
2021-06-04 14:51:27 +02:00
RomanBapst a5cc449e69 tecs: propagate altitude setpoint based on target climb/sink rate
- avoids tecs always climbing and sinking and max rates and allows to fine tune these rates
- avoid numerical calculation of feedforward velocity using derivative, this
 was prone to jitter in dt

Signed-off-by: RomanBapst <bapstroman@gmail.com>
2021-06-04 14:51:27 +02:00
RomanBapst 4b7416c05b FixedWingPosControlL1: added target climb and sink rate parameters
Signed-off-by: RomanBapst <bapstroman@gmail.com>
2021-06-04 14:51:27 +02:00
bresch 8ad0f36f48 pwm: specific fail/disarm parameters should default to global value 2021-06-03 21:26:13 -04:00
Daniel Agar db1657fa84 sensors/vehicle_magnetometer: apply current compensation regardless of arming state
- simplify update on mag compensation type change
2021-06-03 10:08:19 -04:00
Julian Oes 60235f8474 mavlink: properly initialize vehicle_command queue
This makes sure that the vehicle_command topic is properly
initialized from the beginning.

orb_exists returns -1 or 0 and not a bool as one would expect.
2021-06-03 08:53:39 -04:00
Hamish Willee 00cc1323ea gpio.cpp: Add backticks around gpio command docs 2021-06-03 12:37:48 +02:00
Daniel Agar 284375efc3 px4io: only update PWM MAX/MIN/DIS/FAIL/REV once
- Updating PWM params on param change was interfering with VTOL
parameter settings (e.g. PWM_MIN is set by VTOL at init, and
was then overwritten here after an arbitrary param change).
2021-06-03 00:52:05 -04:00
Silvan Fuhrer 697d713faf pwm out: disable PWM parameter update on param change
Only update PWM params on initialisation.
Updating PWM params on param change was interfering with VTOL
parameter settings (e.g. PWM_MIN is set by VTOL at init, and
was then overwritten here after an arbitrary param change).

Signed-off-by: Silvan Fuhrer <silvan@auterion.com>
2021-06-03 00:52:05 -04:00
Julian Oes 1b67187770 navigator: protect against 0 acceptance radius
This seems to slip in e.g. as part of the VTOL_LAND command.
2021-06-02 07:28:19 +02:00
Julian Oes ab23a44b99 navigator: fix acceptance radius for multicopter
This fixes a regression introduced in
https://github.com/PX4/PX4-Autopilot/pull/16646
which meant that the acceptance radius was no longer used at all for
multicopter, and instead only the NAV_ACC_RAD param was used.

With this change we use the acceptance radius of the mission item again
if it is actually set (and not NAN) which we did not do before, and we
only do that for multicopter.
2021-06-02 07:28:19 +02:00
Beat Küng dfa5964719 Accelerometer: fix thermal calibration index 2021-06-01 10:01:36 -04:00
Daniel Agar d430e13401 sensors: wait for real sample rate to initialize LowPassFilter2p 2021-06-01 08:58:10 -04:00
Daniel Agar 438b0abc7a mathlib: Biquad filters use internal fields for parameter update 2021-06-01 08:58:10 -04:00
Daniel Agar 9661eddef8 mathlib: LowPassFilter2p initialize b0 to 1 for safety 2021-06-01 08:58:10 -04:00
RomanBapst b06b46b224 log raw airspeed derivative, pitch setpoint and airspeed innovation for TECS
Signed-off-by: RomanBapst <bapstroman@gmail.com>
2021-05-31 23:56:23 +02:00
Daniel Agar 5493d96d17 mathlib: merge LowPassFilter2p, LowPassFilter2pArray, and LowPassFilter2pVector3f
- fix reset for direct form 2
 - push NAN checks out to filter users
2021-05-31 10:26:45 -04:00
Daniel Agar 2a792ca201 gyro_fft: add simple SNR requirement and reduce number of peaks 2021-05-31 10:26:45 -04:00
Daniel Agar 3269ee8df1 sensors/vehicle_angular_velocity: accumualted notch filtering and reset improvements
- apply sensor scaling immediately to keep things simple (FIFO vs regular)
 - inline filter helpers (minor performance improvement)
 - dynamic notch filtering
    - reorder by axis (applied per axis)
    - don't remove notch filters immediately if ESC or FFT data times out
    - constrain notch filter frequency and bandwidth to safe range (minimum bandwidth for flaot precision, Nyquist, etc)
 - add safe constraint on dt
2021-05-31 10:26:45 -04:00
Daniel Agar 561cfca4f9 fake_imu: add fake ESC status for testing dynamic notch filters 2021-05-31 10:26:45 -04:00
Daniel Agar f25a70a674 mathlib: Notchfilter updates
- merge NotchFilterArray into regular NotchFilter (apply vs applyArray)
 - only use direct form 1 to prevent reset confusion
 - safe default field initialization
 - update VehicleAngularVelocity usage
2021-05-31 10:26:45 -04:00
Daniel Agar 055b5404c3 sensors/vehicle_imu: switch to WelfordMean library and other improvements
- use WelfordMean library to determine sensor sample rate average
 - if gyro samples exceeds queue depth, instead round to nearest even integer to ease scheduling
 - force update if publication latency is falling behind
 - remove redundant sample interval perf counters
 - status print accel & gyro interval standard deviation
2021-05-31 10:05:10 -04:00
Daniel Agar 3340fca332 sensors/vehicle_imu: move accel & gyro updates to separate methods 2021-05-31 10:05:10 -04:00
Daniel Agar a5979e16be sensors/vehicle_imu: move publish to separate method 2021-05-31 10:05:10 -04:00