Commit 5e4a1691 authored by Dylan Jones's avatar Dylan Jones
Browse files

Merge branch '6dof-mixer-upgrade' into 'master'

6DOF Mixer Upgrade

See merge request !1
parents bf7972c5 4f5a7ca7
......@@ -1939,6 +1939,12 @@
"controlAxisThrottle": {
"message": "Throttle [T]"
},
"controlAxisForward": {
"message": "Forward [F]"
},
"controlAxisLateral": {
"message": "Lateral [L]"
},
"radioChannelShort": {
"message": "CH "
},
......
theme: jekyll-theme-slate
\ No newline at end of file
......@@ -51,9 +51,9 @@ const mixerList = [
legacy: true,
platform: PLATFORM_TRICOPTER,
motorMixer: [
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), // LEFT
new MotorMixRule(1.0, 0.0, 0.0, 0.0, 1.333333, 0.0), // REAR
new MotorMixRule(1.0, 0.0, 0.0, -1.0, -0.666667, 0.0), // RIGHT
new MotorMixRule(1.0, 0.0, 0.0, 1.0, -0.666667, 0.0), // LEFT
],
servoMixer: [
new ServoMixRule(SERVO_RUDDER, INPUT_STABILIZED_YAW, 100, 0),
......@@ -68,10 +68,10 @@ const mixerList = [
legacy: true,
platform: PLATFORM_MULTIROTOR,
motorMixer: [
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), // REAR_L
new MotorMixRule(1.0, 1.0, -1.0, -1.0), // FRONT_L
new MotorMixRule(1.0, 0.0, 0.0, -1.0, 1.0, -1.0), // REAR_R
new MotorMixRule(1.0, 0.0, 0.0, -1.0, -1.0, 1.0), // FRONT_R
new MotorMixRule(1.0, 0.0, 0.0, 1.0, 1.0, 1.0), // REAR_L
new MotorMixRule(1.0, 0.0, 0.0, 1.0, -1.0, -1.0), // FRONT_L
],
servoMixer: []
}, // 3
......@@ -84,10 +84,10 @@ const mixerList = [
legacy: true,
platform: PLATFORM_MULTIROTOR,
motorMixer: [
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), // LEFT
new MotorMixRule(1.0, 0.0, -1.0, -1.0), // FRONT
new MotorMixRule(1.0, 0.0, 0.0, 0.0, 1.0, -1.0), // REAR
new MotorMixRule(1.0, 0.0, 0.0, -1.0, 0.0, 1.0), // RIGHT
new MotorMixRule(1.0, 0.0, 0.0, 1.0, 0.0, 1.0), // LEFT
new MotorMixRule(1.0, 0.0, 0.0, 0.0, -1.0, -1.0), // FRONT
],
servoMixer: []
}, // 2
......@@ -122,12 +122,12 @@ const mixerList = [
legacy: true,
platform: PLATFORM_MULTIROTOR,
motorMixer: [
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), // LEFT
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_LEFT
new MotorMixRule(1.0, 0.0, 0.0, 0.0, 1.333333, 1.0), // REAR
new MotorMixRule(1.0, 0.0, 0.0, -1.0, -0.666667, -1.0), // RIGHT
new MotorMixRule(1.0, 0.0, 0.0, 1.0, -0.666667, -1.0), // LEFT
new MotorMixRule(1.0, 0.0, 0.0, 0.0, 1.333333, -1.0), // UNDER_REAR
new MotorMixRule(1.0, 0.0, 0.0, -1.0, -0.666667, 1.0), // UNDER_RIGHT
new MotorMixRule(1.0, 0.0, 0.0, 1.0, -0.666667, 1.0), // UNDER_LEFT
],
servoMixer: []
}, // 6
......@@ -140,12 +140,12 @@ const mixerList = [
legacy: true,
platform: PLATFORM_MULTIROTOR,
motorMixer: [
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), // REAR_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), // REAR
new MotorMixRule(1.0, 0.0, 0.0, -0.866025, 0.5, 1.0), // REAR_R
new MotorMixRule(1.0, 0.0, 0.0, -0.866025, -0.5, -1.0), // FRONT_R
new MotorMixRule(1.0, 0.0, 0.0, 0.866025, 0.5, 1.0), // REAR_L
new MotorMixRule(1.0, 0.0, 0.0, 0.866025, -0.5, -1.0), // FRONT_L
new MotorMixRule(1.0, 0.0, 0.0, 0.0, -1.0, 1.0), // FRONT
new MotorMixRule(1.0, 0.0, 0.0, 0.0, 1.0, -1.0), // REAR
],
servoMixer: []
}, // 7
......@@ -158,8 +158,8 @@ const mixerList = [
legacy: true,
platform: PLATFORM_AIRPLANE,
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, 0.0, 0.0),
new MotorMixRule(1.0, 0.0, 0.0, 0.0, 0.0, 0.0),
],
servoMixer: [
new ServoMixRule(SERVO_FLAPPERON_1, INPUT_STABILIZED_ROLL, 50, 0),
......@@ -177,8 +177,8 @@ const mixerList = [
legacy: false,
platform: PLATFORM_AIRPLANE,
motorMixer: [
new MotorMixRule(1.0, 0.0, 0.0, 0.1),
new MotorMixRule(1.0, 0.0, 0.0, -0.1)
new MotorMixRule(1.0, 0.0, 0.0, 0.0, 0.0, 0.1),
new MotorMixRule(1.0, 0.0, 0.0, 0.0, 0.0, -0.1)
],
servoMixer: [
new ServoMixRule(SERVO_FLAPPERON_1, INPUT_STABILIZED_ROLL, 50, 0),
......@@ -196,10 +196,10 @@ const mixerList = [
legacy: true,
platform: PLATFORM_MULTIROTOR,
motorMixer: [
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, 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, 0.0, 0.0, 0.0, 1.0, -1.0), // REAR_TOP CW
new MotorMixRule(1.0, 0.0, 0.0, -1.0, -1.0, 0.0), // FRONT_R CCW
new MotorMixRule(1.0, 0.0, 0.0, 0.0, 1.0, 1.0), // REAR_BOTTOM CCW
new MotorMixRule(1.0, 0.0, 0.0, 1.0, -1.0, 0.0), // FRONT_L CW
],
servoMixer: []
}, // 9
......@@ -212,12 +212,12 @@ const mixerList = [
legacy: true,
platform: PLATFORM_MULTIROTOR,
motorMixer: [
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), // REAR_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), // LEFT
new MotorMixRule(1.0, 0.0, 0.0, -0.5, 0.866025, 1.0), // REAR_R
new MotorMixRule(1.0, 0.0, 0.0, -0.5, -0.866025, 1.0), // FRONT_R
new MotorMixRule(1.0, 0.0, 0.0, 0.5, 0.866025, -1.0), // REAR_L
new MotorMixRule(1.0, 0.0, 0.0, 0.5, -0.866025, -1.0), // FRONT_L
new MotorMixRule(1.0, 0.0, 0.0, -1.0, 0.0, -1.0), // RIGHT
new MotorMixRule(1.0, 0.0, 0.0, 1.0, 0.0, 1.0), // LEFT
],
servoMixer: []
}, // 10
......@@ -230,14 +230,14 @@ const mixerList = [
legacy: true,
platform: PLATFORM_MULTIROTOR,
motorMixer: [
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), // REAR_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_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_FRONT_L
new MotorMixRule(1.0, 0.0, 0.0, -1.0, 1.0, -1.0), // REAR_R
new MotorMixRule(1.0, 0.0, 0.0, -1.0, -1.0, 1.0), // FRONT_R
new MotorMixRule(1.0, 0.0, 0.0, 1.0, 1.0, 1.0), // REAR_L
new MotorMixRule(1.0, 0.0, 0.0, 1.0, -1.0, -1.0), // FRONT_L
new MotorMixRule(1.0, 0.0, 0.0, -1.0, 1.0, 1.0), // UNDER_REAR_R
new MotorMixRule(1.0, 0.0, 0.0, -1.0, -1.0, -1.0), // UNDER_FRONT_R
new MotorMixRule(1.0, 0.0, 0.0, 1.0, 1.0, -1.0), // UNDER_REAR_L
new MotorMixRule(1.0, 0.0, 0.0, 1.0, -1.0, 1.0), // UNDER_FRONT_L
],
servoMixer: []
}, // 11
......@@ -250,14 +250,14 @@ const mixerList = [
legacy: true,
platform: PLATFORM_MULTIROTOR,
motorMixer: [
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), // REAR_R
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, -1.0, 0.0, -1.0), // RIGHT
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, 0.0, 0.0, 0.707107, -0.707107, 1.0), // FRONT_L
new MotorMixRule(1.0, 0.0, 0.0, -0.707107, -0.707107, 1.0), // FRONT_R
new MotorMixRule(1.0, 0.0, 0.0, -0.707107, 0.707107, 1.0), // REAR_R
new MotorMixRule(1.0, 0.0, 0.0, 0.707107, 0.707107, 1.0), // REAR_L
new MotorMixRule(1.0, 0.0, 0.0, 0.0, -1.0, -1.0), // FRONT
new MotorMixRule(1.0, 0.0, 0.0, -1.0, 0.0, -1.0), // RIGHT
new MotorMixRule(1.0, 0.0, 0.0, 0.0, 1.0, -1.0), // REAR
new MotorMixRule(1.0, 0.0, 0.0, 1.0, 0.0, -1.0), // LEFT
],
servoMixer: []
}, // 12
......@@ -270,14 +270,14 @@ const mixerList = [
legacy: true,
platform: PLATFORM_MULTIROTOR,
motorMixer: [
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, -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), // FRONT_L
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, 1.0, 0.414178, -1.0), // MIDREAR_L
new MotorMixRule(1.0, 0.0, 0.0, 1.0, -0.414178, 1.0), // MIDFRONT_L
new MotorMixRule(1.0, 0.0, 0.0, -0.414178, -1.0, 1.0), // FRONT_R
new MotorMixRule(1.0, 0.0, 0.0, -1.0, 0.414178, 1.0), // MIDREAR_R
new MotorMixRule(1.0, 0.0, 0.0, 0.414178, 1.0, 1.0), // REAR_L
new MotorMixRule(1.0, 0.0, 0.0, 0.414178, -1.0, -1.0), // FRONT_L
new MotorMixRule(1.0, 0.0, 0.0, -1.0, -0.414178, -1.0), // MIDFRONT_R
new MotorMixRule(1.0, 0.0, 0.0, -0.414178, 1.0, -1.0), // REAR_R
new MotorMixRule(1.0, 0.0, 0.0, 1.0, 0.414178, -1.0), // MIDREAR_L
],
servoMixer: []
}, // 13
......@@ -290,8 +290,8 @@ const mixerList = [
legacy: true,
platform: PLATFORM_AIRPLANE,
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, 0.0, 0.0),
new MotorMixRule(1.0, 0.0, 0.0, 0.0, 0.0, 0.0),
],
servoMixer: [
new ServoMixRule(SERVO_ELEVATOR, INPUT_STABILIZED_PITCH, 100, 0),
......@@ -333,10 +333,10 @@ const mixerList = [
legacy: true,
platform: PLATFORM_MULTIROTOR,
motorMixer: [
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.58, 0.58, -1.0), // REAR_L
new MotorMixRule(1.0, 0.46, -0.39, 0.5), // FRONT_L
new MotorMixRule(1.0, 0.0, 0.0, -0.58, 0.58, 1.0), // REAR_R
new MotorMixRule(1.0, 0.0, 0.0, -0.46, -0.39, -0.5), // FRONT_R
new MotorMixRule(1.0, 0.0, 0.0, 0.58, 0.58, -1.0), // REAR_L
new MotorMixRule(1.0, 0.0, 0.0, 0.46, -0.39, 0.5), // FRONT_L
],
servoMixer: []
}, // 17
......@@ -349,12 +349,12 @@ const mixerList = [
legacy: true,
platform: PLATFORM_MULTIROTOR,
motorMixer: [
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), // REAR_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), // LEFT
new MotorMixRule(1.0, 0.0, 0.0, -1.0, 1.0, -1.0), // REAR_R
new MotorMixRule(1.0, 0.0, 0.0, -1.0, -1.0, 1.0), // FRONT_R
new MotorMixRule(1.0, 0.0, 0.0, 1.0, 1.0, 1.0), // REAR_L
new MotorMixRule(1.0, 0.0, 0.0, 1.0, -1.0, -1.0), // FRONT_L
new MotorMixRule(1.0, 0.0, 0.0, 0.0, 0.0, 0.0), // RIGHT
new MotorMixRule(1.0, 0.0, 0.0, 0.0, 0.0, 0.0), // LEFT
],
servoMixer: []
}, // 18
......@@ -400,10 +400,10 @@ const mixerList = [
legacy: true,
platform: PLATFORM_MULTIROTOR,
motorMixer: [
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, 0.0, 1.0, -1.0), // REAR_L
new MotorMixRule(1.0, 1.0, -1.0, -0.0), // FRONT_L
new MotorMixRule(1.0, 0.0, 0.0, 0.0, 1.0, 1.0), // REAR_R
new MotorMixRule(1.0, 0.0, 0.0, -1.0, -1.0, 0.0), // FRONT_R
new MotorMixRule(1.0, 0.0, 0.0, 0.0, 1.0, -1.0), // REAR_L
new MotorMixRule(1.0, 0.0, 0.0, 1.0, -1.0, -0.0), // FRONT_L
],
servoMixer: []
}, // 22
......@@ -449,8 +449,8 @@ const mixerList = [
legacy: false,
platform: PLATFORM_AIRPLANE,
motorMixer: [
new MotorMixRule(1.0, 0.0, 0.0, 0.3),
new MotorMixRule(1.0, 0.0, 0.0, -0.3)
new MotorMixRule(1.0, 0.0, 0.0, 0.0, 0.0, 0.3),
new MotorMixRule(1.0, 0.0, 0.0, 0.0, 0.0, -0.3)
],
servoMixer: [
new ServoMixRule(SERVO_ELEVATOR, INPUT_STABILIZED_PITCH, 100, 0),
......@@ -470,7 +470,7 @@ const mixerList = [
legacy: false,
platform: PLATFORM_AIRPLANE,
motorMixer: [
new MotorMixRule(1.0, 0.0, 0.0, 0.0),
new MotorMixRule(1.0, 0.0, 0.0, 0.0, 0.0, 0.0),
],
servoMixer: [
new ServoMixRule(2, INPUT_STABILIZED_ROLL, 100, 0),
......@@ -490,7 +490,7 @@ const mixerList = [
legacy: false,
platform: PLATFORM_AIRPLANE,
motorMixer: [
new MotorMixRule(1.0, 0.0, 0.0, 0.0),
new MotorMixRule(1.0, 0.0, 0.0, 0.0, 0.0, 0.0),
],
servoMixer: [
new ServoMixRule(2, INPUT_STABILIZED_ROLL, 100, 0),
......@@ -509,7 +509,7 @@ const mixerList = [
legacy: false,
platform: PLATFORM_AIRPLANE,
motorMixer: [
new MotorMixRule(1.0, 0.0, 0.0, 0.0),
new MotorMixRule(1.0, 0.0, 0.0, 0.0, 0.0, 0.0),
],
servoMixer: [
new ServoMixRule(SERVO_ELEVATOR, INPUT_STABILIZED_PITCH, 100, 0),
......@@ -526,7 +526,7 @@ const mixerList = [
legacy: false,
platform: PLATFORM_ROVER,
motorMixer: [
new MotorMixRule(1.0, 0.0, 0.0, 0.0),
new MotorMixRule(1.0, 0.0, 0.0, 0.0, 0.0, 0.0),
],
servoMixer: [
new ServoMixRule(3, INPUT_STABILIZED_YAW, 100, 0),
......@@ -541,7 +541,7 @@ const mixerList = [
legacy: false,
platform: PLATFORM_BOAT,
motorMixer: [
new MotorMixRule(1.0, 0.0, 0.0, 0.0),
new MotorMixRule(1.0, 0.0, 0.0, 0.0, 0.0, 0.0),
],
servoMixer: [
new ServoMixRule(3, INPUT_STABILIZED_YAW, 100, 0),
......@@ -557,7 +557,7 @@ const mixerList = [
legacy: false,
platform: PLATFORM_OTHER,
motorMixer: [
new MotorMixRule(1.0, 0.0, 0.0, 0.0),
new MotorMixRule(1.0, 0.0, 0.0, 0.0, 0.0, 0.0),
],
servoMixer: [
new ServoMixRule(3, INPUT_STABILIZED_YAW, 100, 0),
......@@ -694,6 +694,8 @@ helper.mixer = (function (mixerList) {
MOTOR_RULES.put(
new MotorMixRule(
r.getThrottle(),
r.getForward(),
r.getLateral(),
r.getRoll(),
r.getPitch(),
r.getYaw()
......
/*global $,constrain*/
'use strict';
var MotorMixRule = function (throttle, roll, pitch, yaw) {
var MotorMixRule = function (throttle, forward, lateral, roll, pitch, yaw) {
var self = {};
self.fromMsp = function (mspThrottle, mspRoll, mspPitch, mspYaw) {
self.fromMsp = function (mspThrottle, mspForward, mspLateral, mspRoll, mspPitch, mspYaw) {
throttle = mspThrottle / 1000;
forward = (mspForward / 1000) - 2;
lateral = (mspLateral / 1000) - 2;
roll = (mspRoll / 1000) - 2;
pitch = (mspPitch / 1000) - 2;
yaw = (mspYaw / 1000) - 2;
};
self.isUsed = function () {
return throttle !== 0;
return throttle !== 0 && forward !== 0 && lateral !== 0;
};
self.getThrottle = function () {
......@@ -28,6 +30,30 @@ var MotorMixRule = function (throttle, roll, pitch, yaw) {
throttle = data;
};
self.getForward = function () {
return constrain(parseFloat(forward, 10), -2, 2);
};
self.getForwardForMsp = function () {
return (self.getForward() + 2) * 1000;
};
self.setForward = function (data) {
forward = data;
};
self.getLateral = function () {
return constrain(parseFloat(lateral, 10), -2, 2);
};
self.getLateralForMsp = function () {
return (self.getLateral() + 2) * 1000;
};
self.setLateral = function (data) {
lateral = data;
};
self.getRoll = function () {
return constrain(parseFloat(roll, 10), -2, 2);
};
......
......@@ -25,6 +25,8 @@ var MotorMixerRuleCollection = function () {
self.drop = function (index) {
data[index].setThrottle(0);
data[index].setForward(0);
data[index].setLateral(0);
self.cleanup();
};
......@@ -46,7 +48,7 @@ var MotorMixerRuleCollection = function () {
self.inflate = function () {
while (self.hasFreeSlots()) {
self.put(new MotorMixRule(0, 0, 0, 0));
self.put(new MotorMixRule(0, 0, 0, 0, 0, 0));
}
};
......
......@@ -574,20 +574,23 @@ var mspHelper = (function (gui) {
case MSPCodes.MSP2_COMMON_MOTOR_MIXER:
MOTOR_RULES.flush();
if (data.byteLength % 8 === 0) {
for (i = 0; i < data.byteLength; i += 8) {
var rule = new MotorMixRule(0, 0, 0, 0);
if (data.byteLength % 12 === 0) {
for (i = 0; i < data.byteLength; i += 12) {
var rule = new MotorMixRule(0, 0, 0, 0, 0, 0);
rule.fromMsp(
data.getUint16(i, true),
data.getUint16(i + 2, true),
data.getUint16(i + 4, true),
data.getUint16(i + 6, true)
data.getUint16(i + 6, true),
data.getUint16(i + 8, true),
data.getUint16(i + 10, true)
);
MOTOR_RULES.put(rule);
}
}
console.log(MOTOR_RULES)
MOTOR_RULES.cleanup();
break;
......@@ -2327,6 +2330,12 @@ var mspHelper = (function (gui) {
buffer.push(lowByte(rule.getThrottleForMsp()));
buffer.push(highByte(rule.getThrottleForMsp()));
buffer.push(lowByte(rule.getForwardForMsp()));
buffer.push(highByte(rule.getForwardForMsp()));
buffer.push(lowByte(rule.getLateralForMsp()));
buffer.push(highByte(rule.getLateralForMsp()));
buffer.push(lowByte(rule.getRollForMsp()));
buffer.push(highByte(rule.getRollForMsp()));
......
......@@ -82,6 +82,8 @@
<tr>
<th style="width: 75px">Motor</th>
<th data-i18n="controlAxisThrottle"></th>
<th data-i18n="controlAxisForward"></th>
<th data-i18n="controlAxisLateral"></th>
<th data-i18n="controlAxisRoll"></th>
<th data-i18n="controlAxisPitch"></th>
<th data-i18n="controlAxisYaw"></th>
......
......@@ -204,6 +204,8 @@ TABS.mixer.initialize = function (callback, scrollPosition) {
<tr>\
<td><span class="mix-rule-motor"></span></td>\
<td><input type="number" class="mix-rule-throttle" step="0.001" min="0" max="1" /></td>\
<td><input type="number" class="mix-rule-forward" step="0.001" min="-2" max="2" /></td>\
<td><input type="number" class="mix-rule-lateral" step="0.001" min="-2" max="2" /></td>\
<td><input type="number" class="mix-rule-roll" step="0.001" min="-2" max="2" /></td>\
<td><input type="number" class="mix-rule-pitch" step="0.001" min="-2" max="2" /></td>\
<td><input type="number" class="mix-rule-yaw" step="0.001" min="-2" max="2" /></td>\
......@@ -214,16 +216,22 @@ TABS.mixer.initialize = function (callback, scrollPosition) {
const $row = $motorMixTableBody.find('tr:last');
$row.find('.mix-rule-motor').html(index);
$row.find('.mix-rule-throttle').val(rule.getThrottle()).change(function () {
$row.find('.mix-rule-throttle').val(rule.getThrottle().toFixed(3)).change(function () {
rule.setThrottle($(this).val());
});
$row.find('.mix-rule-roll').val(rule.getRoll()).change(function () {
$row.find('.mix-rule-forward').val(rule.getForward().toFixed(3)).change(function () {
rule.setForward($(this).val());
});
$row.find('.mix-rule-lateral').val(rule.getLateral().toFixed(3)).change(function () {
rule.setLateral($(this).val());
});
$row.find('.mix-rule-roll').val(rule.getRoll().toFixed(3)).change(function () {
rule.setRoll($(this).val());
});
$row.find('.mix-rule-pitch').val(rule.getPitch()).change(function () {
$row.find('.mix-rule-pitch').val(rule.getPitch().toFixed(3)).change(function () {
rule.setPitch($(this).val());
});
$row.find('.mix-rule-yaw').val(rule.getYaw()).change(function () {
$row.find('.mix-rule-yaw').val(rule.getYaw().toFixed(3)).change(function () {
rule.setYaw($(this).val());
});
$row.find("[data-role='role-motor-delete']").attr("data-index", i);
......@@ -331,6 +339,8 @@ TABS.mixer.initialize = function (callback, scrollPosition) {
MOTOR_RULES.put(
new MotorMixRule(
r.getThrottle(),
r.getForward(),
r.getLateral(),
r.getRoll(),
r.getPitch(),
r.getYaw()
......@@ -461,7 +471,7 @@ TABS.mixer.initialize = function (callback, scrollPosition) {
$("[data-role='role-motor-add']").click(function () {
if (MOTOR_RULES.hasFreeSlots()) {
MOTOR_RULES.put(new MotorMixRule(1, 0, 0, 0));
MOTOR_RULES.put(new MotorMixRule(1, 0, 0, 0, 0, 0));
renderMotorMixRules();
renderOutputMapping();
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment