Merge pull request #10 from iNavFlight/master

merge from master
pull/1145/head
Darren Lines 4 years ago committed by GitHub
commit 71a13c96a3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -2554,6 +2554,18 @@
"pitchToThrottleHelp": {
"message": "In navigation modes, each degree of climb will add this many units to the cruise throttle. Conversely, each degree of diving will substract from it."
},
"pitchToThrottleSmoothing": {
"message": "Throttle smoothing"
},
"pitchToThrottleSmoothingHelp": {
"message": "How smoothly the autopilot adjusts the throttle level in response to pitch angle changes [0-9]."
},
"pitchToThrottleThreshold": {
"message": "Instantaneous pitch adjustment threshold [centidegrees]"
},
"pitchToThrottleThresholdHelp": {
"message": "The autopilot will instantly adjust the throttle level according to pitch to throttle if the pitch angle is more this many centidegrees from the filtered value."
}
"loiterRadius": {
"message": "Loiter radius [cm]"
},
@ -2567,7 +2579,7 @@
"message": "Control Smoothness"
},
"controlSmoothnessHelp": {
"message": "How smoothly the autopilot controls the airplane to correct the navigation error [0-9]"
"message": "How smoothly the autopilot controls the airplane to correct the navigation error [0-9]."
},
"waypointConfiguration": {
"message": "Waypoint Navigation Settings"
@ -2579,7 +2591,7 @@
"message": "This sets the distance away from a waypoint that triggers the waypoint as reached."
},
"waypointSafeDistance": {
"message": "Waypoint safe distance [cm]"
"message": "Waypoint safe distance [cm]."
},
"waypointSafeDistanceHelp": {
"message": "The maximum distance between the home point and the first waypoint."

@ -106,6 +106,8 @@ sources.js = [
'./js/logicConditionsCollection.js',
'./js/logicConditionsStatus.js',
'./js/globalVariablesStatus.js',
'./js/programmingPid.js',
'./js/programmingPidCollection.js',
'./js/vtx.js',
'./main.js',
'./js/tabs.js',

@ -61,10 +61,6 @@ helper.defaultsDialog = (function() {
key: "dterm_lpf2_type",
value: "PT1"
},
{
key: "use_dterm_fir_filter",
value: "OFF"
},
{
key: "dynamic_gyro_notch_enabled",
value: "ON"
@ -92,14 +88,6 @@ helper.defaultsDialog = (function() {
key: "mc_airmode_type",
value: "THROTTLE_THRESHOLD"
},
{
key: "dterm_setpoint_weight",
value: 0.75
},
{
key: "mc_iterm_relax_type",
value: "SETPOINT"
},
{
key: "mc_iterm_relax",
value: "RP"
@ -201,6 +189,30 @@ helper.defaultsDialog = (function() {
"id": 3,
"reboot": true,
"settings": [
{
key: "gyro_hardware_lpf",
value: "256HZ"
},
{
key: "gyro_lpf_hz",
value: 25
},
{
key: "gyro_lpf_type",
value: "BIQUAD"
},
{
key: "dynamic_gyro_notch_enabled",
value: "ON"
},
{
key: "dynamic_gyro_notch_q",
value: 250
},
{
key: "dynamic_gyro_notch_min_hz",
value: 30
},
{
key: "motor_pwm_protocol",
value: "STANDARD"
@ -256,6 +268,10 @@ helper.defaultsDialog = (function() {
{
key: "applied_defaults",
value: 3
},
{
key: "imu_acc_ignore_rate",
value: 10
}
],
"features":[
@ -270,6 +286,18 @@ helper.defaultsDialog = (function() {
"notRecommended": false,
"reboot": true,
"settings": [
{
key: "gyro_hardware_lpf",
value: "256HZ"
},
{
key: "gyro_lpf_hz",
value: 10
},
{
key: "gyro_lpf_type",
value: "BIQUAD"
},
{
key: "motor_pwm_protocol",
value: "STANDARD"

@ -23,6 +23,7 @@ var CONFIG,
LOGIC_CONDITIONS_STATUS,
GLOBAL_FUNCTIONS,
GLOBAL_VARIABLES_STATUS,
PROGRAMMING_PID,
SERIAL_CONFIG,
SENSOR_DATA,
MOTOR_DATA,
@ -177,6 +178,7 @@ var FC = {
LOGIC_CONDITIONS = new LogicConditionsCollection();
LOGIC_CONDITIONS_STATUS = new LogicConditionsStatus();
GLOBAL_VARIABLES_STATUS = new GlobalVariablesStatus();
PROGRAMMING_PID = new ProgrammingPidCollection();
MIXER_CONFIG = {
yawMotorDirection: 0,
@ -1315,6 +1317,12 @@ var FC = {
type: "range",
range: [0, 7],
default: 0
},
6: {
name: "Programming PID",
type: "range",
range: [0, 3],
default: 0
}
}
}

@ -211,6 +211,8 @@ var MSPCodes = {
MSP2_INAV_SET_GLOBAL_FUNCTIONS: 0x2025,
MSP2_INAV_LOGIC_CONDITIONS_STATUS: 0x2026,
MSP2_INAV_GVAR_STATUS: 0x2027,
MSP2_INAV_PROGRAMMING_PID: 0x2028,
MSP2_INAV_SET_PROGRAMMING_PID: 0x2029,
MSP2_PID: 0x2030,
MSP2_SET_PID: 0x2031,

@ -537,6 +537,29 @@ var mspHelper = (function (gui) {
console.log("Logic conditions saved");
break;
case MSPCodes.MSP2_INAV_PROGRAMMING_PID:
PROGRAMMING_PID.flush();
if (data.byteLength % 19 === 0) {
for (i = 0; i < data.byteLength; i += 19) {
PROGRAMMING_PID.put(new ProgrammingPid(
data.getInt8(i), // enabled
data.getInt8(i + 1), // setpointType
data.getInt32(i + 2, true), // setpointValue
data.getInt8(i + 6), // measurementType
data.getInt32(i + 7, true), // measurementValue
data.getInt16(i + 11, true), // gainP
data.getInt16(i + 13, true), // gainI
data.getInt16(i + 15, true), // gainD
data.getInt16(i + 17, true) // gainFF
));
}
}
break;
case MSPCodes.MSP2_INAV_SET_PROGRAMMING_PID:
console.log("Programming PID saved");
break;
case MSPCodes.MSP2_COMMON_MOTOR_MIXER:
MOTOR_RULES.flush();
@ -2363,6 +2386,58 @@ var mspHelper = (function (gui) {
}
};
self.loadProgrammingPid = function (callback) {
MSP.send_message(MSPCodes.MSP2_INAV_PROGRAMMING_PID, false, false, callback);
}
self.sendProgrammingPid = function (onCompleteCallback) {
let nextFunction = sendPid,
pidIndex = 0;
if (PROGRAMMING_PID.getCount() == 0) {
onCompleteCallback();
} else {
nextFunction();
}
function sendPid() {
let buffer = [];
// send one at a time, with index, 20 bytes per one condition
let pid = PROGRAMMING_PID.get()[pidIndex];
buffer.push(pidIndex);
buffer.push(pid.getEnabled());
buffer.push(pid.getSetpointType());
buffer.push(specificByte(pid.getSetpointValue(), 0));
buffer.push(specificByte(pid.getSetpointValue(), 1));
buffer.push(specificByte(pid.getSetpointValue(), 2));
buffer.push(specificByte(pid.getSetpointValue(), 3));
buffer.push(pid.getMeasurementType());
buffer.push(specificByte(pid.getMeasurementValue(), 0));
buffer.push(specificByte(pid.getMeasurementValue(), 1));
buffer.push(specificByte(pid.getMeasurementValue(), 2));
buffer.push(specificByte(pid.getMeasurementValue(), 3));
buffer.push(specificByte(pid.getGainP(), 0));
buffer.push(specificByte(pid.getGainP(), 1));
buffer.push(specificByte(pid.getGainI(), 0));
buffer.push(specificByte(pid.getGainI(), 1));
buffer.push(specificByte(pid.getGainD(), 0));
buffer.push(specificByte(pid.getGainD(), 1));
buffer.push(specificByte(pid.getGainFF(), 0));
buffer.push(specificByte(pid.getGainFF(), 1));
// prepare for next iteration
pidIndex++;
if (pidIndex == PROGRAMMING_PID.getCount()) { //This is the last rule. Not pretty, but we have to send all rules
nextFunction = onCompleteCallback;
}
MSP.send_message(MSPCodes.MSP2_INAV_SET_PROGRAMMING_PID, buffer, false, nextFunction);
}
};
self.sendModeRanges = function (onCompleteCallback) {
var nextFunction = send_next_mode_range;

@ -97,14 +97,6 @@ presets.presets = [
key: "dterm_lpf2_type",
value: "PT1"
},
{
key: "use_dterm_fir_filter",
value: "OFF"
},
{
key: "mc_iterm_relax_type",
value: "SETPOINT"
},
{
key: "mc_iterm_relax",
value: "RP"
@ -204,10 +196,6 @@ presets.presets = [
{
key: "throttle_idle",
value: 12
},
{
key: "dterm_setpoint_weight",
value: 0.500
}
],
type: 'multirotor'
@ -259,14 +247,6 @@ presets.presets = [
key: "dterm_lpf_type",
value: "PT1"
},
{
key: "use_dterm_fir_filter",
value: "OFF"
},
{
key: "mc_iterm_relax_type",
value: "SETPOINT"
},
{
key: "mc_iterm_relax",
value: "RP"
@ -366,10 +346,6 @@ presets.presets = [
{
key: "throttle_idle",
value: 12
},
{
key: "dterm_setpoint_weight",
value: 0.850
}
],
type: 'multirotor'
@ -429,14 +405,6 @@ presets.presets = [
key: "dterm_lpf2_type",
value: "PT1"
},
{
key: "use_dterm_fir_filter",
value: "OFF"
},
{
key: "mc_iterm_relax_type",
value: "SETPOINT"
},
{
key: "mc_iterm_relax",
value: "RPY"
@ -536,10 +504,6 @@ presets.presets = [
{
key: "throttle_idle",
value: 12
},
{
key: "dterm_setpoint_weight",
value: 0.800
}
],
type: 'multirotor'
@ -604,14 +568,6 @@ presets.presets = [
key: "dterm_lpf2_type",
value: "PT1"
},
{
key: "use_dterm_fir_filter",
value: "OFF"
},
{
key: "mc_iterm_relax_type",
value: "SETPOINT"
},
{
key: "mc_iterm_relax",
value: "RPY"
@ -712,10 +668,6 @@ presets.presets = [
key: "throttle_idle",
value: 12
},
{
key: "dterm_setpoint_weight",
value: 0.300
},
{
key: "heading_hold_rate_limit",
value: 30
@ -786,14 +738,6 @@ presets.presets = [
key: "dterm_lpf2_type",
value: "PT1"
},
{
key: "use_dterm_fir_filter",
value: "OFF"
},
{
key: "mc_iterm_relax_type",
value: "GYRO"
},
{
key: "mc_iterm_relax",
value: "RP"
@ -893,10 +837,6 @@ presets.presets = [
{
key: "throttle_idle",
value: 12
},
{
key: "dterm_setpoint_weight",
value: 0.400
}
],
type: 'multirotor'
@ -956,14 +896,6 @@ presets.presets = [
key: "dterm_lpf2_type",
value: "PT1"
},
{
key: "use_dterm_fir_filter",
value: "OFF"
},
{
key: "mc_iterm_relax_type",
value: "SETPOINT"
},
{
key: "mc_iterm_relax",
value: "RP"
@ -1063,10 +995,6 @@ presets.presets = [
{
key: "throttle_idle",
value: 12
},
{
key: "dterm_setpoint_weight",
value: 0.850
}
],
type: 'multirotor'
@ -1126,14 +1054,6 @@ presets.presets = [
key: "dterm_lpf2_type",
value: "PT1"
},
{
key: "use_dterm_fir_filter",
value: "OFF"
},
{
key: "mc_iterm_relax_type",
value: "SETPOINT"
},
{
key: "mc_iterm_relax",
value: "RP"
@ -1233,10 +1153,6 @@ presets.presets = [
{
key: "throttle_idle",
value: 12
},
{
key: "dterm_setpoint_weight",
value: 0.700
}
],
type: 'multirotor'
@ -1257,6 +1173,30 @@ presets.presets = [
presets.elementHelper("INAV_PID_CONFIG", "gyroscopeLpf", 1)
],
settings: [
{
key: "gyro_hardware_lpf",
value: "256HZ"
},
{
key: "gyro_lpf_hz",
value: 25
},
{
key: "dynamic_gyro_notch_enabled",
value: "ON"
},
{
key: "dynamic_gyro_notch_q",
value: 250
},
{
key: "dynamic_gyro_notch_min_hz",
value: 30
},
{
key: "gyro_lpf_type",
value: "BIQUAD"
},
{
key: "platform_type",
value: "AIRPLANE"
@ -1268,6 +1208,10 @@ presets.presets = [
{
key: "manual_rc_expo",
value: 30
},
{
key: "imu_acc_ignore_rate",
value: 10
}
],
type: 'airplane'
@ -1289,6 +1233,30 @@ presets.presets = [
presets.elementHelper("INAV_PID_CONFIG", "gyroscopeLpf", 4)
],
settings: [
{
key: "gyro_hardware_lpf",
value: "256HZ"
},
{
key: "gyro_lpf_hz",
value: 25
},
{
key: "dynamic_gyro_notch_enabled",
value: "ON"
},
{
key: "dynamic_gyro_notch_q",
value: 250
},
{
key: "dynamic_gyro_notch_min_hz",
value: 30
},
{
key: "gyro_lpf_type",
value: "BIQUAD"
},
{
key: "platform_type",
value: "AIRPLANE"
@ -1324,6 +1292,10 @@ presets.presets = [
{
key: "manual_rc_expo",
value: 30
},
{
key: "imu_acc_ignore_rate",
value: 10
}
],
type: 'flyingwing'
@ -1346,6 +1318,30 @@ presets.presets = [
presets.elementHelper("RC_tuning", "dynamic_THR_breakpoint", 1600)
],
settings: [
{
key: "gyro_hardware_lpf",
value: "256HZ"
},
{
key: "gyro_lpf_hz",
value: 25
},
{
key: "dynamic_gyro_notch_enabled",
value: "ON"
},
{
key: "dynamic_gyro_notch_q",
value: 250
},
{
key: "dynamic_gyro_notch_min_hz",
value: 30
},
{
key: "gyro_lpf_type",
value: "BIQUAD"
},
{
key: "platform_type",
value: "AIRPLANE"
@ -1381,6 +1377,10 @@ presets.presets = [
{
key: "manual_rc_expo",
value: 30
},
{
key: "imu_acc_ignore_rate",
value: 10
}
],
type: 'flyingwing'
@ -1403,6 +1403,30 @@ presets.presets = [
presets.elementHelper("RC_tuning", "dynamic_THR_breakpoint", 1550)
],
settings: [
{
key: "gyro_hardware_lpf",
value: "256HZ"
},
{
key: "gyro_lpf_hz",
value: 25
},
{
key: "dynamic_gyro_notch_enabled",
value: "ON"
},
{
key: "dynamic_gyro_notch_q",
value: 250
},
{
key: "dynamic_gyro_notch_min_hz",
value: 30
},
{
key: "gyro_lpf_type",
value: "BIQUAD"
},
{
key: "platform_type",
value: "AIRPLANE"
@ -1438,6 +1462,10 @@ presets.presets = [
{
key: "manual_rc_expo",
value: 30
},
{
key: "imu_acc_ignore_rate",
value: 10
}
],
type: 'flyingwing'
@ -1460,6 +1488,30 @@ presets.presets = [
presets.elementHelper("RC_tuning", "dynamic_THR_breakpoint", 1500)
],
settings: [
{
key: "gyro_hardware_lpf",
value: "256HZ"
},
{
key: "gyro_lpf_hz",
value: 25
},
{
key: "dynamic_gyro_notch_enabled",
value: "ON"
},
{
key: "dynamic_gyro_notch_q",
value: 250
},
{
key: "dynamic_gyro_notch_min_hz",
value: 30
},
{
key: "gyro_lpf_type",
value: "BIQUAD"
},
{
key: "platform_type",
value: "AIRPLANE"
@ -1499,6 +1551,10 @@ presets.presets = [
{
key: "rc_yaw_expo",
value: 20
},
{
key: "imu_acc_ignore_rate",
value: 10
}
],
type: 'flyingwing'
@ -1519,6 +1575,30 @@ presets.presets = [
presets.elementHelper("RC_tuning", "pitch_rate", 120)
],
settings: [
{
key: "gyro_hardware_lpf",
value: "256HZ"
},
{
key: "gyro_lpf_hz",
value: 25
},
{
key: "dynamic_gyro_notch_enabled",
value: "ON"
},
{
key: "dynamic_gyro_notch_q",
value: 250
},
{
key: "dynamic_gyro_notch_min_hz",
value: 30
},
{
key: "gyro_lpf_type",
value: "BIQUAD"
},
{
key: "platform_type",
value: "AIRPLANE"
@ -1554,6 +1634,10 @@ presets.presets = [
{
key: "manual_rc_expo",
value: 30
},
{
key: "imu_acc_ignore_rate",
value: 10
}
],
type: 'flyingwing'

@ -0,0 +1,80 @@
/*global $,FC*/
'use strict';
let ProgrammingPid = function (enabled, setpointType, setpointValue, measurementType, measurementValue, gainP, gainI, gainD, gainFF) {
let self = {};
self.getEnabled = function () {
return !!enabled;
};
self.setEnabled = function (data) {
enabled = !!data;
};
self.getSetpointType = function () {
return setpointType;
};
self.setSetpointType = function (data) {
setpointType = data;
};
self.getSetpointValue = function () {
return setpointValue;
};
self.setSetpointValue = function (data) {
setpointValue = data;
};
self.getMeasurementType = function () {
return measurementType;
};
self.setMeasurementType = function (data) {
measurementType = data;
};
self.getMeasurementValue = function () {
return measurementValue;
};
self.setMeasurementValue = function (data) {
measurementValue = data;
};
self.getGainP = function () {
return gainP;
};
self.setGainP = function (data) {
gainP = data;
};
self.getGainI = function () {
return gainI;
};
self.setGainI = function (data) {
gainI = data;
};
self.getGainD = function () {
return gainD;
};
self.setGainD = function (data) {
gainD = data;
};
self.getGainFF = function () {
return gainFF;
};
self.setGainFF = function (data) {
gainFF = data;
};
return self;
};

@ -0,0 +1,33 @@
'use strict';
let ProgrammingPidCollection = function () {
let self = {},
data = [],
$container;
self.put = function (element) {
data.push(element);
};
self.get = function () {
return data;
};
self.flush = function () {
data = [];
};
self.getCount = function () {
return data.length
};
self.open = function () {
self.render();
$container.show();
};
return self;
};

@ -386,6 +386,22 @@
</label>
<div class="helpicon cf_tip" data-i18n_title="pitchToThrottleHelp"></div>
</div>
<div class="number">
<input id="pitchToThrottleSmoothing" type="number" data-simple-bind="nav_fw_pitch2thr_smoothing" data-setting-multiplier="1" step="0" min="0" max="9">
<label for="pitchToThrottleSmoothing">
<span data-i18n="pitchToThrottleSmoothing"></span>
</label>
<div class="helpicon cf_tip" data-i18n_title="pitchToThrottleSmoothingHelp"></div>
</div>
<div class="number">
<input id="pitchToThrottleThreshold" type="number" data-simple-bind="nav_fw_pitch2thr_threshold" data-setting-multiplier="1" step="1" min="0" max="900">
<label for="pitchToThrottleThreshold">
<span data-i18n="pitchToThrottleThreshold"></span>
</label>
<div class="helpicon cf_tip" data-i18n_title="pitchToThrottleThresholdHelp"></div>
</div>
<div class="number">
<input id="loiterRadius" type="number" data-simple-bind="FW_CONFIG.loiterRadius" step="1" min="0" max="10000">

@ -12,8 +12,8 @@
<div class="spacer_box_title" data-i18n="configurationSystem"></div>
</div>
<div class="spacer_box">
<div id="gyrolpf-info" class="info-box"></div>
<div class="select">
<div id="gyrolpf-info" class="info-box is-hidden"></div>
<div class="select is-hidden">
<select id="gyro-lpf"></select>
<label for="gyro-lpf"> <span data-i18n="configurationGyroLpfTitle"></span></label>
<div class="helpicon cf_tip" data-i18n_title="configurationGyroLpfHelp"></div>

Loading…
Cancel
Save