1
0
Fork 0
mirror of https://github.com/iNavFlight/inav-configurator.git synced 2025-07-26 09:45:23 +03:00

Servo mix rules

This commit is contained in:
Pawel Spychalski (DzikuVx) 2018-03-29 11:35:51 +02:00
parent d0cdef46f4
commit 2e19037667
2 changed files with 168 additions and 97 deletions

1
.gitignore vendored
View file

@ -13,3 +13,4 @@ inav-configurator.iml
/dist /dist
# Path where the NW.js apps get built # Path where the NW.js apps get built
/apps /apps
/.vscode/

View file

@ -1,5 +1,36 @@
'use strict'; 'use strict';
const SERVO_GIMBAL_PITCH = 0,
SERVO_GIMBAL_ROLL = 1,
SERVO_ELEVATOR = 2,
SERVO_FLAPPERON_1 = 3,
SERVO_FLAPPERON_2 = 4,
SERVO_RUDDER = 5,
SERVO_BICOPTER_LEFT = 4,
SERVO_BICOPTER_RIGHT = 5,
SERVO_DUALCOPTER_LEFT = 4,
SERVO_DUALCOPTER_RIGHT = 5,
SERVO_SINGLECOPTER_1 = 3,
SERVO_SINGLECOPTER_2 = 4,
SERVO_SINGLECOPTER_3 = 5,
SERVO_SINGLECOPTER_4 = 6;
const INPUT_STABILIZED_ROLL = 0,
INPUT_STABILIZED_PITCH = 1,
INPUT_STABILIZED_YAW = 2,
INPUT_STABILIZED_THROTTLE = 3,
INPUT_RC_ROLL = 4,
INPUT_RC_PITCH = 5,
INPUT_RC_YAW = 6,
INPUT_RC_THROTTLE = 7,
INPUT_RC_AUX1 = 8,
INPUT_RC_AUX2 = 9,
INPUT_RC_AUX3 = 10,
INPUT_RC_AUX4 = 11,
INPUT_GIMBAL_PITCH = 12,
INPUT_GIMBAL_ROLL = 13,
INPUT_FEATURE_FLAPS = 14;
// generate mixer // generate mixer
const mixerList = [ const mixerList = [
{ {
@ -8,10 +39,13 @@ const mixerList = [
image: 'tri', image: 'tri',
hasCustomServoMixer: false, hasCustomServoMixer: false,
enabled: true, enabled: true,
motorMixer: [ motorMixer: [
new MotorMixRule(1.0, 0.0, 1.333333, 0.0), // REAR new MotorMixRule(1.0, 0.0, 1.333333, 0.0), // REAR
new MotorMixRule(1.0, -1.0, -0.666667, 0.0), // RIGHT new MotorMixRule(1.0, -1.0, -0.666667, 0.0), // RIGHT
new MotorMixRule(1.0, 1.0, -0.666667, 0.0), // LEFT new MotorMixRule(1.0, 1.0, -0.666667, 0.0) // LEFT
],
servoMixer: [
new ServoMixRule(SERVO_RUDDER, INPUT_STABILIZED_YAW, 100, 0)
] ]
}, // 1 }, // 1
{ {
@ -21,11 +55,12 @@ const mixerList = [
hasCustomServoMixer: false, hasCustomServoMixer: false,
enabled: true, enabled: true,
motorMixer: [ motorMixer: [
new MotorMixRule(1.0, 0.0, 1.0, -1.0), // REAR new MotorMixRule(1.0, 0.0, 1.0, -1.0), // REAR
new MotorMixRule(1.0, -1.0, 0.0, 1.0), // RIGHT new MotorMixRule(1.0, -1.0, 0.0, 1.0), // RIGHT
new MotorMixRule(1.0, 1.0, 0.0, 1.0), // LEFT new MotorMixRule(1.0, 1.0, 0.0, 1.0), // LEFT
new MotorMixRule(1.0, 0.0, -1.0, -1.0), // FRONT new MotorMixRule(1.0, 0.0, -1.0, -1.0) // FRONT
] ],
servoMixer: []
}, // 2 }, // 2
{ {
name: 'Quad X', name: 'Quad X',
@ -34,11 +69,12 @@ const mixerList = [
hasCustomServoMixer: false, hasCustomServoMixer: false,
enabled: true, enabled: true,
motorMixer: [ motorMixer: [
new MotorMixRule(1.0, -1.0, 1.0, -1.0), // REAR_R new MotorMixRule(1.0, -1.0, 1.0, -1.0), // REAR_R
new MotorMixRule(1.0, -1.0, -1.0, 1.0), // FRONT_R new MotorMixRule(1.0, -1.0, -1.0, 1.0), // FRONT_R
new MotorMixRule(1.0, 1.0, 1.0, 1.0), // REAR_L new MotorMixRule(1.0, 1.0, 1.0, 1.0), // REAR_L
new MotorMixRule(1.0, 1.0, -1.0, -1.0), // FRONT_L new MotorMixRule(1.0, 1.0, -1.0, -1.0) // FRONT_L
] ],
servoMixer: []
}, // 3 }, // 3
{ {
name: 'Bicopter', name: 'Bicopter',
@ -46,7 +82,8 @@ const mixerList = [
image: 'bicopter', image: 'bicopter',
hasCustomServoMixer: false, hasCustomServoMixer: false,
enabled: false, enabled: false,
motorMixer: [] motorMixer: [],
servoMixer: []
}, // 4 }, // 4
{ {
name: 'Gimbal', name: 'Gimbal',
@ -54,7 +91,8 @@ const mixerList = [
image: 'custom', image: 'custom',
hasCustomServoMixer: false, hasCustomServoMixer: false,
enabled: false, enabled: false,
motorMixer: [] motorMixer: [],
servoMixer: []
}, // 5 }, // 5
{ {
name: 'Y6', name: 'Y6',
@ -63,13 +101,14 @@ const mixerList = [
hasCustomServoMixer: false, hasCustomServoMixer: false,
enabled: true, enabled: true,
motorMixer: [ motorMixer: [
new MotorMixRule(1.0, 0.0, 1.333333, 1.0), // REAR new MotorMixRule(1.0, 0.0, 1.333333, 1.0), // REAR
new MotorMixRule(1.0, -1.0, -0.666667, -1.0), // RIGHT new MotorMixRule(1.0, -1.0, -0.666667, -1.0), // RIGHT
new MotorMixRule(1.0, 1.0, -0.666667, -1.0), // LEFT new MotorMixRule(1.0, 1.0, -0.666667, -1.0), // LEFT
new MotorMixRule(1.0, 0.0, 1.333333, -1.0), // UNDER_REAR new MotorMixRule(1.0, 0.0, 1.333333, -1.0), // UNDER_REAR
new MotorMixRule(1.0, -1.0, -0.666667, 1.0), // UNDER_RIGHT new MotorMixRule(1.0, -1.0, -0.666667, 1.0), // UNDER_RIGHT
new MotorMixRule(1.0, 1.0, -0.666667, 1.0), // UNDER_LEFT new MotorMixRule(1.0, 1.0, -0.666667, 1.0) // UNDER_LEFT
] ],
servoMixer: []
}, // 6 }, // 6
{ {
name: 'Hex +', name: 'Hex +',
@ -78,13 +117,14 @@ const mixerList = [
hasCustomServoMixer: false, hasCustomServoMixer: false,
enabled: true, enabled: true,
motorMixer: [ motorMixer: [
new MotorMixRule(1.0, -0.866025, 0.5, 1.0), // REAR_R new MotorMixRule(1.0, -0.866025, 0.5, 1.0), // REAR_R
new MotorMixRule(1.0, -0.866025, -0.5, -1.0), // FRONT_R new MotorMixRule(1.0, -0.866025, -0.5, -1.0), // FRONT_R
new MotorMixRule(1.0, 0.866025, 0.5, 1.0), // REAR_L new MotorMixRule(1.0, 0.866025, 0.5, 1.0), // REAR_L
new MotorMixRule(1.0, 0.866025, -0.5, -1.0), // FRONT_L new MotorMixRule(1.0, 0.866025, -0.5, -1.0), // FRONT_L
new MotorMixRule(1.0, 0.0, -1.0, 1.0), // FRONT new MotorMixRule(1.0, 0.0, -1.0, 1.0), // FRONT
new MotorMixRule(1.0, 0.0, 1.0, -1.0), // REAR new MotorMixRule(1.0, 0.0, 1.0, -1.0) // REAR
] ],
servoMixer: []
}, // 7 }, // 7
{ {
name: 'Flying Wing', name: 'Flying Wing',
@ -93,8 +133,14 @@ const mixerList = [
hasCustomServoMixer: false, hasCustomServoMixer: false,
enabled: true, enabled: true,
motorMixer: [ motorMixer: [
new MotorMixRule(1.0, 0.0, 0.0, 0.0), new MotorMixRule(1.0, 0.0, 0.0, 0.0),
new MotorMixRule(1.0, 0.0, 0.0, 0.0), new MotorMixRule(1.0, 0.0, 0.0, 0.0),
],
servoMixer: [
new ServoMixRule(SERVO_FLAPPERON_1, INPUT_STABILIZED_ROLL, 50, 0),
new ServoMixRule(SERVO_FLAPPERON_1, INPUT_STABILIZED_PITCH, 50, 0),
new ServoMixRule(SERVO_FLAPPERON_2, INPUT_STABILIZED_ROLL, -50, 0),
new ServoMixRule(SERVO_FLAPPERON_2, INPUT_STABILIZED_PITCH, 50, 0)
] ]
}, // 8 }, // 8
{ {
@ -104,11 +150,12 @@ const mixerList = [
hasCustomServoMixer: false, hasCustomServoMixer: false,
enabled: true, enabled: true,
motorMixer: [ motorMixer: [
new MotorMixRule(1.0, 0.0, 1.0, -1.0), // REAR_TOP CW new MotorMixRule(1.0, 0.0, 1.0, -1.0), // REAR_TOP CW
new MotorMixRule(1.0, -1.0, -1.0, 0.0), // FRONT_R CCW new MotorMixRule(1.0, -1.0, -1.0, 0.0), // FRONT_R CCW
new MotorMixRule(1.0, 0.0, 1.0, 1.0), // REAR_BOTTOM CCW new MotorMixRule(1.0, 0.0, 1.0, 1.0), // REAR_BOTTOM CCW
new MotorMixRule(1.0, 1.0, -1.0, 0.0), // FRONT_L CW new MotorMixRule(1.0, 1.0, -1.0, 0.0), // FRONT_L CW
] ],
servoMixer: []
}, // 9 }, // 9
{ {
name: 'Hex X', name: 'Hex X',
@ -117,13 +164,14 @@ const mixerList = [
hasCustomServoMixer: false, hasCustomServoMixer: false,
enabled: true, enabled: true,
motorMixer: [ motorMixer: [
new MotorMixRule(1.0, -0.5, 0.866025, 1.0), // REAR_R new MotorMixRule(1.0, -0.5, 0.866025, 1.0), // REAR_R
new MotorMixRule(1.0, -0.5, -0.866025, 1.0), // FRONT_R new MotorMixRule(1.0, -0.5, -0.866025, 1.0), // FRONT_R
new MotorMixRule(1.0, 0.5, 0.866025, -1.0), // REAR_L new MotorMixRule(1.0, 0.5, 0.866025, -1.0), // REAR_L
new MotorMixRule(1.0, 0.5, -0.866025, -1.0), // FRONT_L new MotorMixRule(1.0, 0.5, -0.866025, -1.0), // FRONT_L
new MotorMixRule(1.0, -1.0, 0.0, -1.0), // RIGHT new MotorMixRule(1.0, -1.0, 0.0, -1.0), // RIGHT
new MotorMixRule(1.0, 1.0, 0.0, 1.0), // LEFT new MotorMixRule(1.0, 1.0, 0.0, 1.0), // LEFT
] ],
servoMixer: []
}, // 10 }, // 10
{ {
name: 'Octo X8', name: 'Octo X8',
@ -132,15 +180,16 @@ const mixerList = [
hasCustomServoMixer: false, hasCustomServoMixer: false,
enabled: true, enabled: true,
motorMixer: [ motorMixer: [
new MotorMixRule(1.0, -1.0, 1.0, -1.0), // REAR_R new MotorMixRule(1.0, -1.0, 1.0, -1.0), // REAR_R
new MotorMixRule(1.0, -1.0, -1.0, 1.0), // FRONT_R new MotorMixRule(1.0, -1.0, -1.0, 1.0), // FRONT_R
new MotorMixRule(1.0, 1.0, 1.0, 1.0), // REAR_L new MotorMixRule(1.0, 1.0, 1.0, 1.0), // REAR_L
new MotorMixRule(1.0, 1.0, -1.0, -1.0), // FRONT_L new MotorMixRule(1.0, 1.0, -1.0, -1.0), // FRONT_L
new MotorMixRule(1.0, -1.0, 1.0, 1.0), // UNDER_REAR_R new MotorMixRule(1.0, -1.0, 1.0, 1.0), // UNDER_REAR_R
new MotorMixRule(1.0, -1.0, -1.0, -1.0), // UNDER_FRONT_R new MotorMixRule(1.0, -1.0, -1.0, -1.0), // UNDER_FRONT_R
new MotorMixRule(1.0, 1.0, 1.0, -1.0), // UNDER_REAR_L new MotorMixRule(1.0, 1.0, 1.0, -1.0), // UNDER_REAR_L
new MotorMixRule(1.0, 1.0, -1.0, 1.0), // UNDER_FRONT_L new MotorMixRule(1.0, 1.0, -1.0, 1.0), // UNDER_FRONT_L
] ],
servoMixer: []
}, // 11 }, // 11
{ {
name: 'Octo Flat +', name: 'Octo Flat +',
@ -149,15 +198,16 @@ const mixerList = [
hasCustomServoMixer: false, hasCustomServoMixer: false,
enabled: true, enabled: true,
motorMixer: [ motorMixer: [
new MotorMixRule(1.0, 0.707107, -0.707107, 1.0), // FRONT_L new MotorMixRule(1.0, 0.707107, -0.707107, 1.0), // FRONT_L
new MotorMixRule(1.0, -0.707107, -0.707107, 1.0), // FRONT_R new MotorMixRule(1.0, -0.707107, -0.707107, 1.0), // FRONT_R
new MotorMixRule(1.0, -0.707107, 0.707107, 1.0), // REAR_R new MotorMixRule(1.0, -0.707107, 0.707107, 1.0), // REAR_R
new MotorMixRule(1.0, 0.707107, 0.707107, 1.0), // REAR_L new MotorMixRule(1.0, 0.707107, 0.707107, 1.0), // REAR_L
new MotorMixRule(1.0, 0.0, -1.0, -1.0), // FRONT new MotorMixRule(1.0, 0.0, -1.0, -1.0), // FRONT
new MotorMixRule(1.0, -1.0, 0.0, -1.0), // RIGHT new MotorMixRule(1.0, -1.0, 0.0, -1.0), // RIGHT
new MotorMixRule(1.0, 0.0, 1.0, -1.0), // REAR new MotorMixRule(1.0, 0.0, 1.0, -1.0), // REAR
new MotorMixRule(1.0, 1.0, 0.0, -1.0), // LEFT new MotorMixRule(1.0, 1.0, 0.0, -1.0), // LEFT
] ],
servoMixer: []
}, // 12 }, // 12
{ {
name: 'Octo Flat X', name: 'Octo Flat X',
@ -166,15 +216,16 @@ const mixerList = [
hasCustomServoMixer: false, hasCustomServoMixer: false,
enabled: true, enabled: true,
motorMixer: [ motorMixer: [
new MotorMixRule(1.0, 1.0, -0.414178, 1.0), // MIDFRONT_L new MotorMixRule(1.0, 1.0, -0.414178, 1.0), // MIDFRONT_L
new MotorMixRule(1.0, -0.414178, -1.0, 1.0), // FRONT_R new MotorMixRule(1.0, -0.414178, -1.0, 1.0), // FRONT_R
new MotorMixRule(1.0, -1.0, 0.414178, 1.0), // MIDREAR_R new MotorMixRule(1.0, -1.0, 0.414178, 1.0), // MIDREAR_R
new MotorMixRule(1.0, 0.414178, 1.0, 1.0), // REAR_L new MotorMixRule(1.0, 0.414178, 1.0, 1.0), // REAR_L
new MotorMixRule(1.0, 0.414178, -1.0, -1.0), // FRONT_L new MotorMixRule(1.0, 0.414178, -1.0, -1.0), // FRONT_L
new MotorMixRule(1.0, -1.0, -0.414178, -1.0), // MIDFRONT_R new MotorMixRule(1.0, -1.0, -0.414178, -1.0), // MIDFRONT_R
new MotorMixRule(1.0, -0.414178, 1.0, -1.0), // REAR_R new MotorMixRule(1.0, -0.414178, 1.0, -1.0), // REAR_R
new MotorMixRule(1.0, 1.0, 0.414178, -1.0), // MIDREAR_L new MotorMixRule(1.0, 1.0, 0.414178, -1.0), // MIDREAR_L
] ],
servoMixer: []
}, // 13 }, // 13
{ {
name: 'Airplane', name: 'Airplane',
@ -183,8 +234,16 @@ const mixerList = [
hasCustomServoMixer: false, hasCustomServoMixer: false,
enabled: true, enabled: true,
motorMixer: [ motorMixer: [
new MotorMixRule(1.0, 0.0, 0.0, 0.0), new MotorMixRule(1.0, 0.0, 0.0, 0.0),
new MotorMixRule(1.0, 0.0, 0.0, 0.0), new MotorMixRule(1.0, 0.0, 0.0, 0.0),
],
servoMixer: [
new ServoMixRule(SERVO_FLAPPERON_1, INPUT_STABILIZED_ROLL, 100, 0),
new ServoMixRule(SERVO_FLAPPERON_2, INPUT_STABILIZED_ROLL, 100, 0),
new ServoMixRule(SERVO_FLAPPERON_1, INPUT_FEATURE_FLAPS, 100, 0),
new ServoMixRule(SERVO_FLAPPERON_2, INPUT_FEATURE_FLAPS, -100, 0),
new ServoMixRule(SERVO_RUDDER, INPUT_STABILIZED_YAW, 100, 0),
new ServoMixRule(SERVO_ELEVATOR, INPUT_STABILIZED_PITCH, 100, 0)
] ]
}, // 14 }, // 14
{ {
@ -193,7 +252,8 @@ const mixerList = [
image: 'custom', image: 'custom',
hasCustomServoMixer: false, hasCustomServoMixer: false,
enabled: false, enabled: false,
motorMixer: [] motorMixer: [],
servoMixer: []
}, // 15 }, // 15
{ {
name: 'Heli 90', name: 'Heli 90',
@ -201,7 +261,8 @@ const mixerList = [
image: 'custom', image: 'custom',
hasCustomServoMixer: false, hasCustomServoMixer: false,
enabled: false, enabled: false,
motorMixer: [] motorMixer: [],
servoMixer: []
}, // 16 }, // 16
{ {
name: 'V-tail Quad', name: 'V-tail Quad',
@ -210,11 +271,12 @@ const mixerList = [
hasCustomServoMixer: false, hasCustomServoMixer: false,
enabled: true, enabled: true,
motorMixer: [ motorMixer: [
new MotorMixRule(1.0, -0.58, 0.58, 1.0), // REAR_R new MotorMixRule(1.0, -0.58, 0.58, 1.0), // REAR_R
new MotorMixRule(1.0, -0.46, -0.39, -0.5), // FRONT_R new MotorMixRule(1.0, -0.46, -0.39, -0.5), // FRONT_R
new MotorMixRule(1.0, 0.58, 0.58, -1.0), // REAR_L new MotorMixRule(1.0, 0.58, 0.58, -1.0), // REAR_L
new MotorMixRule(1.0, 0.46, -0.39, 0.5), // FRONT_L new MotorMixRule(1.0, 0.46, -0.39, 0.5), // FRONT_L
] ],
servoMixer: []
}, // 17 }, // 17
{ {
name: 'Hex H', name: 'Hex H',
@ -223,13 +285,14 @@ const mixerList = [
hasCustomServoMixer: false, hasCustomServoMixer: false,
enabled: true, enabled: true,
motorMixer: [ motorMixer: [
new MotorMixRule(1.0, -1.0, 1.0, -1.0), // REAR_R new MotorMixRule(1.0, -1.0, 1.0, -1.0), // REAR_R
new MotorMixRule(1.0, -1.0, -1.0, 1.0), // FRONT_R new MotorMixRule(1.0, -1.0, -1.0, 1.0), // FRONT_R
new MotorMixRule(1.0, 1.0, 1.0, 1.0), // REAR_L new MotorMixRule(1.0, 1.0, 1.0, 1.0), // REAR_L
new MotorMixRule(1.0, 1.0, -1.0, -1.0), // FRONT_L new MotorMixRule(1.0, 1.0, -1.0, -1.0), // FRONT_L
new MotorMixRule(1.0, 0.0, 0.0, 0.0), // RIGHT new MotorMixRule(1.0, 0.0, 0.0, 0.0), // RIGHT
new MotorMixRule(1.0, 0.0, 0.0, 0.0), // LEFT new MotorMixRule(1.0, 0.0, 0.0, 0.0), // LEFT
] ],
servoMixer: []
}, // 18 }, // 18
{ {
name: 'PPM to SERVO', name: 'PPM to SERVO',
@ -237,7 +300,8 @@ const mixerList = [
image: 'custom', image: 'custom',
hasCustomServoMixer: false, hasCustomServoMixer: false,
enabled: false, enabled: false,
motorMixer: [] motorMixer: [],
servoMixer: []
}, // 19 }, // 19
{ {
name: 'Dualcopter', name: 'Dualcopter',
@ -245,7 +309,8 @@ const mixerList = [
image: 'custom', image: 'custom',
hasCustomServoMixer: false, hasCustomServoMixer: false,
enabled: false, enabled: false,
motorMixer: [] motorMixer: [],
servoMixer: []
}, // 20 }, // 20
{ {
name: 'Singlecopter', name: 'Singlecopter',
@ -253,7 +318,8 @@ const mixerList = [
image: 'custom', image: 'custom',
hasCustomServoMixer: false, hasCustomServoMixer: false,
enabled: false, enabled: false,
motorMixer: [] motorMixer: [],
servoMixer: []
}, // 21 }, // 21
{ {
name: 'A-tail Quad', name: 'A-tail Quad',
@ -262,11 +328,12 @@ const mixerList = [
hasCustomServoMixer: false, hasCustomServoMixer: false,
enabled: true, enabled: true,
motorMixer: [ motorMixer: [
new MotorMixRule(1.0, 0.0, 1.0, 1.0), // REAR_R new MotorMixRule(1.0, 0.0, 1.0, 1.0), // REAR_R
new MotorMixRule(1.0, -1.0, -1.0, 0.0), // FRONT_R new MotorMixRule(1.0, -1.0, -1.0, 0.0), // FRONT_R
new MotorMixRule(1.0, 0.0, 1.0, -1.0), // REAR_L new MotorMixRule(1.0, 0.0, 1.0, -1.0), // REAR_L
new MotorMixRule(1.0, 1.0, -1.0, -0.0), // FRONT_L new MotorMixRule(1.0, 1.0, -1.0, -0.0), // FRONT_L
] ],
servoMixer: []
}, // 22 }, // 22
{ {
name: 'Custom', name: 'Custom',
@ -274,7 +341,8 @@ const mixerList = [
image: 'custom', image: 'custom',
hasCustomServoMixer: true, hasCustomServoMixer: true,
enabled: false, enabled: false,
motorMixer: [] motorMixer: [],
servoMixer: []
}, // 23 }, // 23
{ {
name: 'Custom Airplane', name: 'Custom Airplane',
@ -282,14 +350,16 @@ const mixerList = [
image: 'custom', image: 'custom',
hasCustomServoMixer: true, hasCustomServoMixer: true,
enabled: false, enabled: false,
motorMixer: [] motorMixer: [],
servoMixer: []
}, // 24 }, // 24
{ {
name: 'Custom Tricopter', name: 'Custom Tricopter',
model: 'custom', model: 'custom',
image: 'custom', image: 'custom',
hasCustomServoMixer: true, hasCustomServoMixer: true,
enabled: false, enabled: false,
motorMixer: [] motorMixer: [],
servoMixer: []
} // 25 } // 25
]; ];