APMotors6DOF: Add motor reverse parameters for motors 9-12

Fix overruns found in coverity 145496-99
This commit is contained in:
Jacob Walser 2017-07-10 17:25:45 -04:00 committed by Randy Mackay
parent f423e66d0c
commit 20889ff8a9
2 changed files with 30 additions and 2 deletions

View File

@ -89,6 +89,34 @@ const AP_Param::GroupInfo AP_Motors6DOF::var_info[] = {
// @User: Standard
AP_GROUPINFO("FV_CPLNG_K", 9, AP_Motors6DOF, _forwardVerticalCouplingFactor, 1.0),
// @Param: 9_DIRECTION
// @DisplayName: Motor normal or reverse
// @Description: Used to change motor rotation directions without changing wires
// @Values: 1:normal,-1:reverse
// @User: Standard
AP_GROUPINFO("9_DIRECTION", 10, AP_Motors6DOF, _motor_reverse[8], 1),
// @Param: 10_DIRECTION
// @DisplayName: Motor normal or reverse
// @Description: Used to change motor rotation directions without changing wires
// @Values: 1:normal,-1:reverse
// @User: Standard
AP_GROUPINFO("10_DIRECTION", 11, AP_Motors6DOF, _motor_reverse[9], 1),
// @Param: 11_DIRECTION
// @DisplayName: Motor normal or reverse
// @Description: Used to change motor rotation directions without changing wires
// @Values: 1:normal,-1:reverse
// @User: Standard
AP_GROUPINFO("11_DIRECTION", 12, AP_Motors6DOF, _motor_reverse[10], 1),
// @Param: 12_DIRECTION
// @DisplayName: Motor normal or reverse
// @Description: Used to change motor rotation directions without changing wires
// @Values: 1:normal,-1:reverse
// @User: Standard
AP_GROUPINFO("12_DIRECTION", 13, AP_Motors6DOF, _motor_reverse[11], 1),
AP_GROUPEND
};
@ -366,7 +394,7 @@ void AP_Motors6DOF::output_armed_stabilizing_vectored()
if (forward_coupling_limit < 0) {
forward_coupling_limit = 0;
}
int8_t forward_coupling_direction[] = {-1,-1,1,1,0,0,0,0};
int8_t forward_coupling_direction[] = {-1,-1,1,1,0,0,0,0,0,0,0,0};
// calculate linear command for each motor
// linear factors should be 0.0 or 1.0 for now

View File

@ -54,7 +54,7 @@ protected:
void output_armed_stabilizing_vectored_6dof();
// Parameters
AP_Int8 _motor_reverse[8];
AP_Int8 _motor_reverse[AP_MOTORS_MAX_NUM_MOTORS];
AP_Float _forwardVerticalCouplingFactor;
float _throttle_factor[AP_MOTORS_MAX_NUM_MOTORS]; // each motors contribution to throttle (climb/descent)