You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
52 lines
955 B
JavaScript
52 lines
955 B
JavaScript
7 years ago
|
/*global $*/
|
||
|
'use strict';
|
||
|
|
||
|
var MotorMixRule = function (throttle, roll, pitch, yaw) {
|
||
|
|
||
|
var self = {};
|
||
|
|
||
|
self.fromMsp = function (mspThrottle, mspRoll, mspPitch, mspYaw) {
|
||
|
throttle = mspThrottle / 1000;
|
||
|
roll = (mspRoll / 1000) - 1;
|
||
|
pitch = (mspPitch / 1000) - 1;
|
||
|
yaw = (mspYaw / 1000) - 1;
|
||
|
};
|
||
|
|
||
|
self.isUsed = function () {
|
||
|
return throttle !== 0;
|
||
|
};
|
||
|
|
||
|
self.getThrottle = function () {
|
||
|
return throttle;
|
||
|
};
|
||
|
|
||
|
self.setThrottle = function (data) {
|
||
|
throttle = data;
|
||
|
};
|
||
|
|
||
|
self.getRoll = function () {
|
||
|
return roll;
|
||
|
};
|
||
|
|
||
|
self.setRoll = function (data) {
|
||
|
roll = data;
|
||
|
};
|
||
|
|
||
|
self.getPitch = function () {
|
||
|
return pitch;
|
||
|
};
|
||
|
|
||
|
self.setPitch = function (data) {
|
||
|
pitch = data;
|
||
|
};
|
||
|
|
||
|
self.getYaw = function () {
|
||
|
return yaw;
|
||
|
};
|
||
|
|
||
|
self.setYaw = function (data) {
|
||
|
yaw = data;
|
||
|
};
|
||
|
|
||
|
return self;
|
||
|
};
|