|
|
|
@ -23,8 +23,8 @@ extern const AP_HAL::HAL& hal;
@@ -23,8 +23,8 @@ extern const AP_HAL::HAL& hal;
|
|
|
|
|
void AP_MotorsMatrix::init(motor_frame_class frame_class, motor_frame_type frame_type) |
|
|
|
|
{ |
|
|
|
|
// record requested frame class and type
|
|
|
|
|
_last_frame_class = frame_class; |
|
|
|
|
_last_frame_type = frame_type; |
|
|
|
|
_active_frame_class = frame_class; |
|
|
|
|
_active_frame_type = frame_type; |
|
|
|
|
|
|
|
|
|
if (frame_class == MOTOR_FRAME_SCRIPTING_MATRIX) { |
|
|
|
|
// if Scripting frame class, do nothing scripting must call its own dedicated init function
|
|
|
|
@ -114,9 +114,11 @@ void AP_MotorsMatrix::set_update_rate(uint16_t speed_hz)
@@ -114,9 +114,11 @@ void AP_MotorsMatrix::set_update_rate(uint16_t speed_hz)
|
|
|
|
|
void AP_MotorsMatrix::set_frame_class_and_type(motor_frame_class frame_class, motor_frame_type frame_type) |
|
|
|
|
{ |
|
|
|
|
// exit immediately if armed or no change
|
|
|
|
|
if (armed() || (frame_class == _last_frame_class && _last_frame_type == frame_type)) { |
|
|
|
|
if (armed() || (frame_class == _active_frame_class && _active_frame_type == frame_type)) { |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
_active_frame_class = frame_class; |
|
|
|
|
_active_frame_type = frame_type; |
|
|
|
|
|
|
|
|
|
init(frame_class, frame_type); |
|
|
|
|
|
|
|
|
@ -554,15 +556,18 @@ void AP_MotorsMatrix::setup_motors(motor_frame_class frame_class, motor_frame_ty
@@ -554,15 +556,18 @@ void AP_MotorsMatrix::setup_motors(motor_frame_class frame_class, motor_frame_ty
|
|
|
|
|
switch (frame_class) { |
|
|
|
|
|
|
|
|
|
case MOTOR_FRAME_QUAD: |
|
|
|
|
_frame_class_string = "QUAD"; |
|
|
|
|
_mav_type = MAV_TYPE_QUADROTOR; |
|
|
|
|
switch (frame_type) { |
|
|
|
|
case MOTOR_FRAME_TYPE_PLUS: |
|
|
|
|
_frame_type_string = "PLUS"; |
|
|
|
|
add_motor(AP_MOTORS_MOT_1, 90, AP_MOTORS_MATRIX_YAW_FACTOR_CCW, 2); |
|
|
|
|
add_motor(AP_MOTORS_MOT_2, -90, AP_MOTORS_MATRIX_YAW_FACTOR_CCW, 4); |
|
|
|
|
add_motor(AP_MOTORS_MOT_3, 0, AP_MOTORS_MATRIX_YAW_FACTOR_CW, 1); |
|
|
|
|
add_motor(AP_MOTORS_MOT_4, 180, AP_MOTORS_MATRIX_YAW_FACTOR_CW, 3); |
|
|
|
|
break; |
|
|
|
|
case MOTOR_FRAME_TYPE_X: |
|
|
|
|
_frame_type_string = "X"; |
|
|
|
|
add_motor(AP_MOTORS_MOT_1, 45, AP_MOTORS_MATRIX_YAW_FACTOR_CCW, 1); |
|
|
|
|
add_motor(AP_MOTORS_MOT_2, -135, AP_MOTORS_MATRIX_YAW_FACTOR_CCW, 3); |
|
|
|
|
add_motor(AP_MOTORS_MOT_3, -45, AP_MOTORS_MATRIX_YAW_FACTOR_CW, 4); |
|
|
|
@ -570,12 +575,14 @@ void AP_MotorsMatrix::setup_motors(motor_frame_class frame_class, motor_frame_ty
@@ -570,12 +575,14 @@ void AP_MotorsMatrix::setup_motors(motor_frame_class frame_class, motor_frame_ty
|
|
|
|
|
break; |
|
|
|
|
#if APM_BUILD_TYPE(APM_BUILD_ArduPlane) |
|
|
|
|
case MOTOR_FRAME_TYPE_NYT_PLUS: |
|
|
|
|
_frame_type_string = "NYT_PLUS"; |
|
|
|
|
add_motor(AP_MOTORS_MOT_1, 90, 0, 2); |
|
|
|
|
add_motor(AP_MOTORS_MOT_2, -90, 0, 4); |
|
|
|
|
add_motor(AP_MOTORS_MOT_3, 0, 0, 1); |
|
|
|
|
add_motor(AP_MOTORS_MOT_4, 180, 0, 3); |
|
|
|
|
break; |
|
|
|
|
case MOTOR_FRAME_TYPE_NYT_X: |
|
|
|
|
_frame_type_string = "NYT_X"; |
|
|
|
|
add_motor(AP_MOTORS_MOT_1, 45, 0, 1); |
|
|
|
|
add_motor(AP_MOTORS_MOT_2, -135, 0, 3); |
|
|
|
|
add_motor(AP_MOTORS_MOT_3, -45, 0, 4); |
|
|
|
@ -585,6 +592,7 @@ void AP_MotorsMatrix::setup_motors(motor_frame_class frame_class, motor_frame_ty
@@ -585,6 +592,7 @@ void AP_MotorsMatrix::setup_motors(motor_frame_class frame_class, motor_frame_ty
|
|
|
|
|
case MOTOR_FRAME_TYPE_BF_X: |
|
|
|
|
// betaflight quad X order
|
|
|
|
|
// see: https://fpvfrenzy.com/betaflight-motor-order/
|
|
|
|
|
_frame_type_string = "BF_X"; |
|
|
|
|
add_motor(AP_MOTORS_MOT_1, 135, AP_MOTORS_MATRIX_YAW_FACTOR_CW, 2); |
|
|
|
|
add_motor(AP_MOTORS_MOT_2, 45, AP_MOTORS_MATRIX_YAW_FACTOR_CCW,1); |
|
|
|
|
add_motor(AP_MOTORS_MOT_3, -135, AP_MOTORS_MATRIX_YAW_FACTOR_CCW,3); |
|
|
|
@ -592,6 +600,7 @@ void AP_MotorsMatrix::setup_motors(motor_frame_class frame_class, motor_frame_ty
@@ -592,6 +600,7 @@ void AP_MotorsMatrix::setup_motors(motor_frame_class frame_class, motor_frame_ty
|
|
|
|
|
break; |
|
|
|
|
case MOTOR_FRAME_TYPE_BF_X_REV: |
|
|
|
|
// betaflight quad X order, reversed motors
|
|
|
|
|
_frame_type_string = "X_REV"; |
|
|
|
|
add_motor(AP_MOTORS_MOT_1, 135, AP_MOTORS_MATRIX_YAW_FACTOR_CCW, 2); |
|
|
|
|
add_motor(AP_MOTORS_MOT_2, 45, AP_MOTORS_MATRIX_YAW_FACTOR_CW, 1); |
|
|
|
|
add_motor(AP_MOTORS_MOT_3, -135, AP_MOTORS_MATRIX_YAW_FACTOR_CW, 3); |
|
|
|
@ -600,6 +609,7 @@ void AP_MotorsMatrix::setup_motors(motor_frame_class frame_class, motor_frame_ty
@@ -600,6 +609,7 @@ void AP_MotorsMatrix::setup_motors(motor_frame_class frame_class, motor_frame_ty
|
|
|
|
|
case MOTOR_FRAME_TYPE_DJI_X: |
|
|
|
|
// DJI quad X order
|
|
|
|
|
// see https://forum44.djicdn.com/data/attachment/forum/201711/26/172348bppvtt1ot1nrtp5j.jpg
|
|
|
|
|
_frame_type_string = "DJI_X"; |
|
|
|
|
add_motor(AP_MOTORS_MOT_1, 45, AP_MOTORS_MATRIX_YAW_FACTOR_CCW, 1); |
|
|
|
|
add_motor(AP_MOTORS_MOT_2, -45, AP_MOTORS_MATRIX_YAW_FACTOR_CW, 4); |
|
|
|
|
add_motor(AP_MOTORS_MOT_3, -135, AP_MOTORS_MATRIX_YAW_FACTOR_CCW, 3); |
|
|
|
@ -608,12 +618,14 @@ void AP_MotorsMatrix::setup_motors(motor_frame_class frame_class, motor_frame_ty
@@ -608,12 +618,14 @@ void AP_MotorsMatrix::setup_motors(motor_frame_class frame_class, motor_frame_ty
|
|
|
|
|
case MOTOR_FRAME_TYPE_CW_X: |
|
|
|
|
// "clockwise X" motor order. Motors are ordered clockwise from front right
|
|
|
|
|
// matching test order
|
|
|
|
|
_frame_type_string = "CW_X"; |
|
|
|
|
add_motor(AP_MOTORS_MOT_1, 45, AP_MOTORS_MATRIX_YAW_FACTOR_CCW, 1); |
|
|
|
|
add_motor(AP_MOTORS_MOT_2, 135, AP_MOTORS_MATRIX_YAW_FACTOR_CW, 2); |
|
|
|
|
add_motor(AP_MOTORS_MOT_3, -135, AP_MOTORS_MATRIX_YAW_FACTOR_CCW, 3); |
|
|
|
|
add_motor(AP_MOTORS_MOT_4, -45, AP_MOTORS_MATRIX_YAW_FACTOR_CW, 4); |
|
|
|
|
break; |
|
|
|
|
case MOTOR_FRAME_TYPE_V: |
|
|
|
|
_frame_type_string = "V"; |
|
|
|
|
add_motor(AP_MOTORS_MOT_1, 45, 0.7981f, 1); |
|
|
|
|
add_motor(AP_MOTORS_MOT_2, -135, 1.0000f, 3); |
|
|
|
|
add_motor(AP_MOTORS_MOT_3, -45, -0.7981f, 4); |
|
|
|
@ -621,6 +633,7 @@ void AP_MotorsMatrix::setup_motors(motor_frame_class frame_class, motor_frame_ty
@@ -621,6 +633,7 @@ void AP_MotorsMatrix::setup_motors(motor_frame_class frame_class, motor_frame_ty
|
|
|
|
|
break; |
|
|
|
|
case MOTOR_FRAME_TYPE_H: |
|
|
|
|
// H frame set-up - same as X but motors spin in opposite directiSons
|
|
|
|
|
_frame_type_string = "H"; |
|
|
|
|
add_motor(AP_MOTORS_MOT_1, 45, AP_MOTORS_MATRIX_YAW_FACTOR_CW, 1); |
|
|
|
|
add_motor(AP_MOTORS_MOT_2, -135, AP_MOTORS_MATRIX_YAW_FACTOR_CW, 3); |
|
|
|
|
add_motor(AP_MOTORS_MOT_3, -45, AP_MOTORS_MATRIX_YAW_FACTOR_CCW, 4); |
|
|
|
@ -642,6 +655,7 @@ void AP_MotorsMatrix::setup_motors(motor_frame_class frame_class, motor_frame_ty
@@ -642,6 +655,7 @@ void AP_MotorsMatrix::setup_motors(motor_frame_class frame_class, motor_frame_ty
|
|
|
|
|
motors 1's yaw factor should be changed to sin(radians(40)). Where "40" is the vtail angle |
|
|
|
|
motors 3's yaw factor should be changed to -sin(radians(40)) |
|
|
|
|
*/ |
|
|
|
|
_frame_type_string = "VTAIL"; |
|
|
|
|
add_motor(AP_MOTORS_MOT_1, 60, 60, 0, 1); |
|
|
|
|
add_motor(AP_MOTORS_MOT_2, 0, -160, AP_MOTORS_MATRIX_YAW_FACTOR_CW, 3); |
|
|
|
|
add_motor(AP_MOTORS_MOT_3, -60, -60, 0, 4); |
|
|
|
@ -661,6 +675,7 @@ void AP_MotorsMatrix::setup_motors(motor_frame_class frame_class, motor_frame_ty
@@ -661,6 +675,7 @@ void AP_MotorsMatrix::setup_motors(motor_frame_class frame_class, motor_frame_ty
|
|
|
|
|
- Yaw control is entirely in the rear motors |
|
|
|
|
- Roll is is entirely in the front motors |
|
|
|
|
*/ |
|
|
|
|
_frame_type_string = "ATAIL"; |
|
|
|
|
add_motor(AP_MOTORS_MOT_1, 60, 60, 0, 1); |
|
|
|
|
add_motor(AP_MOTORS_MOT_2, 0, -160, AP_MOTORS_MATRIX_YAW_FACTOR_CCW, 3); |
|
|
|
|
add_motor(AP_MOTORS_MOT_3, -60, -60, 0, 4); |
|
|
|
@ -668,6 +683,7 @@ void AP_MotorsMatrix::setup_motors(motor_frame_class frame_class, motor_frame_ty
@@ -668,6 +683,7 @@ void AP_MotorsMatrix::setup_motors(motor_frame_class frame_class, motor_frame_ty
|
|
|
|
|
break; |
|
|
|
|
case MOTOR_FRAME_TYPE_PLUSREV: |
|
|
|
|
// plus with reversed motor directions
|
|
|
|
|
_frame_type_string = "PLUSREV"; |
|
|
|
|
add_motor(AP_MOTORS_MOT_1, 90, AP_MOTORS_MATRIX_YAW_FACTOR_CW, 2); |
|
|
|
|
add_motor(AP_MOTORS_MOT_2, -90, AP_MOTORS_MATRIX_YAW_FACTOR_CW, 4); |
|
|
|
|
add_motor(AP_MOTORS_MOT_3, 0, AP_MOTORS_MATRIX_YAW_FACTOR_CCW, 1); |
|
|
|
@ -675,15 +691,18 @@ void AP_MotorsMatrix::setup_motors(motor_frame_class frame_class, motor_frame_ty
@@ -675,15 +691,18 @@ void AP_MotorsMatrix::setup_motors(motor_frame_class frame_class, motor_frame_ty
|
|
|
|
|
break; |
|
|
|
|
default: |
|
|
|
|
// quad frame class does not support this frame type
|
|
|
|
|
_frame_type_string = "UNSUPPORTED"; |
|
|
|
|
success = false; |
|
|
|
|
break; |
|
|
|
|
} |
|
|
|
|
break; // quad
|
|
|
|
|
|
|
|
|
|
case MOTOR_FRAME_HEXA: |
|
|
|
|
_frame_class_string = "HEXA"; |
|
|
|
|
_mav_type = MAV_TYPE_HEXAROTOR; |
|
|
|
|
switch (frame_type) { |
|
|
|
|
case MOTOR_FRAME_TYPE_PLUS: |
|
|
|
|
_frame_type_string = "PLUS"; |
|
|
|
|
add_motor(AP_MOTORS_MOT_1, 0, AP_MOTORS_MATRIX_YAW_FACTOR_CW, 1); |
|
|
|
|
add_motor(AP_MOTORS_MOT_2, 180, AP_MOTORS_MATRIX_YAW_FACTOR_CCW, 4); |
|
|
|
|
add_motor(AP_MOTORS_MOT_3,-120, AP_MOTORS_MATRIX_YAW_FACTOR_CW, 5); |
|
|
|
@ -692,6 +711,7 @@ void AP_MotorsMatrix::setup_motors(motor_frame_class frame_class, motor_frame_ty
@@ -692,6 +711,7 @@ void AP_MotorsMatrix::setup_motors(motor_frame_class frame_class, motor_frame_ty
|
|
|
|
|
add_motor(AP_MOTORS_MOT_6, 120, AP_MOTORS_MATRIX_YAW_FACTOR_CW, 3); |
|
|
|
|
break; |
|
|
|
|
case MOTOR_FRAME_TYPE_X: |
|
|
|
|
_frame_type_string = "X"; |
|
|
|
|
add_motor(AP_MOTORS_MOT_1, 90, AP_MOTORS_MATRIX_YAW_FACTOR_CW, 2); |
|
|
|
|
add_motor(AP_MOTORS_MOT_2, -90, AP_MOTORS_MATRIX_YAW_FACTOR_CCW, 5); |
|
|
|
|
add_motor(AP_MOTORS_MOT_3, -30, AP_MOTORS_MATRIX_YAW_FACTOR_CW, 6); |
|
|
|
@ -701,6 +721,7 @@ void AP_MotorsMatrix::setup_motors(motor_frame_class frame_class, motor_frame_ty
@@ -701,6 +721,7 @@ void AP_MotorsMatrix::setup_motors(motor_frame_class frame_class, motor_frame_ty
|
|
|
|
|
break; |
|
|
|
|
case MOTOR_FRAME_TYPE_H: |
|
|
|
|
// H is same as X except middle motors are closer to center
|
|
|
|
|
_frame_type_string = "H"; |
|
|
|
|
add_motor_raw(AP_MOTORS_MOT_1, -1.0f, 0.0f, AP_MOTORS_MATRIX_YAW_FACTOR_CW, 2); |
|
|
|
|
add_motor_raw(AP_MOTORS_MOT_2, 1.0f, 0.0f, AP_MOTORS_MATRIX_YAW_FACTOR_CCW, 5); |
|
|
|
|
add_motor_raw(AP_MOTORS_MOT_3, 1.0f, 1.0f, AP_MOTORS_MATRIX_YAW_FACTOR_CW, 6); |
|
|
|
@ -709,6 +730,7 @@ void AP_MotorsMatrix::setup_motors(motor_frame_class frame_class, motor_frame_ty
@@ -709,6 +730,7 @@ void AP_MotorsMatrix::setup_motors(motor_frame_class frame_class, motor_frame_ty
|
|
|
|
|
add_motor_raw(AP_MOTORS_MOT_6, 1.0f, -1.0f, AP_MOTORS_MATRIX_YAW_FACTOR_CW, 4); |
|
|
|
|
break; |
|
|
|
|
case MOTOR_FRAME_TYPE_DJI_X: |
|
|
|
|
_frame_type_string = "DJI_X"; |
|
|
|
|
add_motor(AP_MOTORS_MOT_1, 30, AP_MOTORS_MATRIX_YAW_FACTOR_CCW, 1); |
|
|
|
|
add_motor(AP_MOTORS_MOT_2, -30, AP_MOTORS_MATRIX_YAW_FACTOR_CW, 6); |
|
|
|
|
add_motor(AP_MOTORS_MOT_3, -90, AP_MOTORS_MATRIX_YAW_FACTOR_CCW, 5); |
|
|
|
@ -717,6 +739,7 @@ void AP_MotorsMatrix::setup_motors(motor_frame_class frame_class, motor_frame_ty
@@ -717,6 +739,7 @@ void AP_MotorsMatrix::setup_motors(motor_frame_class frame_class, motor_frame_ty
|
|
|
|
|
add_motor(AP_MOTORS_MOT_6, 90, AP_MOTORS_MATRIX_YAW_FACTOR_CW, 2); |
|
|
|
|
break; |
|
|
|
|
case MOTOR_FRAME_TYPE_CW_X: |
|
|
|
|
_frame_type_string = "CW_X"; |
|
|
|
|
add_motor(AP_MOTORS_MOT_1, 30, AP_MOTORS_MATRIX_YAW_FACTOR_CCW, 1); |
|
|
|
|
add_motor(AP_MOTORS_MOT_2, 90, AP_MOTORS_MATRIX_YAW_FACTOR_CW, 2); |
|
|
|
|
add_motor(AP_MOTORS_MOT_3, 150, AP_MOTORS_MATRIX_YAW_FACTOR_CCW, 3); |
|
|
|
@ -726,15 +749,18 @@ void AP_MotorsMatrix::setup_motors(motor_frame_class frame_class, motor_frame_ty
@@ -726,15 +749,18 @@ void AP_MotorsMatrix::setup_motors(motor_frame_class frame_class, motor_frame_ty
|
|
|
|
|
break; |
|
|
|
|
default: |
|
|
|
|
// hexa frame class does not support this frame type
|
|
|
|
|
_frame_type_string = "UNSUPPORTED"; |
|
|
|
|
success = false; |
|
|
|
|
break; |
|
|
|
|
} |
|
|
|
|
break; |
|
|
|
|
|
|
|
|
|
case MOTOR_FRAME_OCTA: |
|
|
|
|
_frame_class_string = "OCTA"; |
|
|
|
|
_mav_type = MAV_TYPE_OCTOROTOR; |
|
|
|
|
switch (frame_type) { |
|
|
|
|
case MOTOR_FRAME_TYPE_PLUS: |
|
|
|
|
_frame_type_string = "PLUS"; |
|
|
|
|
add_motor(AP_MOTORS_MOT_1, 0, AP_MOTORS_MATRIX_YAW_FACTOR_CW, 1); |
|
|
|
|
add_motor(AP_MOTORS_MOT_2, 180, AP_MOTORS_MATRIX_YAW_FACTOR_CW, 5); |
|
|
|
|
add_motor(AP_MOTORS_MOT_3, 45, AP_MOTORS_MATRIX_YAW_FACTOR_CCW, 2); |
|
|
|
@ -745,6 +771,7 @@ void AP_MotorsMatrix::setup_motors(motor_frame_class frame_class, motor_frame_ty
@@ -745,6 +771,7 @@ void AP_MotorsMatrix::setup_motors(motor_frame_class frame_class, motor_frame_ty
|
|
|
|
|
add_motor(AP_MOTORS_MOT_8, 90, AP_MOTORS_MATRIX_YAW_FACTOR_CW, 3); |
|
|
|
|
break; |
|
|
|
|
case MOTOR_FRAME_TYPE_X: |
|
|
|
|
_frame_type_string = "X"; |
|
|
|
|
add_motor(AP_MOTORS_MOT_1, 22.5f, AP_MOTORS_MATRIX_YAW_FACTOR_CW, 1); |
|
|
|
|
add_motor(AP_MOTORS_MOT_2, -157.5f, AP_MOTORS_MATRIX_YAW_FACTOR_CW, 5); |
|
|
|
|
add_motor(AP_MOTORS_MOT_3, 67.5f, AP_MOTORS_MATRIX_YAW_FACTOR_CCW, 2); |
|
|
|
@ -755,6 +782,7 @@ void AP_MotorsMatrix::setup_motors(motor_frame_class frame_class, motor_frame_ty
@@ -755,6 +782,7 @@ void AP_MotorsMatrix::setup_motors(motor_frame_class frame_class, motor_frame_ty
|
|
|
|
|
add_motor(AP_MOTORS_MOT_8, 112.5f, AP_MOTORS_MATRIX_YAW_FACTOR_CW, 3); |
|
|
|
|
break; |
|
|
|
|
case MOTOR_FRAME_TYPE_V: |
|
|
|
|
_frame_type_string = "V"; |
|
|
|
|
add_motor_raw(AP_MOTORS_MOT_1, 0.83f, 0.34f, AP_MOTORS_MATRIX_YAW_FACTOR_CW, 7); |
|
|
|
|
add_motor_raw(AP_MOTORS_MOT_2, -0.67f, -0.32f, AP_MOTORS_MATRIX_YAW_FACTOR_CW, 3); |
|
|
|
|
add_motor_raw(AP_MOTORS_MOT_3, 0.67f, -0.32f, AP_MOTORS_MATRIX_YAW_FACTOR_CCW, 6); |
|
|
|
@ -765,6 +793,7 @@ void AP_MotorsMatrix::setup_motors(motor_frame_class frame_class, motor_frame_ty
@@ -765,6 +793,7 @@ void AP_MotorsMatrix::setup_motors(motor_frame_class frame_class, motor_frame_ty
|
|
|
|
|
add_motor_raw(AP_MOTORS_MOT_8, 0.50f, -1.00f, AP_MOTORS_MATRIX_YAW_FACTOR_CW, 5); |
|
|
|
|
break; |
|
|
|
|
case MOTOR_FRAME_TYPE_H: |
|
|
|
|
_frame_type_string = "H"; |
|
|
|
|
add_motor_raw(AP_MOTORS_MOT_1, -1.0f, 1.0f, AP_MOTORS_MATRIX_YAW_FACTOR_CW, 1); |
|
|
|
|
add_motor_raw(AP_MOTORS_MOT_2, 1.0f, -1.0f, AP_MOTORS_MATRIX_YAW_FACTOR_CW, 5); |
|
|
|
|
add_motor_raw(AP_MOTORS_MOT_3, -1.0f, 0.333f, AP_MOTORS_MATRIX_YAW_FACTOR_CCW, 2); |
|
|
|
@ -775,6 +804,7 @@ void AP_MotorsMatrix::setup_motors(motor_frame_class frame_class, motor_frame_ty
@@ -775,6 +804,7 @@ void AP_MotorsMatrix::setup_motors(motor_frame_class frame_class, motor_frame_ty
|
|
|
|
|
add_motor_raw(AP_MOTORS_MOT_8, -1.0f, -0.333f, AP_MOTORS_MATRIX_YAW_FACTOR_CW, 3); |
|
|
|
|
break; |
|
|
|
|
case MOTOR_FRAME_TYPE_I: |
|
|
|
|
_frame_type_string = "I"; |
|
|
|
|
add_motor_raw(AP_MOTORS_MOT_1, 0.333f, -1.0f, AP_MOTORS_MATRIX_YAW_FACTOR_CW, 1); |
|
|
|
|
add_motor_raw(AP_MOTORS_MOT_2, -0.333f, 1.0f, AP_MOTORS_MATRIX_YAW_FACTOR_CW, 5); |
|
|
|
|
add_motor_raw(AP_MOTORS_MOT_3, 1.0f, -1.0f, AP_MOTORS_MATRIX_YAW_FACTOR_CCW, 2); |
|
|
|
@ -785,6 +815,7 @@ void AP_MotorsMatrix::setup_motors(motor_frame_class frame_class, motor_frame_ty
@@ -785,6 +815,7 @@ void AP_MotorsMatrix::setup_motors(motor_frame_class frame_class, motor_frame_ty
|
|
|
|
|
add_motor_raw(AP_MOTORS_MOT_8, 1.0f, 1.0f, AP_MOTORS_MATRIX_YAW_FACTOR_CW, 3); |
|
|
|
|
break; |
|
|
|
|
case MOTOR_FRAME_TYPE_DJI_X: |
|
|
|
|
_frame_type_string = "DJI_X"; |
|
|
|
|
add_motor(AP_MOTORS_MOT_1, 22.5f, AP_MOTORS_MATRIX_YAW_FACTOR_CCW, 1); |
|
|
|
|
add_motor(AP_MOTORS_MOT_2, -22.5f, AP_MOTORS_MATRIX_YAW_FACTOR_CW, 8); |
|
|
|
|
add_motor(AP_MOTORS_MOT_3, -67.5f, AP_MOTORS_MATRIX_YAW_FACTOR_CCW, 7); |
|
|
|
@ -795,6 +826,7 @@ void AP_MotorsMatrix::setup_motors(motor_frame_class frame_class, motor_frame_ty
@@ -795,6 +826,7 @@ void AP_MotorsMatrix::setup_motors(motor_frame_class frame_class, motor_frame_ty
|
|
|
|
|
add_motor(AP_MOTORS_MOT_8, 67.5f, AP_MOTORS_MATRIX_YAW_FACTOR_CW, 2); |
|
|
|
|
break; |
|
|
|
|
case MOTOR_FRAME_TYPE_CW_X: |
|
|
|
|
_frame_type_string = "CW_X"; |
|
|
|
|
add_motor(AP_MOTORS_MOT_1, 22.5f, AP_MOTORS_MATRIX_YAW_FACTOR_CCW, 1); |
|
|
|
|
add_motor(AP_MOTORS_MOT_2, 67.5f, AP_MOTORS_MATRIX_YAW_FACTOR_CW, 2); |
|
|
|
|
add_motor(AP_MOTORS_MOT_3, 112.5f, AP_MOTORS_MATRIX_YAW_FACTOR_CCW, 3); |
|
|
|
@ -806,6 +838,7 @@ void AP_MotorsMatrix::setup_motors(motor_frame_class frame_class, motor_frame_ty
@@ -806,6 +838,7 @@ void AP_MotorsMatrix::setup_motors(motor_frame_class frame_class, motor_frame_ty
|
|
|
|
|
break; |
|
|
|
|
default: |
|
|
|
|
// octa frame class does not support this frame type
|
|
|
|
|
_frame_type_string = "UNSUPPORTED"; |
|
|
|
|
success = false; |
|
|
|
|
break; |
|
|
|
|
} // octa frame type
|
|
|
|
@ -813,8 +846,10 @@ void AP_MotorsMatrix::setup_motors(motor_frame_class frame_class, motor_frame_ty
@@ -813,8 +846,10 @@ void AP_MotorsMatrix::setup_motors(motor_frame_class frame_class, motor_frame_ty
|
|
|
|
|
|
|
|
|
|
case MOTOR_FRAME_OCTAQUAD: |
|
|
|
|
_mav_type = MAV_TYPE_OCTOROTOR; |
|
|
|
|
_frame_class_string = "OCTAQUAD"; |
|
|
|
|
switch (frame_type) { |
|
|
|
|
case MOTOR_FRAME_TYPE_PLUS: |
|
|
|
|
_frame_type_string = "PLUS"; |
|
|
|
|
add_motor(AP_MOTORS_MOT_1, 0, AP_MOTORS_MATRIX_YAW_FACTOR_CCW, 1); |
|
|
|
|
add_motor(AP_MOTORS_MOT_2, -90, AP_MOTORS_MATRIX_YAW_FACTOR_CW, 7); |
|
|
|
|
add_motor(AP_MOTORS_MOT_3, 180, AP_MOTORS_MATRIX_YAW_FACTOR_CCW, 5); |
|
|
|
@ -825,6 +860,7 @@ void AP_MotorsMatrix::setup_motors(motor_frame_class frame_class, motor_frame_ty
@@ -825,6 +860,7 @@ void AP_MotorsMatrix::setup_motors(motor_frame_class frame_class, motor_frame_ty
|
|
|
|
|
add_motor(AP_MOTORS_MOT_8, 180, AP_MOTORS_MATRIX_YAW_FACTOR_CW, 6); |
|
|
|
|
break; |
|
|
|
|
case MOTOR_FRAME_TYPE_X: |
|
|
|
|
_frame_type_string = "X"; |
|
|
|
|
add_motor(AP_MOTORS_MOT_1, 45, AP_MOTORS_MATRIX_YAW_FACTOR_CCW, 1); |
|
|
|
|
add_motor(AP_MOTORS_MOT_2, -45, AP_MOTORS_MATRIX_YAW_FACTOR_CW, 7); |
|
|
|
|
add_motor(AP_MOTORS_MOT_3, -135, AP_MOTORS_MATRIX_YAW_FACTOR_CCW, 5); |
|
|
|
@ -835,6 +871,7 @@ void AP_MotorsMatrix::setup_motors(motor_frame_class frame_class, motor_frame_ty
@@ -835,6 +871,7 @@ void AP_MotorsMatrix::setup_motors(motor_frame_class frame_class, motor_frame_ty
|
|
|
|
|
add_motor(AP_MOTORS_MOT_8, -135, AP_MOTORS_MATRIX_YAW_FACTOR_CW, 6); |
|
|
|
|
break; |
|
|
|
|
case MOTOR_FRAME_TYPE_V: |
|
|
|
|
_frame_type_string = "V"; |
|
|
|
|
add_motor(AP_MOTORS_MOT_1, 45, 0.7981f, 1); |
|
|
|
|
add_motor(AP_MOTORS_MOT_2, -45, -0.7981f, 7); |
|
|
|
|
add_motor(AP_MOTORS_MOT_3, -135, 1.0000f, 5); |
|
|
|
@ -846,6 +883,7 @@ void AP_MotorsMatrix::setup_motors(motor_frame_class frame_class, motor_frame_ty
@@ -846,6 +883,7 @@ void AP_MotorsMatrix::setup_motors(motor_frame_class frame_class, motor_frame_ty
|
|
|
|
|
break; |
|
|
|
|
case MOTOR_FRAME_TYPE_H: |
|
|
|
|
// H frame set-up - same as X but motors spin in opposite directions
|
|
|
|
|
_frame_type_string = "H"; |
|
|
|
|
add_motor(AP_MOTORS_MOT_1, 45, AP_MOTORS_MATRIX_YAW_FACTOR_CW, 1); |
|
|
|
|
add_motor(AP_MOTORS_MOT_2, -45, AP_MOTORS_MATRIX_YAW_FACTOR_CCW, 7); |
|
|
|
|
add_motor(AP_MOTORS_MOT_3, -135, AP_MOTORS_MATRIX_YAW_FACTOR_CW, 5); |
|
|
|
@ -856,6 +894,7 @@ void AP_MotorsMatrix::setup_motors(motor_frame_class frame_class, motor_frame_ty
@@ -856,6 +894,7 @@ void AP_MotorsMatrix::setup_motors(motor_frame_class frame_class, motor_frame_ty
|
|
|
|
|
add_motor(AP_MOTORS_MOT_8, -135, AP_MOTORS_MATRIX_YAW_FACTOR_CCW, 6); |
|
|
|
|
break; |
|
|
|
|
case MOTOR_FRAME_TYPE_CW_X: |
|
|
|
|
_frame_type_string = "CW_X"; |
|
|
|
|
add_motor(AP_MOTORS_MOT_1, 45, AP_MOTORS_MATRIX_YAW_FACTOR_CCW, 1); |
|
|
|
|
add_motor(AP_MOTORS_MOT_2, 45, AP_MOTORS_MATRIX_YAW_FACTOR_CW, 2); |
|
|
|
|
add_motor(AP_MOTORS_MOT_3, 135, AP_MOTORS_MATRIX_YAW_FACTOR_CCW, 3); |
|
|
|
@ -867,6 +906,7 @@ void AP_MotorsMatrix::setup_motors(motor_frame_class frame_class, motor_frame_ty
@@ -867,6 +906,7 @@ void AP_MotorsMatrix::setup_motors(motor_frame_class frame_class, motor_frame_ty
|
|
|
|
|
break; |
|
|
|
|
default: |
|
|
|
|
// octaquad frame class does not support this frame type
|
|
|
|
|
_frame_type_string = "UNSUPPORTED"; |
|
|
|
|
success = false; |
|
|
|
|
break; |
|
|
|
|
} |
|
|
|
@ -874,8 +914,10 @@ void AP_MotorsMatrix::setup_motors(motor_frame_class frame_class, motor_frame_ty
@@ -874,8 +914,10 @@ void AP_MotorsMatrix::setup_motors(motor_frame_class frame_class, motor_frame_ty
|
|
|
|
|
|
|
|
|
|
case MOTOR_FRAME_DODECAHEXA: { |
|
|
|
|
_mav_type = MAV_TYPE_DODECAROTOR; |
|
|
|
|
_frame_class_string = "DODECAHEXA"; |
|
|
|
|
switch (frame_type) { |
|
|
|
|
case MOTOR_FRAME_TYPE_PLUS: |
|
|
|
|
_frame_type_string = "PLUS"; |
|
|
|
|
add_motor(AP_MOTORS_MOT_1, 0, AP_MOTORS_MATRIX_YAW_FACTOR_CCW, 1); // forward-top
|
|
|
|
|
add_motor(AP_MOTORS_MOT_2, 0, AP_MOTORS_MATRIX_YAW_FACTOR_CW, 2); // forward-bottom
|
|
|
|
|
add_motor(AP_MOTORS_MOT_3, 60, AP_MOTORS_MATRIX_YAW_FACTOR_CW, 3); // forward-right-top
|
|
|
|
@ -890,6 +932,7 @@ void AP_MotorsMatrix::setup_motors(motor_frame_class frame_class, motor_frame_ty
@@ -890,6 +932,7 @@ void AP_MotorsMatrix::setup_motors(motor_frame_class frame_class, motor_frame_ty
|
|
|
|
|
add_motor(AP_MOTORS_MOT_12, -60, AP_MOTORS_MATRIX_YAW_FACTOR_CCW, 12); // forward-left-bottom
|
|
|
|
|
break; |
|
|
|
|
case MOTOR_FRAME_TYPE_X: |
|
|
|
|
_frame_type_string = "X"; |
|
|
|
|
add_motor(AP_MOTORS_MOT_1, 30, AP_MOTORS_MATRIX_YAW_FACTOR_CCW, 1); // forward-right-top
|
|
|
|
|
add_motor(AP_MOTORS_MOT_2, 30, AP_MOTORS_MATRIX_YAW_FACTOR_CW, 2); // forward-right-bottom
|
|
|
|
|
add_motor(AP_MOTORS_MOT_3, 90, AP_MOTORS_MATRIX_YAW_FACTOR_CW, 3); // right-top
|
|
|
|
@ -905,6 +948,7 @@ void AP_MotorsMatrix::setup_motors(motor_frame_class frame_class, motor_frame_ty
@@ -905,6 +948,7 @@ void AP_MotorsMatrix::setup_motors(motor_frame_class frame_class, motor_frame_ty
|
|
|
|
|
break; |
|
|
|
|
default: |
|
|
|
|
// dodeca-hexa frame class does not support this frame type
|
|
|
|
|
_frame_type_string = "UNSUPPORTED"; |
|
|
|
|
success = false; |
|
|
|
|
break; |
|
|
|
|
}} |
|
|
|
@ -912,9 +956,11 @@ void AP_MotorsMatrix::setup_motors(motor_frame_class frame_class, motor_frame_ty
@@ -912,9 +956,11 @@ void AP_MotorsMatrix::setup_motors(motor_frame_class frame_class, motor_frame_ty
|
|
|
|
|
|
|
|
|
|
case MOTOR_FRAME_Y6: |
|
|
|
|
_mav_type = MAV_TYPE_HEXAROTOR; |
|
|
|
|
_frame_class_string = "Y6"; |
|
|
|
|
switch (frame_type) { |
|
|
|
|
case MOTOR_FRAME_TYPE_Y6B: |
|
|
|
|
// Y6 motor definition with all top motors spinning clockwise, all bottom motors counter clockwise
|
|
|
|
|
_frame_type_string = "Y6B"; |
|
|
|
|
add_motor_raw(AP_MOTORS_MOT_1, -1.0f, 0.500f, AP_MOTORS_MATRIX_YAW_FACTOR_CW, 1); |
|
|
|
|
add_motor_raw(AP_MOTORS_MOT_2, -1.0f, 0.500f, AP_MOTORS_MATRIX_YAW_FACTOR_CCW, 2); |
|
|
|
|
add_motor_raw(AP_MOTORS_MOT_3, 0.0f, -1.000f, AP_MOTORS_MATRIX_YAW_FACTOR_CW, 3); |
|
|
|
@ -924,6 +970,7 @@ void AP_MotorsMatrix::setup_motors(motor_frame_class frame_class, motor_frame_ty
@@ -924,6 +970,7 @@ void AP_MotorsMatrix::setup_motors(motor_frame_class frame_class, motor_frame_ty
|
|
|
|
|
break; |
|
|
|
|
case MOTOR_FRAME_TYPE_Y6F: |
|
|
|
|
// Y6 motor layout for FireFlyY6
|
|
|
|
|
_frame_type_string = "Y6F"; |
|
|
|
|
add_motor_raw(AP_MOTORS_MOT_1, 0.0f, -1.000f, AP_MOTORS_MATRIX_YAW_FACTOR_CCW, 3); |
|
|
|
|
add_motor_raw(AP_MOTORS_MOT_2, -1.0f, 0.500f, AP_MOTORS_MATRIX_YAW_FACTOR_CCW, 1); |
|
|
|
|
add_motor_raw(AP_MOTORS_MOT_3, 1.0f, 0.500f, AP_MOTORS_MATRIX_YAW_FACTOR_CCW, 5); |
|
|
|
@ -932,6 +979,7 @@ void AP_MotorsMatrix::setup_motors(motor_frame_class frame_class, motor_frame_ty
@@ -932,6 +979,7 @@ void AP_MotorsMatrix::setup_motors(motor_frame_class frame_class, motor_frame_ty
|
|
|
|
|
add_motor_raw(AP_MOTORS_MOT_6, 1.0f, 0.500f, AP_MOTORS_MATRIX_YAW_FACTOR_CW, 6); |
|
|
|
|
break; |
|
|
|
|
default: |
|
|
|
|
_frame_type_string = "default"; |
|
|
|
|
add_motor_raw(AP_MOTORS_MOT_1, -1.0f, 0.666f, AP_MOTORS_MATRIX_YAW_FACTOR_CCW, 2); |
|
|
|
|
add_motor_raw(AP_MOTORS_MOT_2, 1.0f, 0.666f, AP_MOTORS_MATRIX_YAW_FACTOR_CW, 5); |
|
|
|
|
add_motor_raw(AP_MOTORS_MOT_3, 1.0f, 0.666f, AP_MOTORS_MATRIX_YAW_FACTOR_CCW, 6); |
|
|
|
@ -978,6 +1026,7 @@ void AP_MotorsMatrix::setup_motors(motor_frame_class frame_class, motor_frame_ty
@@ -978,6 +1026,7 @@ void AP_MotorsMatrix::setup_motors(motor_frame_class frame_class, motor_frame_ty
|
|
|
|
|
|
|
|
|
|
default: |
|
|
|
|
// matrix doesn't support the configured class
|
|
|
|
|
_frame_class_string = "UNSUPPORTED"; |
|
|
|
|
success = false; |
|
|
|
|
_mav_type = MAV_TYPE_GENERIC; |
|
|
|
|
break; |
|
|
|
|