AirModeYaw - Change airmode type from bool to int

This commit is contained in:
bresch
2018-12-13 09:50:07 +01:00
committed by Beat Küng
parent b2fd8abf9e
commit 7cc00f41d2
12 changed files with 33 additions and 39 deletions
+5 -5
View File
@@ -221,9 +221,9 @@ public:
/**
* @brief Set airmode. Airmode allows the mixer to increase the total thrust in order to unsaturate the motors.
*
* @param[in] airmode De/-activate airmode by setting it to false/true
* @param[in] airmode Select airmode type (0 = disabled, 1 = roll/pitch, 2 = roll/pitch/yaw)
*/
virtual void set_airmode(bool airmode) {};
virtual void set_airmode(int32_t airmode) {};
protected:
/** client-supplied callback used when fetching control values */
@@ -419,7 +419,7 @@ public:
*/
virtual void set_thrust_factor(float val);
virtual void set_airmode(bool airmode);
virtual void set_airmode(uint32_t airmode);
private:
Mixer *_first; /**< linked list of mixers */
@@ -668,7 +668,7 @@ public:
*/
virtual void set_thrust_factor(float val) {_thrust_factor = val;}
virtual void set_airmode(bool airmode);
virtual void set_airmode(uint32_t airmode);
union saturation_status {
struct {
@@ -695,7 +695,7 @@ private:
float _delta_out_max;
float _thrust_factor;
bool _airmode;
uint32_t _airmode;
void update_saturation_status(unsigned index, bool clipping_high, bool clipping_low);
saturation_status _saturation_status;
+1 -1
View File
@@ -188,7 +188,7 @@ MixerGroup::set_thrust_factor(float val)
}
void
MixerGroup::set_airmode(bool airmode)
MixerGroup::set_airmode(int32_t airmode)
{
Mixer *mixer = _first;
+3 -3
View File
@@ -72,7 +72,7 @@ MultirotorMixer::MultirotorMixer(ControlCallback control_cb,
_idle_speed(-1.0f + idle_speed * 2.0f), /* shift to output range here to avoid runtime calculation */
_delta_out_max(0.0f),
_thrust_factor(0.0f),
_airmode(false),
_airmode(0),
_rotor_count(_config_rotor_count[(MultirotorGeometryUnderlyingType)geometry]),
_rotors(_config_index[(MultirotorGeometryUnderlyingType)geometry]),
_outputs_prev(new float[_rotor_count])
@@ -214,7 +214,7 @@ MultirotorMixer::mix(float *outputs, unsigned space)
boost = 1.0f - ((max_out - thrust) * roll_pitch_scale + thrust);
}
if (!_airmode) {
if (_airmode == 0) {
// disable positive boosting if not in air-mode
// boosting can only be positive when min_out < 0.0
// roll_pitch_scale is reduced accordingly
@@ -425,7 +425,7 @@ MultirotorMixer::update_saturation_status(unsigned index, bool clipping_high, bo
}
void
MultirotorMixer::set_airmode(bool airmode)
MultirotorMixer::set_airmode(int32_t airmode)
{
_airmode = airmode;
}