1
0
Fork 0
mirror of https://github.com/betaflight/betaflight-configurator.git synced 2025-07-16 12:55:14 +03:00

Update Feedforward to new names and values

Replace all ff with feedforward

Requested changes

Fix duplicated ff name

Reenabling on/off switch

Optimize F value update

Use exiting array for PID defaults
This commit is contained in:
Asizon 2021-06-13 17:50:56 +02:00
parent c44e48f51b
commit 2e89fa2031
6 changed files with 84 additions and 75 deletions

View file

@ -1768,7 +1768,7 @@
"message": "RC Interpolation Interval [ms]"
},
"pidTuningFeedforwardTransition": {
"message": "Feedforward transition"
"message": "Transition"
},
"pidTuningFeedforwardTransitionHelp": {
"message": "With this parameter, the Feedforward term can be reduced near the center of the sticks, which results in smoother end of flips and rolls.<br> The value represents a point of stick deflection: 0 - stick centered, 1 - full deflection. When the stick is above that point, Feedforward is kept constant at its configured value. When the stick is positioned below that point, Feedforward is reduced proportionally, reaching 0 at the stick center position.<br> Value of 1 gives maximum smoothing effect, while value of 0 keeps the Feedforward fixed at its configured value over the whole stick range."
@ -1788,31 +1788,31 @@
"pidTuningDtermSetpointTransitionWarning": {
"message": "<span class=\"message-negative\"><strong>$t(warningTitle.message):<\/strong> The use of a D Setpoint transition greater than 0 and less than 0.1 is highly discouraged. Doing so may lead instability and reduced stick responsiveness as the sticks cross the centre point.<\/span>"
},
"pidTuningFfInterpolateSp": {
"message": "FF Interpolate"
"pidTuningFeedforwardGroup": {
"message": "Feedforward"
},
"pidTuningFfInterpolateSpHelp": {
"message": "The following options fine-tune feed forward from race/aggressive to smooth/HD.<br /><br /> Mode: set to NoAverage for race, Average 2 for race/fast freestyle, Average 3 for HD recording, Average 4 for HD cinematic smoothness.<br /><br /> Smoothness: limits the amount of change that any one incoming radio step can make, increase for smoother FF signal, decrease for more aggressive FF responses.<br /><br /> Boost: helps overcome motor lag with quick stick inputs, can increase jitter. Try 10 for HD, 20 for racers. Up to 30 may be useful for low authority quads but can cause micro overshoot or jitter."
"pidTuningFeedforwardGroupHelp": {
"message": "The following options fine-tune feed forward from race/aggressive to smooth/HD.<br /><br /> Mode: set to Off for race, 2 Point averaging for race/fast freestyle, 3 Point averaging for HD recording, 4 Point averaging for HD cinematic smoothness.<br /><br /> Smoothness: limits the amount of change that any one incoming radio step can make, increase for smoother feedforward signal, decrease for more aggressive feedforward responses.<br /><br /> Boost: helps overcome motor lag with quick stick inputs, can increase jitter. Try 10 for HD, 20 for racers. Up to 30 may be useful for low authority quads but can cause micro overshoot or jitter."
},
"pidTuningFfInterpolate": {
"message": "Mode"
"pidTuningFeedforwardAveraging": {
"message": "Averaging"
},
"pidTuningFfInterpolateSpOptionNoAverage": {
"message": "NoAverage"
"pidTuningFeedforwardAveragingOptionOff": {
"message": "OFF"
},
"pidTuningFfInterpolateSpOptionAverage2": {
"message": "Average 2"
"pidTuningFeedforwardAveragingOption2Point": {
"message": "2 Point"
},
"pidTuningFfInterpolateSpOptionAverage3": {
"message": "Average 3"
"pidTuningFeedforwardAveragingOption3Point": {
"message": "3 Point"
},
"pidTuningFfInterpolateSpOptionAverage4": {
"message": "Average 4"
"pidTuningFeedforwardAveragingOption4Point": {
"message": "4 Point"
},
"pidTuningFfSmoothFactor": {
"pidTuningFeedforwardSmoothFactor": {
"message": "Smoothness"
},
"pidTuningFfBoost": {
"pidTuningFeedforwardBoost": {
"message": "Boost"
},
"pidTuningProportional": {

View file

@ -169,7 +169,8 @@
}
.tab-pid_tuning table.compensation .helpicon {
margin-top: 3px
margin-top: 3px;
margin-left: auto;
}
.tab-pid_tuning table.compensation .suboption {

View file

@ -508,9 +508,9 @@ const FC = {
motorOutputLimit: 0,
autoProfileCellCount: 0,
idleMinRpm: 0,
ff_interpolate_sp: 0,
ff_smooth_factor: 0,
ff_boost: 0,
feedforward_averaging: 0,
feedforward_smooth_factor: 0,
feedforward_boost: 0,
vbat_sag_compensation: 0,
thrustLinearization: 0,
};

View file

@ -1172,9 +1172,9 @@ MspHelper.prototype.process_data = function(dataHandler) {
FC.ADVANCED_TUNING.idleMinRpm = data.readU8();
if(semver.gte(FC.CONFIG.apiVersion, API_VERSION_1_44)) {
FC.ADVANCED_TUNING.ff_interpolate_sp = data.readU8();
FC.ADVANCED_TUNING.ff_smooth_factor = data.readU8();
FC.ADVANCED_TUNING.ff_boost = data.readU8();
FC.ADVANCED_TUNING.feedforward_averaging = data.readU8();
FC.ADVANCED_TUNING.feedforward_smooth_factor = data.readU8();
FC.ADVANCED_TUNING.feedforward_boost = data.readU8();
FC.ADVANCED_TUNING.vbat_sag_compensation = data.readU8();
FC.ADVANCED_TUNING.thrustLinearization = data.readU8();
}
@ -2142,9 +2142,9 @@ MspHelper.prototype.crunch = function(code) {
.push8(FC.ADVANCED_TUNING.idleMinRpm);
if(semver.gte(FC.CONFIG.apiVersion, API_VERSION_1_44)) {
buffer.push8(FC.ADVANCED_TUNING.ff_interpolate_sp)
.push8(FC.ADVANCED_TUNING.ff_smooth_factor)
.push8(FC.ADVANCED_TUNING.ff_boost)
buffer.push8(FC.ADVANCED_TUNING.feedforward_averaging)
.push8(FC.ADVANCED_TUNING.feedforward_smooth_factor)
.push8(FC.ADVANCED_TUNING.feedforward_boost)
.push8(FC.ADVANCED_TUNING.vbat_sag_compensation)
.push8(FC.ADVANCED_TUNING.thrustLinearization);
}

View file

@ -32,8 +32,9 @@ TABS.pid_tuning.initialize = function (callback) {
self.activeSubtab = 'pid';
}
// Update filtering defaults based on API version
// Update filtering and pid defaults based on API version
const FILTER_DEFAULT = FC.getFilterDefaults();
const PID_DEFAULT = FC.getPidDefaults();
// requesting MSP_STATUS manually because it contains FC.CONFIG.profile
MSP.promise(MSPCodes.MSP_STATUS).then(function() {
@ -480,20 +481,30 @@ TABS.pid_tuning.initialize = function (callback) {
}
if (semver.gte(FC.CONFIG.apiVersion, API_VERSION_1_44)) {
// FF Interpolate
const ffInterpolateCheck = $('input[id="ffInterpolateSp"]');
const NO_AVERAGE = 1;
// Feedforward
const feedforwardGroupCheck = $('input[id="feedforwardGroup"]');
const PID_FEEDFORWARD = (FC.ADVANCED_TUNING.feedforwardRoll ||
FC.ADVANCED_TUNING.feedforwardPitch ||
FC.ADVANCED_TUNING.feedforwardYaw);
ffInterpolateCheck.prop('checked', FC.ADVANCED_TUNING.ff_interpolate_sp !== 0);
$('select[id="ffInterpolate"]').val(FC.ADVANCED_TUNING.ff_interpolate_sp > 0 ? FC.ADVANCED_TUNING.ff_interpolate_sp : NO_AVERAGE);
$('input[name="ffSmoothFactor"]').val(FC.ADVANCED_TUNING.ff_smooth_factor);
$('input[name="ffBoost"]').val(FC.ADVANCED_TUNING.ff_boost);
feedforwardGroupCheck.prop('checked', PID_FEEDFORWARD !== 0);
$('select[id="feedforwardAveraging"]').val(FC.ADVANCED_TUNING.feedforward_averaging);
$('input[name="feedforwardSmoothFactor"]').val(FC.ADVANCED_TUNING.feedforward_smooth_factor);
$('input[name="feedforwardBoost"]').val(FC.ADVANCED_TUNING.feedforward_boost);
ffInterpolateCheck.change(function() {
feedforwardGroupCheck.change(function() {
const checked = $(this).is(':checked');
$('.ffInterpolateSp .suboption').toggle(checked);
$('.feedforwardGroup .suboption').toggle(checked);
if (!checked) {
$('.pid_tuning .ROLL input[name="f"]').val(0);
$('.pid_tuning .PITCH input[name="f"]').val(0);
$('.pid_tuning .YAW input[name="f"]').val(0);
} else {
$('.pid_tuning .ROLL input[name="f"]').val(FC.ADVANCED_TUNING.feedforwardRoll > 0 ? FC.ADVANCED_TUNING.feedforwardRoll : PID_DEFAULT[4]);
$('.pid_tuning .PITCH input[name="f"]').val(FC.ADVANCED_TUNING.feedforwardPitch > 0 ? FC.ADVANCED_TUNING.feedforwardPitch : PID_DEFAULT[9]);
$('.pid_tuning .YAW input[name="f"]').val(FC.ADVANCED_TUNING.feedforwardYaw > 0 ? FC.ADVANCED_TUNING.feedforwardYaw : PID_DEFAULT[14]);
}
}).change();
// Vbat Sag Compensation
const vbatSagCompensationCheck = $('input[id="vbatSagCompensation"]');
@ -516,7 +527,7 @@ TABS.pid_tuning.initialize = function (callback) {
$('.thrustLinearization .suboption').toggle(checked);
}).change();
} else {
$('.ffInterpolateSp').hide();
$('.feedforwardOption').hide();
$('.vbatSagCompensation').hide();
$('.thrustLinearization').hide();
}
@ -995,9 +1006,9 @@ TABS.pid_tuning.initialize = function (callback) {
}
if (semver.gte(FC.CONFIG.apiVersion, API_VERSION_1_44)) {
FC.ADVANCED_TUNING.ff_interpolate_sp = $('input[id="ffInterpolateSp"]').is(':checked') ? $('select[id="ffInterpolate"]').val() : 0;
FC.ADVANCED_TUNING.ff_smooth_factor = parseInt($('input[name="ffSmoothFactor"]').val());
FC.ADVANCED_TUNING.ff_boost = parseInt($('input[name="ffBoost"]').val());
FC.ADVANCED_TUNING.feedforward_averaging = $('select[id="feedforwardAveraging"]').val();
FC.ADVANCED_TUNING.feedforward_smooth_factor = parseInt($('input[name="feedforwardSmoothFactor"]').val());
FC.ADVANCED_TUNING.feedforward_boost = parseInt($('input[name="feedforwardBoost"]').val());
FC.FILTER_CONFIG.dyn_lpf_curve_expo = parseInt($('.pid_filter input[name="dtermLowpassDynExpo"]').val());
FC.ADVANCED_TUNING.vbat_sag_compensation = $('input[id="vbatSagCompensation"]').is(':checked') ? parseInt($('input[name="vbatSagValue"]').val()) : 0;
FC.ADVANCED_TUNING.thrustLinearization = $('input[id="thrustLinearization"]').is(':checked') ? parseInt($('input[name="thrustLinearValue"]').val()) : 0;

View file

@ -513,47 +513,43 @@
</td>
</tr>
<tr class="feedforwardTransition">
<td><input type="number" name="feedforwardTransition-number" step="0.01" min="0.00" max="1.00"/></td>
<td colspan="1">
<div>
<tr class="feedforwardGroup">
<td><input type="checkbox" id="feedforwardGroup" class="toggle" /></td>
<td colspan="2">
<div class="helpicon cf_tip" i18n_title="pidTuningFeedforwardGroupHelp"></div>
<span i18n="pidTuningFeedforwardGroup"></span>
<span class="feedforwardTransition suboption">
<input type="number" name="feedforwardTransition-number" step="0.01" min="0.00" max="1.00"/>
<label>
<span i18n="pidTuningFeedforwardTransition"></span>
</label>
<div class="helpicon cf_tip" i18n_title="pidTuningFeedforwardTransitionHelp"></div>
</div>
</td>
</tr>
</span>
<tr class="ffInterpolateSp">
<td><input type="checkbox" id="ffInterpolateSp" class="toggle" /></td>
<td colspan="2">
<div class="helpicon cf_tip" i18n_title="pidTuningFfInterpolateSpHelp"></div>
<span i18n="pidTuningFfInterpolateSp"></span>
<span class="ffInterpolate suboption">
<select id="ffInterpolate">
<option i18n="pidTuningFfInterpolateSpOptionNoAverage" value="1">
<option i18n="pidTuningFfInterpolateSpOptionAverage2" value="2"/>
<option i18n="pidTuningFfInterpolateSpOptionAverage3" value="3"/>
<option i18n="pidTuningFfInterpolateSpOptionAverage4" value="4"/>
<span class="feedforwardOption feedforwardAveraging suboption">
<select id="feedforwardAveraging">
<option i18n="pidTuningFeedforwardAveragingOptionOff" value="0"/>
<option i18n="pidTuningFeedforwardAveragingOption2Point" value="1"/>
<option i18n="pidTuningFeedforwardAveragingOption3Point" value="2"/>
<option i18n="pidTuningFeedforwardAveragingOption4Point" value="3"/>
</select>
<label for="ffInterpolate">
<span i18n="pidTuningFfInterpolate"></span>
<label for="feedforwardAveraging">
<span i18n="pidTuningFeedforwardAveraging"></span>
</label>
</span>
<span class="ffSmoothFactor suboption">
<input type="number" name="ffSmoothFactor" step="1" min="0" max="75" />
<label for="ffSmoothFactor">
<span i18n="pidTuningFfSmoothFactor"></span>
<span class="feedforwardOption feedforwardSmoothFactor suboption">
<input type="number" name="feedforwardSmoothFactor" step="1" min="0" max="75" />
<label for="feedforwardSmoothFactor">
<span i18n="pidTuningFeedforwardSmoothFactor"></span>
</label>
</span>
<span class="ffBoost suboption">
<input type="number" name="ffBoost" step="1" min="0" max="50" />
<label for="ffBoost">
<span i18n="pidTuningFfBoost"></span>
<span class="feedforwardOption feedforwardBoost suboption">
<input type="number" name="feedforwardBoost" step="1" min="0" max="50" />
<label for="feedforwardBoost">
<span i18n="pidTuningFeedforwardBoost"></span>
</label>
</span>
</td>
@ -561,7 +557,7 @@
<tr class="acroTrainerAngleLimit">
<td><input type="number" name="acroTrainerAngleLimit-number" step="1" min="10" max="80"/></td>
<td colspan="1">
<td colspan="2">
<div>
<label>
<span i18n="pidTuningAcroTrainerAngleLimit"></span>
@ -573,7 +569,7 @@
<tr class="throttleBoost">
<td><input type="number" name="throttleBoost-number" step="1" min="0" max="100"/></td>
<td colspan="1">
<td colspan="2">
<div>
<label>
<span i18n="pidTuningThrottleBoost"></span>
@ -585,7 +581,7 @@
<tr class="idleMinRpm">
<td><input type="number" name="idleMinRpm-number" step="1" min="0" max="100"/></td>
<td colspan="1">
<td colspan="2">
<div>
<label>
<span i18n="pidTuningIdleMinRpm"></span>
@ -597,7 +593,7 @@
<tr class="absoluteControlGain">
<td><input type="number" name="absoluteControlGain-number" step="1" min="0" max="20"/></td>
<td colspan="1">
<td colspan="2">
<div>
<label>
<span i18n="pidTuningAbsoluteControlGain"></span>
@ -768,6 +764,7 @@
</span>
</td>
</tr>
</table>
</div>
</div>