Skip to content

update feedforward and dynamic idle debug headers and graphs for 4.3 #521

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions js/flightlog_fielddefs.js
Original file line number Diff line number Diff line change
Expand Up @@ -492,6 +492,10 @@ function adjustFieldDefsList(firmwareType, firmwareVersion) {
DEBUG_MODE.splice(DEBUG_MODE.indexOf('DUAL_GYRO'), 1);
DEBUG_MODE.splice(DEBUG_MODE.indexOf('DUAL_GYRO_COMBINED'), 1);
}
if(semver.gte(firmwareVersion, '4.3.0')) {
DEBUG_MODE.splice(DEBUG_MODE.indexOf('FF_INTERPOLATED'), 1, 'FEEDFORWARD');
DEBUG_MODE.splice(DEBUG_MODE.indexOf('FF_LIMIT'), 1, 'FEEDFORWARD_LIMIT');
}
DEBUG_MODE = makeReadOnly(DEBUG_MODE);

// Flight mode names
Expand Down
94 changes: 75 additions & 19 deletions js/flightlog_fields_presenter.js
Original file line number Diff line number Diff line change
Expand Up @@ -400,21 +400,21 @@ function FlightLogFieldPresenter() {
'debug[0]':'Motor Range Min Inc',
'debug[1]':'Target RPS Change Rate',
'debug[2]':'Error',
'debug[3]':'Min RPS',
'debug[3]':'Min RPM',
},
'FF_LIMIT' : {
'debug[all]':'FF Limit',
'debug[0]':'FF [Roll]',
'debug[1]':'FF [Pitch]',
'debug[2]':'FF Final [Roll]',
'debug[0]':'FF input [roll]',
'debug[1]':'FF input [pitch]',
'debug[2]':'FF limited [roll]',
'debug[3]':'Not Used',
},
'FF_INTERPOLATED' : {
'debug[all]':'FF Interpolated',
'debug[0]':'Setpoint Delta Impl [Roll]',
'debug[1]':'Boost Amount',
'debug[2]':'Boost Amount Clip [Roll]',
'debug[3]':'Clip',
'debug[all]':'FF Interpolated [roll]',
'debug[0]':'Setpoint Delta Impl [roll]',
'debug[1]':'Boost amount [roll]',
'debug[2]':'Boost amount, clipped [roll]',
'debug[3]':'Clip amount [roll]',
},
'RTH' : {
'debug[all]':'RTH',
Expand All @@ -431,16 +431,63 @@ function FlightLogFieldPresenter() {

DEBUG_FRIENDLY_FIELD_NAMES = {...DEBUG_FRIENDLY_FIELD_NAMES_INITIAL};

if (firmwareType === FIRMWARE_TYPE_BETAFLIGHT && semver.gte(firmwareVersion, '4.3.0')) {
DEBUG_FRIENDLY_FIELD_NAMES.FF_INTERPOLATED = {
'debug[0]':'Raw FF Derivative [Roll]',
'debug[1]':'Cleaned FF Derivative ',
'debug[2]':'Cleaned Boost Amount [Roll]',
'debug[3]':'Duplicate Marker',
};
if (firmwareType === FIRMWARE_TYPE_BETAFLIGHT) {
if (semver.gte(firmwareVersion, '4.3.0')) {
DEBUG_FRIENDLY_FIELD_NAMES.FEEDFORWARD = {
'debug[all]':'Feedforward [roll]',
'debug[0]':'Setpoint, interpolated [roll]',
'debug[1]':'Delta, smoothed [roll]',
'debug[2]':'Boost, smoothed [roll]',
'debug[3]':'rcCommand Delta [roll]',
};
DEBUG_FRIENDLY_FIELD_NAMES.FEEDFORWARD_LIMIT = {
'debug[all]':'Feedforward Limit [roll]',
'debug[0]':'Feedforward input [roll]',
'debug[1]':'Feedforward input [pitch]',
'debug[2]':'Feedforward limited [roll]',
'debug[3]':'Not Used',
};
DEBUG_FRIENDLY_FIELD_NAMES.DYN_IDLE = {
'debug[all]':'Dyn Idle',
'debug[0]':'Dyn Idle P [roll]',
'debug[1]':'Dyn Idle I [roll]',
'debug[2]':'Dyn Idle D [roll]',
'debug[3]':'Min RPM',
};
} else if (semver.gte(firmwareVersion, '4.2.0')) {
DEBUG_FRIENDLY_FIELD_NAMES.FF_INTERPOLATED = {
'debug[all]':'Feedforward [roll]',
'debug[0]':'Setpoint Delta [roll]',
'debug[1]':'Acceleration [roll]',
'debug[2]':'Acceleration, clipped [roll]',
'debug[3]':'Duplicate Counter [roll]',
};
DEBUG_FRIENDLY_FIELD_NAMES.FF_LIMIT = {
'debug[all]':'Feedforward Limit [roll]',
'debug[0]':'FF limit input [roll]',
'debug[1]':'FF limit input [pitch]',
'debug[2]':'FF limited [roll]',
'debug[3]':'Not Used',
};
} else if (semver.gte(firmwareVersion, '4.1.0')) {
DEBUG_FRIENDLY_FIELD_NAMES.FF_INTERPOLATED = {
'debug[all]':'Feedforward [roll]',
'debug[0]':'Setpoint Delta [roll]',
'debug[1]':'Boost [roll]',
'debug[2]':'Boost, clipped [roll]',
'debug[3]':'Duplicate Counter [roll]',
};
DEBUG_FRIENDLY_FIELD_NAMES.FF_LIMIT = {
'debug[all]':'Feedforward Limit [roll]',
'debug[0]':'FF limit input [roll]',
'debug[1]':'FF limit input [pitch]',
'debug[2]':'FF limited [roll]',
'debug[3]':'Not Used',
};
}
}
};

FlightLogFieldPresenter.presentFlags = function(flags, flagNames) {
var
printedFlag = false,
Expand Down Expand Up @@ -486,8 +533,9 @@ function FlightLogFieldPresenter() {
};

FlightLogFieldPresenter.presentEnum = function presentEnum(value, enumNames) {
if (enumNames[value] === undefined)
if (enumNames[value] === undefined) {
return value;
}

return enumNames[value];
};
Expand All @@ -500,8 +548,9 @@ function FlightLogFieldPresenter() {
* @param value Value of the field
*/
FlightLogFieldPresenter.decodeFieldToFriendly = function(flightLog, fieldName, value, currentFlightMode) {
if (value === undefined)
if (value === undefined) {
return "";
}

switch (fieldName) {
case 'time':
Expand Down Expand Up @@ -771,6 +820,13 @@ function FlightLogFieldPresenter() {
return value.toFixed(0) + "Hz";
}
break;
case 'DYN_IDLE':
switch (fieldName) {
case 'debug[3]': // minRPS best shown as rpm, since commanded value is rpm
return (value * 6);
default:
return value.toFixed(0);
}
case 'AC_ERROR':
return (value / 10).toFixed(1) + 'deg';
case 'AC_CORRECTION':
Expand Down
82 changes: 78 additions & 4 deletions js/graph_config.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,14 +48,14 @@ function GraphConfig(graphConfig) {
newGraph = $.extend(
// Default values for missing properties:
{
height: 1
height: 1,
},
// The old graph
graph,
// New fields to replace the old ones:
{
fields:[]
}
fields:[],
},
),
colorIndex = 0;

Expand Down Expand Up @@ -536,7 +536,81 @@ GraphConfig.load = function(config) {
return getCurveForMinMaxFieldsZeroOffset(fieldName);
}
break;
}
case 'FF_INTERPOLATED':
switch (fieldName) {
case 'debug[0]': // setpoint Delta
case 'debug[1]': // AccelerationModified
case 'debug[2]': // Acceleration
return {
offset: 0,
power: 1.0,
inputRange: 1000,
outputRange: 1.0,
};
case 'debug[3]': // Clip or Count
return {
offset: -10,
power: 1.0,
inputRange: 10,
outputRange: 1.0,
};
}
break;
case 'FEEDFORWARD': // replaces FF_INTERPOLATED in 4.3
switch (fieldName) {
case 'debug[0]': // in 4.3 is interpolated setpoint
return {
offset: 0,
power: 1.0,
inputRange: maxDegreesSecond(gyroScaleMargin),
outputRange: 1.0,
};
case 'debug[1]': // feedforward delta element
case 'debug[2]': // feedforward boost element
return {
offset: 0,
power: 1.0,
inputRange: 1000,
outputRange: 1.0,
};
case 'debug[3]': // rcCommand delta
return {
offset: 0,
power: 1.0,
inputRange: 10000,
outputRange: 1.0,
};
}
break;
case 'FF_LIMIT':
case 'FEEDFORWARD_LIMIT':
return {
offset: 0,
power: 1.0,
inputRange: 300,
outputRange: 1.0,
};
case 'DYN_IDLE':
switch (fieldName) {
case 'debug[0]': // in 4.3 is dyn idle P
case 'debug[1]': // in 4.3 is dyn idle I
case 'debug[2]': // in 4.3 is dyn idle D
return {
offset: 0,
power: 1.0,
inputRange: 1000,
outputRange: 1.0,
};
case 'debug[3]': // in 4.3 and 4.2 is minRPS
return {
offset: -1000,
power: 1.0,
inputRange: 1000,
outputRange: 1.0,
};
}
break;
}
}
// if not found above then
// Scale and center the field based on the whole-log observed ranges for that field
Expand Down