Mixer: Added 3D thrust capability to the multirotor and 6-dof mixers

- Added 3D thrust definitions to actuator controls and multirotor motor limits messages
This commit is contained in:
Azarakhsh Keipour
2020-01-21 18:23:06 -05:00
parent d7f61e41d8
commit a878d6823d
5 changed files with 54 additions and 36 deletions
@@ -470,8 +470,9 @@ MultirotorMixer::update_saturation_status(unsigned index, bool clipping_high, bo
_saturation_status.flags.yaw_neg = true;
}
// A positive change in thrust will increase saturation
_saturation_status.flags.thrust_pos = true;
// A negative change in Z thrust will increase saturation
_saturation_status.flags.z_thrust_neg = true;
}
// The motor is saturated at the lower limit
@@ -497,8 +498,8 @@ MultirotorMixer::update_saturation_status(unsigned index, bool clipping_high, bo
_saturation_status.flags.pitch_pos = true;
}
// A negative change in thrust will increase saturation
_saturation_status.flags.thrust_neg = true;
// A positive change in Z thrust will increase saturation
_saturation_status.flags.z_thrust_pos = true;
}
if (clipping_low_yaw) {
@@ -513,5 +514,11 @@ MultirotorMixer::update_saturation_status(unsigned index, bool clipping_high, bo
}
}
// X and Y thrusts are not controlled
_saturation_status.flags.x_thrust_pos = true;
_saturation_status.flags.x_thrust_neg = true;
_saturation_status.flags.y_thrust_pos = true;
_saturation_status.flags.y_thrust_neg = true;
_saturation_status.flags.valid = true;
}
@@ -161,8 +161,12 @@ public:
uint16_t pitch_neg : 1; // 6 - true when a negative pitch demand change will increase saturation
uint16_t yaw_pos : 1; // 7 - true when a positive yaw demand change will increase saturation
uint16_t yaw_neg : 1; // 8 - true when a negative yaw demand change will increase saturation
uint16_t thrust_pos : 1; // 9 - true when a positive thrust demand change will increase saturation
uint16_t thrust_neg : 1; //10 - true when a negative thrust demand change will increase saturation
uint16_t x_thrust_pos : 1; // 9 - true when a positive x thrust demand change will increase saturation
uint16_t x_thrust_neg : 1; //10 - true when a negative x thrust demand change will increase saturation
uint16_t y_thrust_pos : 1; //11 - true when a positive y thrust demand change will increase saturation
uint16_t y_thrust_neg : 1; //12 - true when a negative y thrust demand change will increase saturation
uint16_t z_thrust_pos : 1; //13 - true when a positive z thrust demand change will increase saturation
uint16_t z_thrust_neg : 1; //14 - true when a negative z thrust demand change will increase saturation
} flags;
uint16_t value;
};
@@ -386,12 +390,12 @@ public:
uint16_t pitch_neg : 1; // 6 - true when a negative pitch demand change will increase saturation
uint16_t yaw_pos : 1; // 7 - true when a positive yaw demand change will increase saturation
uint16_t yaw_neg : 1; // 8 - true when a negative yaw demand change will increase saturation
uint16_t x_pos : 1; // 9 - true when a positive x thrust demand change will increase saturation
uint16_t x_neg : 1; //10 - true when a negative x thrust demand change will increase saturation
uint16_t y_pos : 1; //11 - true when a positive y thrust demand change will increase saturation
uint16_t y_neg : 1; //12 - true when a negative y thrust demand change will increase saturation
uint16_t z_pos : 1; //13 - true when a positive z thrust demand change will increase saturation
uint16_t z_neg : 1; //14 - true when a negative z thrust demand change will increase saturation
uint16_t x_thrust_pos : 1; // 9 - true when a positive x thrust demand change will increase saturation
uint16_t x_thrust_neg : 1; //10 - true when a negative x thrust demand change will increase saturation
uint16_t y_thrust_pos : 1; //11 - true when a positive y thrust demand change will increase saturation
uint16_t y_thrust_neg : 1; //12 - true when a negative y thrust demand change will increase saturation
uint16_t z_thrust_pos : 1; //13 - true when a positive z thrust demand change will increase saturation
uint16_t z_thrust_neg : 1; //14 - true when a negative z thrust demand change will increase saturation
} flags;
uint16_t value;
};
@@ -467,31 +467,31 @@ MultirotorMixer6dof::update_saturation_status(unsigned index, bool clipping_high
// check if the x input is saturating
if (_rotors[index].x_scale > 0.0f) {
// A positive change in x will increase saturation
_saturation_status.flags.x_pos = true;
_saturation_status.flags.x_thrust_pos = true;
} else if (_rotors[index].x_scale < 0.0f) {
// A negative change in x will increase saturation
_saturation_status.flags.x_neg = true;
_saturation_status.flags.x_thrust_neg = true;
}
// check if the y input is saturating
if (_rotors[index].y_scale > 0.0f) {
// A positive change in y will increase saturation
_saturation_status.flags.y_pos = true;
_saturation_status.flags.y_thrust_pos = true;
} else if (_rotors[index].y_scale < 0.0f) {
// A negative change in y will increase saturation
_saturation_status.flags.y_neg = true;
_saturation_status.flags.y_thrust_neg = true;
}
// check if the z input is saturating
if (_rotors[index].z_scale > 0.0f) {
// A positive change in z will increase saturation
_saturation_status.flags.z_pos = true;
_saturation_status.flags.z_thrust_pos = true;
} else if (_rotors[index].z_scale < 0.0f) {
// A negative change in z will increase saturation
_saturation_status.flags.z_neg = true;
_saturation_status.flags.z_thrust_neg = true;
}
}
@@ -521,31 +521,31 @@ MultirotorMixer6dof::update_saturation_status(unsigned index, bool clipping_high
// check if the x input is saturating
if (_rotors[index].x_scale > 0.0f) {
// A negative change in x will increase saturation
_saturation_status.flags.x_neg = true;
_saturation_status.flags.x_thrust_neg = true;
} else if (_rotors[index].x_scale < 0.0f) {
// A positive change in x will increase saturation
_saturation_status.flags.x_pos = true;
_saturation_status.flags.x_thrust_pos = true;
}
// check if the y input is saturating
if (_rotors[index].y_scale > 0.0f) {
// A negative change in y will increase saturation
_saturation_status.flags.y_neg = true;
_saturation_status.flags.y_thrust_neg = true;
} else if (_rotors[index].y_scale < 0.0f) {
// A positive change in y will increase saturation
_saturation_status.flags.y_pos = true;
_saturation_status.flags.y_thrust_pos = true;
}
// check if the z input is saturating
if (_rotors[index].z_scale > 0.0f) {
// A negative change in z will increase saturation
_saturation_status.flags.z_neg = true;
_saturation_status.flags.z_thrust_neg = true;
} else if (_rotors[index].z_scale < 0.0f) {
// A positive change in z will increase saturation
_saturation_status.flags.z_pos = true;
_saturation_status.flags.z_thrust_pos = true;
}
}