Commit Graph

283 Commits

Author SHA1 Message Date
Beat Küng bb8e653469 mc_att_control: keep integral enabled based on land detector
Previously the rate controller disabled updating the integral below 20%
throttle. This is not ideal for several reasons:
- some racers already hover with 20% throttle.
- for acro it is important to always keep the integral enabled, it has a
  noticeable effect on flight performance.
2018-06-27 09:11:23 +00:00
Ivo Drescher 42ebbd14bb Changed the intendation to tabs
Signed-off-by: Ivo Drescher <ivo.drescher@gmail.com>
2018-06-13 12:46:42 +02:00
Ivo Drescher 77d4554e6d Modified comment about feed forward of yaw setpoint rate.
Added more explanations regarding the coordinate transformation.

Signed-off-by: Ivo Drescher <ivo.drescher@gmail.com>
2018-06-13 12:46:42 +02:00
Daniel Agar 387bc81f26 move systemlib/circuit_breaker.cpp to standalone lib 2018-06-12 09:06:30 +02:00
Daniel Agar 3e8132935f mc_att_control add conversion library dependency 2018-05-21 01:32:16 -04:00
Daniel Agar 977ab4e7b8 improve end to end control latency measurement (#9388) 2018-05-02 03:03:32 -04:00
Daniel Agar ea3acb7121 cmake remove circular linking and reorganize
- px4_add_module now requires MAIN
 - px4_add_library doesn't automatically link
2018-04-29 21:48:54 -04:00
Beat Küng c7c3e23f0d MC acro: update param descriptions 2018-04-27 22:34:55 +02:00
Beat Küng f2cee9970c MC acro: add separate params to configure yaw expo
So that it can be customized better according to personal preferences.

The limitation of 16 chars did not allow to use a better param name.
2018-04-26 14:17:16 +02:00
Beat Küng 58c757a9db mc_att_control_params: increase max acro rates to 1800
This matches the maximum rates for the attitude controller.
2018-04-26 14:17:16 +02:00
Beat Küng 332a612f35 mc_att_control_main: do not apply the yaw weight for the feedforward term
The meaning of the yaw weight changed with #8003:
- before, the yaw weight decreased with increasing tilt angle error, so
  it was mostly 1
- now, it is constant and depends on the tuning gains (around 0.4 by default)

It means that #8003 reduced the feedforward term, and we get the closer
behavior as before with this change.
It also reduces coupling between different parameters.
2018-04-25 16:33:09 +02:00
Matthias Grob 711b21cc5b mc_att_control: improve a quaternion control comment 2018-04-11 11:14:47 +02:00
Daniel Agar 29b3950747 move geo and geo_lookup to PX4/ecl 2018-03-26 23:16:55 -04:00
Matthias Grob 76bf9c6465 mc_att_control: reenable TPA for I term
In commit
eb67686b11
the TPA scaled integral gain was reverted back to the
normal unscaled gain which rendered the I part of TPA
useless.
2018-03-26 19:00:18 +02:00
Matthias Grob 11ea7dc928 mc_att_control: refactor: switch to matrix library 2018-03-26 16:20:57 +02:00
Beat Küng 693e9ffd46 mc_att_control: remove unused include <systemlib/param/param.h> 2018-03-26 16:20:57 +02:00
Beat Küng 1e09139fcc refactor mc_att_control: move private method declarations above private data members 2018-03-26 16:20:57 +02:00
Beat Küng b04a3a969d refactor mc_att_control: use ModuleParams & Param classes 2018-03-26 16:20:57 +02:00
Beat Küng 22e8204de8 refactor mc_att_control: move class initializer to member initializer 2018-03-26 16:20:57 +02:00
Beat Küng d68d9b522b fix mc_att_control: add missing orb_unsubscribe 2018-03-26 16:20:57 +02:00
Beat Küng 673fa75e58 mc_att_control: refactor to ModuleBase & add module documentation 2018-03-26 16:20:57 +02:00
Matthias Grob 2acd431fcb mc_att_control: revert to tested cutoff frequency
Revert the disabled d term filter which needs to be enabled
after reducing IMU filtering and was probably unintentionally
during a rebase.
2018-03-26 14:23:03 +02:00
bresch 81a80e0d56 Airmode - Minor rewording 2018-03-23 10:35:08 +01:00
bresch 6976232a20 Airmode - Add airmode parameter for multicopter mixer 2018-03-23 10:35:08 +01:00
Daniel Agar ac7242987c delete unused tailsitter_recovery library (#9103) 2018-03-21 14:09:36 -04:00
Matthias Grob ed0b6db2de mc_att_control: clarify comment about yaw feed forward 2018-03-15 17:57:46 +01:00
Matthias Grob ff25c7f48a ensure attitude setpoint initialization before arming
- On initialization _v_att_sp got filled with zeros
  leaving invalid quaternions
- While not armed mc_pos_control did not publish any
  attitude setpoint which makes no sense
- The attitude control just uses the data in _v_att_sp
  if it was (ever) updated or not
2018-03-15 17:16:14 +01:00
Matthias Grob e32b04fff1 mc_att_control: catch numerical out of domain case
While operating on exactly normalized float quaternions
it can aparently still happen that one of the elements
gets just slightly above 1 or below -1 and hence out of
the domain of the acosf and asinf functions resulting in
NaN. The constrain function uses stricly smaller/bigger
comparisons and catches all tested cases.
2018-03-15 17:16:14 +01:00
Matthias Grob 42f4e62a04 mc_att_control: clarify corner case comment 2018-03-15 17:16:14 +01:00
Matthias Grob 9f69447e22 mc_att_control: replace nasty corner case condition
I found a better solution for the condition of the numerical
corner case and also tried to comment it more clearly.
2018-03-15 17:16:14 +01:00
Matthias Grob d2ead02fb5 mc_att_control: catch numerical corner cases
- Delete left over identity matrix.

- Corner case with a zero element when using the signum function:
We always need a sign also for zero.

- Corner case with arbitrary yaw but and 180 degree roll or pitch:
Reduced attitude control calculation always rotates around roll
because there's no right choice when neglecting yaw. In that small
corner case it's better to just use full attitude contol and hence
rotate around the most efficient roll/pitch combination.
2018-03-15 17:16:14 +01:00
Matthias Grob dc28c47544 mc_att_control: correct head comment 2018-03-15 17:16:14 +01:00
Matthias Grob c4fb2b26fd mc_att_control: prepare yaw weight from gain ratio
According to the paper the quaternion controller is built on
the yaw weight represents the ratio between the roll/pitch and
the yaw attitude control time constant. It also states that as a
thumb rule a value of ~0.4 works alright for most multicopter
platforms. The default attitude gains of PX4 which were determined
independent of the paper from experimental results have a ratio of
2.8/6.5 = 0.43 which matches.
2018-03-15 17:16:14 +01:00
Matthias Grob 6317d36ec9 mc_att_control: remove time constant parameter
Because the parameter does not make sense from a control theory
perspective. Either you have a gain with the unit 1/s or an inverse
gain or time constant with the unit s. But the time constant parameter
was neither bound to any exact unit nor did it apply instead of a gain.
Rather it adjusted multiple gains from rate and attitude control
according to an arbitrary scale. This can only by accident lead to
good tuning.
2018-03-15 17:16:14 +01:00
Matthias Grob ba5f2254cd mc_att_control: add reduced quaternion attitude control
to prioritize yaw compared to roll and pitch by combining
the shortest rotation to achieve a total thrust vector with
the full attitude respecting the desired yaw
not by scaling down the control output with the gains
2018-03-15 17:16:14 +01:00
Matthias Grob 9ff9692270 mc_att_control: switch to quaternion attitude control (no yaw reduction yet) 2018-03-15 17:16:14 +01:00
Beat Küng 2bcc5cf3e5 imu filter defaults: set IMU_GYRO_CUTOFF to 80 and MC_DTERM_CUTOFF to 30
tested on at least 5 different vehicles, including AeroFC. The values
should be conservative, good setups (with low vibrations) can increase
these values even further.

increasing IMU_GYRO_CUTOFF allows for better tuning gains (increased P).
2018-03-13 20:54:49 +01:00
Beat Küng 7b5b1c4f23 mc_att_control: update & reset d-term lowpass filter only when frequency changes 2018-02-19 17:02:31 +01:00
Beat Küng 5b7c062f67 mc_att_control_main: remove unused _rates_sp_prev 2018-02-19 17:02:31 +01:00
Beat Küng f346b00ee0 mc_att_control rate controller: use a butterworth lowpass filter on the D-term
The filter is disabled by default, thus the behavior is unchanged.
2018-02-19 17:02:31 +01:00
Beat Küng ca9c3b18ff mc_attitude_control: avoid using a static variable for last_run
and call hrt_absolute_time() only once.
2018-02-19 17:02:31 +01:00
Beat Küng 4bf1980ff6 MC_ROLL_P, MC_PITCH_P: increase maximum value to 12
- use the same value for both
- lower control latency allows increasing these gains
2018-02-19 17:02:31 +01:00
Daniel Agar f5c1124812 move tailsitter_recovery lib to mc_att_control 2018-02-04 18:15:57 +01:00
Daniel Agar 2bea09a997 rate controller status include rates
- the actual corrected rates currently used by mc_att_control are not
   logged
2018-01-29 09:10:56 -05:00
Andreas Antener 98441ac100 Log rate controller integrators (FW + MC) 2018-01-29 09:10:56 -05:00
Daniel Agar f748b38b3a mc_att_control set timestamp_sample from gyro 2017-12-06 10:08:00 +00:00
Beat Küng 3744cac1bb fix mc_att_control: re-add dropped acro parameters (#8293)
and make sure the vtol params are always initialized

This got lost in 4416c4ddb3
2017-11-15 10:08:22 -05:00
Julien Lecoeur 89642a9203 Move src/module/systemlib/mixer to src/lib/mixer 2017-11-15 09:56:10 +01:00
Beat Küng 207fdc0f12 mc_att_control_main: use correct type for params (int -> int32_t) 2017-10-27 10:43:15 +02:00
Daniel Agar 4416c4ddb3 navigator move parameters out of MissionBlock
- MissionBlock is an interface with > 10 implementations
2017-10-26 22:43:53 +02:00