Sub: Added coupling factor as parameter

This commit is contained in:
Rustom Jehangir 2016-02-08 09:02:54 -08:00
parent e91bb2d444
commit f3d9791659
3 changed files with 12 additions and 2 deletions

View File

@ -83,6 +83,13 @@ const AP_Param::GroupInfo AP_Motors6DOF::var_info[] = {
// @User: Standard
AP_GROUPINFO("MOT8_REVERSE", 7, AP_Motors6DOF, _motor_reverse[7], 1),
// @Param: FWDVERT_CPL_K
// @DisplayName: Forward/vertical to pitch decoupling factor
// @Description: Used to decouple pitch from forward/vertical motion
// @Values: 0: min (no effect), 1: normal, 1.5: maximum
// @User: Standard
AP_GROUPINFO("FWDVERT_CPL_K", 8, AP_Motors6DOF, _forwardVerticalCouplingFactor, 1.0),
AP_GROUPEND
};

View File

@ -39,6 +39,7 @@ protected:
// Parameters
AP_Int8 _motor_reverse[8];
AP_Float _forwardVerticalCouplingFactor;
float _throttle_factor[AP_MOTORS_MAX_NUM_MOTORS]; // each motors contribution to throttle (climb/descent)
float _forward_factor[AP_MOTORS_MAX_NUM_MOTORS]; // each motors contribution to forward/backward

View File

@ -153,8 +153,10 @@ void AP_MotorsVectoredROV::output_armed_stabilizing()
}
}
float forwardVerticalCouplingFactor = 1.0; // 0.0-1.5
int16_t forward_coupling_limit = max(forwardVerticalCouplingFactor*(400-fabs(throttle_radio_output)),0);
int16_t forward_coupling_limit = _forwardVerticalCouplingFactor*(400-fabs(throttle_radio_output));
if ( forward_coupling_limit < 0 ) {
forward_coupling_limit = 0;
}
int8_t forward_coupling_direction[] = {-1,0,1,1,0,-1};
// calculate linear command for each motor