Rates preview for PID Tuning tab
parent
9bbc5cc000
commit
a0b2d9a090
|
@ -232,7 +232,7 @@
|
|||
"defaultWelcomeIntro": {
|
||||
"message": "Welcome to <strong>Betaflight - Configurator</strong>, a utility designed to simplify updating, configuring and tuning of your flight controller."
|
||||
},
|
||||
|
||||
|
||||
"defaultWelcomeText": {
|
||||
"message": "The application supports all hardware that can run Betaflight (<a href=\"http://seriouslypro.com/spracingf3\" target=\"_blank\">SPRacingF3</a>, <a href=\"http://www.immersionrc.com/fpv-products/vortex-racing-quad/\" target=\"_blank\">Vortex</a>, <a href=\"https://github.com/TauLabs/TauLabs/wiki/Sparky\" target=\"_blank\">Sparky</a>, <a href=\"http://www.readymaderc.com/store/index.php?main_page=product_info&cPath=76_156&products_id=4221\" target=\"_blank\">DoDo</a>, <a href=\"https://www.openpilot.org/product/coptercontrol/\" target=\"_blank\">CC3D/EVO</a>, <a href=\"http://www.multiwiicopter.com/products/paris-air-hero-32-naze\" target=\"_blank\">Air Hero 32</a>, <a href=\"http://www.readytoflyquads.com/flight-controllers/flip-series\" target=\"_blank\">Flip32/+/Deluxe</a>, <a href=\"http://multirotormania.com/129-dragonfly32\" target=\"_blank\">DragonFly32</a>, <a href=\"http://www.goodluckbuy.com/micro-quadcopter-flight-driver-controller-9dof-9-axis-altitude-sensor-stm32f103.html\" target=\"_blank\">CJMCU Microquad</a>, Chebuzz F3, <a href=\"http://www.st.com/web/catalog/tools/FM116/SC959/SS1532/PF254044\" target=\"_blank\">STM32F3Discovery</a>, <a href=\"http://www.overskyrc.com/hermit-micro-fpv-brushless-quadcopter-145mm-98g-fully-assembled-p-621.html\" target=\"_blank\">Hermit</a>, <a href=\"http://rcexplorer.se/blog/2015/05/introducing-the-naze32-tricopter-frame/\" target=\"_blank\">Naze32 Tricopter Frame</a>, <a href=\"http://www.2dogrc.com/skyline-32-naze-32-bit-flight-controller-acro-version.html\" target=\"_blank\">Skyline32</a>, <a href=\"http://abusemark.com/store/index.php?main_page=index&cPath=1\" target=\"_blank\">Naze/32/Mini/Pro</a>/<a href=\"http://www.massiverc.com/Shop/en/574-massive-acro-blackbox-flight-control-board.html\" target=\"_blank\">Blackbox</a> etc)<br /><br />The firmware source code can be downloaded from <a href=\"https://github.com/Betaflight/Betaflight\" title=\"www.github.com\" target=\"_blank\">here</a><br />The newest binary firmware image is available <a href=\"https://github.com/Betaflight/Betaflight/releases\" title=\"www.github.com\" target=\"_blank\">here</a>, development builds available <a href=\"http://Betaflight.memoryleaks.org/builds/\" target=\"_blank\">here</a><br /><br />Latest <strong>CP210x Drivers</strong> can be downloaded from <a href=\"http://www.silabs.com/products/mcu/pages/usbtouartbridgevcpdrivers.aspx\" title=\"http://www.silabs.com\" target=\"_blank\">here</a><br />Latest <strong>STM USB VCP Drivers</strong> can be downloaded from <a href=\"http://www.st.com/web/en/catalog/tools/PF257938\" title=\"http://www.st.com\" target=\"_blank\">here</a><br />Latest <strong>Zadig</strong> for Windows DFU flashing can be downloaded from <a href=\"http://zadig.akeo.ie/\" title=\"http://zadig.akeo.ie\" target=\"_blank\">here</a><br />"
|
||||
},
|
||||
|
@ -296,7 +296,7 @@
|
|||
"defaultSupport5": {
|
||||
"message": "<a href=\"http://webchat.freenode.net/?channels=Betaflight\" target=\"_blank\">Join via WebClient</a>"
|
||||
},
|
||||
|
||||
|
||||
"initialSetupBackupAndRestoreApiVersion": {
|
||||
"message": "<span style=\"color: red\">Backup and restore functionality disabled.</span> You have firmware with API version <span style=\"color: red\">$1</span>, backup and restore requires <span style=\"color: #ffbb00\">$2</span>. Please backup your settings via the CLI, see Betaflight documentation for procedure."
|
||||
},
|
||||
|
@ -532,7 +532,7 @@
|
|||
"featureAIRMODE": {
|
||||
"message": "Airmode always enabled!"
|
||||
},
|
||||
|
||||
|
||||
"configurationFeatureEnabled": {
|
||||
"message": "Enabled"
|
||||
},
|
||||
|
@ -668,7 +668,7 @@
|
|||
"configurationLoopTime": {
|
||||
"message": "Flight Controller Loop Time"
|
||||
},
|
||||
"configurationCalculatedCyclesSec": {
|
||||
"configurationCalculatedCyclesSec": {
|
||||
"message": "Cycles/Sec (Hz)"
|
||||
},
|
||||
"configurationLoopTimeHelp": {
|
||||
|
@ -766,6 +766,9 @@
|
|||
"pidTuningRate": {
|
||||
"message": "Rate"
|
||||
},
|
||||
"pidTuningRatesPreview": {
|
||||
"message": "Rates Preview"
|
||||
},
|
||||
"pidTuningRcExpo": {
|
||||
"message": "RC Expo"
|
||||
},
|
||||
|
@ -832,7 +835,7 @@
|
|||
},
|
||||
"receiverHelpYawDeadband": {
|
||||
"message": "These are values (in us) by how much RC input can be different before it's considered valid. For transmitters with jitter on outputs, this value can be increased if rc inputs twitch while idle. <strong>This setting is for Yaw only.</strong>"
|
||||
},
|
||||
},
|
||||
"receiverYawDeadband": {
|
||||
"message": "Yaw Deadband"
|
||||
},
|
||||
|
@ -1078,7 +1081,7 @@
|
|||
},
|
||||
"transponderDataInvalid": {
|
||||
"message": "Transponder data is <span style=\"color: red\">invalid</span>"
|
||||
},
|
||||
},
|
||||
"transponderEepromSaved": {
|
||||
"message": "EEPROM <span style=\"color: #ffbb00\">saved</span>"
|
||||
},
|
||||
|
@ -1251,14 +1254,14 @@
|
|||
"blackboxButtonSave": {
|
||||
"message": "Save and reboot"
|
||||
},
|
||||
|
||||
|
||||
"serialLoggingSupportedNote": {
|
||||
"message": "You can log to an external logging device (such as an OpenLog or compatible clone) by using a serial port. Configure the port on the Ports tab."
|
||||
},
|
||||
"sdcardNote": {
|
||||
"message": "Flight logs can be recorded to your flight controller's onboard SD card slot."
|
||||
},
|
||||
|
||||
|
||||
"dataflashNote": {
|
||||
"message": "Flight logs can be recorded to your flight controller's onboard dataflash chip."
|
||||
},
|
||||
|
@ -1304,7 +1307,7 @@
|
|||
"dataflashFileWriteFailed": {
|
||||
"message": "Failed to write to the file you selected, are the permissions on that folder okay?"
|
||||
},
|
||||
|
||||
|
||||
"firmwareFlasherReleaseSummaryHead": {
|
||||
"message": "Release info"
|
||||
},
|
||||
|
@ -1460,7 +1463,7 @@
|
|||
"ledStripEepromSaved": {
|
||||
"message": "EEPROM <span style=\"color: #ffbb00\">saved</span>"
|
||||
},
|
||||
|
||||
|
||||
"controlAxisRoll": {
|
||||
"message": "Roll"
|
||||
},
|
||||
|
@ -1521,7 +1524,7 @@
|
|||
"controlAxisAux16": {
|
||||
"message": "AUX 16"
|
||||
},
|
||||
|
||||
|
||||
"pidTuningBasic": {
|
||||
"message": "Basic/Acro"
|
||||
},
|
||||
|
@ -1545,7 +1548,7 @@
|
|||
},
|
||||
"pidTuningLevelD": {
|
||||
"message": "Transition (Horizon)"
|
||||
},
|
||||
},
|
||||
"pidTuningLevelHelp": {
|
||||
"message": "The values below change the behaviour of the ANGLE and HORIZON flight modes. Different PID controllers handle the LEVEL values differently. Please check the documentation."
|
||||
},
|
||||
|
@ -1669,5 +1672,5 @@
|
|||
"configurationMagHardware": {
|
||||
"message": "Magnetometer (if supported)"
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
12
js/model.js
12
js/model.js
|
@ -115,7 +115,17 @@ Model.prototype.rotateTo = function (x, y, z) {
|
|||
this.modelWrapper.rotation.y = y;
|
||||
this.model.rotation.z = z;
|
||||
|
||||
this.render();
|
||||
this.render();
|
||||
};
|
||||
|
||||
Model.prototype.rotateBy = function (x, y, z) {
|
||||
if (!this.model) { return; }
|
||||
|
||||
this.model.rotateX(x);
|
||||
this.model.rotateY(y);
|
||||
this.model.rotateZ(z);
|
||||
|
||||
this.render();
|
||||
};
|
||||
|
||||
Model.prototype.render = function () {
|
||||
|
|
|
@ -177,11 +177,6 @@
|
|||
border-top-right-radius: 3px;
|
||||
}
|
||||
|
||||
.tab-pid_tuning .tpa {
|
||||
/*border: 0px solid #ccc; */
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
|
||||
.tab-pid_tuning .rc_curve {
|
||||
float: right;
|
||||
width: calc(100% - 2px); /* - ( "virtual" margin) */
|
||||
|
@ -580,3 +575,21 @@
|
|||
margin-top: -28px;
|
||||
margin-left: 8px;
|
||||
}
|
||||
|
||||
.tab-pid_tuning .rates_preview_cell {
|
||||
position: relative;
|
||||
width: 100%;
|
||||
height: 0;
|
||||
padding-bottom: 100%;
|
||||
}
|
||||
|
||||
.tab-pid_tuning .rates_preview {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
background-image: url(../images/paper.jpg);
|
||||
background-size: 100%;
|
||||
background-position: center;
|
||||
}
|
||||
|
|
|
@ -199,50 +199,74 @@
|
|||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<div class="cf_column half topspacer">
|
||||
<div>
|
||||
<table class="rc_curve cf">
|
||||
<thead>
|
||||
<tr>
|
||||
<th i18n="rcCurve"></th>
|
||||
</tr>
|
||||
</thead>
|
||||
</tbody>
|
||||
<tr>
|
||||
<td>
|
||||
<div class="spacer" style="margin-top: 10px; margin-bottom: 10px;">
|
||||
<div class="pitch_roll_curve">
|
||||
<canvas height="120px" style="width: 100%; height: 100%"></canvas>
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<div class="clear-both"></div>
|
||||
</div>
|
||||
<div class="topspacer">
|
||||
<table class="rc_yaw_curve cf">
|
||||
<thead>
|
||||
<tr>
|
||||
<th i18n="rcYawCurve"></th>
|
||||
</tr>
|
||||
</thead>
|
||||
</tbody>
|
||||
<tr>
|
||||
<td>
|
||||
<div class="spacer" style="margin-top: 10px; margin-bottom: 10px;">
|
||||
<div class="yaw_curve">
|
||||
<canvas height="120px" style="width: 100%; height: 100%"></canvas>
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<div class="clear-both"></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="cf_column half topspacer">
|
||||
<table class="tpa cf">
|
||||
<thead>
|
||||
<tr>
|
||||
<th i18n="pidTuningRatesPreview"></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td class="rates_preview_cell">
|
||||
<div class="rates_preview">
|
||||
<canvas id="canvas"></canvas>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="cf_column third_right">
|
||||
<div class="spacer_left">
|
||||
<table class="rc_curve cf">
|
||||
<thead>
|
||||
<tr>
|
||||
<th i18n="rcCurve"></th>
|
||||
</tr>
|
||||
</thead>
|
||||
</tbody>
|
||||
<tr>
|
||||
<td>
|
||||
<div class="spacer" style="margin-top: 10px; margin-bottom: 10px;">
|
||||
<div class="pitch_roll_curve">
|
||||
<canvas height="120px" style="width: 100%; height: 100%"></canvas>
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<div class="spacer_left topspacer">
|
||||
<table class="rc_yaw_curve cf">
|
||||
<thead>
|
||||
<tr>
|
||||
<th i18n="rcYawCurve"></th>
|
||||
</tr>
|
||||
</thead>
|
||||
</tbody>
|
||||
<tr>
|
||||
<td>
|
||||
<div class="spacer" style="margin-top: 10px; margin-bottom: 10px;">
|
||||
<div class="yaw_curve">
|
||||
<canvas height="120px" style="width: 100%; height: 100%"></canvas>
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<div class="spacer_left throttle topspacer">
|
||||
<div class="spacer_left throttle">
|
||||
<table class="cf">
|
||||
<thead>
|
||||
<tr>
|
||||
|
@ -259,15 +283,23 @@
|
|||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<div class="spacer_left topspacer">
|
||||
<table class="tpa cf">
|
||||
<thead>
|
||||
<tr>
|
||||
<th i18n="receiverThrottleMid"></th>
|
||||
<th i18n="receiverThrottleExpo"></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td><input type="number" name="mid" step="0.01" min="0" max="1" /></td>
|
||||
<td><input type="number" name="expo" step="0.01" min="0" max="1" /></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<div class="spacer_left topspacer">
|
||||
|
|
|
@ -315,7 +315,6 @@ TABS.pid_tuning.initialize = function (callback) {
|
|||
}
|
||||
});
|
||||
|
||||
|
||||
pid_and_rc_to_form();
|
||||
|
||||
var pidController_e = $('select[name="controller"]');
|
||||
|
@ -339,12 +338,12 @@ TABS.pid_tuning.initialize = function (callback) {
|
|||
{ name: "Float"},
|
||||
]
|
||||
}
|
||||
|
||||
|
||||
for (var i = 0; i < pidControllerList.length; i++) {
|
||||
pidController_e.append('<option value="' + (i) + '">' + pidControllerList[i].name + '</option>');
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
var form_e = $('#pid-tuning');
|
||||
|
||||
if (GUI.canChangePidController) {
|
||||
|
@ -532,6 +531,13 @@ TABS.pid_tuning.initialize = function (callback) {
|
|||
}
|
||||
});
|
||||
|
||||
// Setup model for rates preview
|
||||
self.initRatesPreview();
|
||||
self.renderModel();
|
||||
|
||||
// enable RC data pulling for rates preview
|
||||
GUI.interval_add('receiver_pull', self.getRecieverData, true);
|
||||
|
||||
// status data pulled via separate timer with static speed
|
||||
GUI.interval_add('status_pull', function status_pull() {
|
||||
MSP.send_message(MSP_codes.MSP_STATUS);
|
||||
|
@ -541,8 +547,42 @@ TABS.pid_tuning.initialize = function (callback) {
|
|||
}
|
||||
};
|
||||
|
||||
TABS.pid_tuning.cleanup = function (callback) {
|
||||
if (callback) {
|
||||
callback();
|
||||
TABS.pid_tuning.getRecieverData = function () {
|
||||
MSP.send_message(MSP_codes.MSP_RC, false, false);
|
||||
};
|
||||
|
||||
TABS.pid_tuning.initRatesPreview = function () {
|
||||
this.keepRendering = true;
|
||||
this.model = new Model($('.rates_preview'), $('.rates_preview canvas'));
|
||||
|
||||
var scale = d3.scale.linear().domain([900, 2100]);
|
||||
|
||||
this.rollScale = scale.range([Math.PI * 2, -Math.PI * 2]);
|
||||
this.pitchScale = scale.range([Math.PI * 2, -Math.PI * 2]);
|
||||
this.yawScale = scale.range([Math.PI * 2, -Math.PI * 2]);
|
||||
|
||||
$(window).on('resize', $.proxy(this.model.resize, this.model));
|
||||
};
|
||||
|
||||
TABS.pid_tuning.renderModel = function () {
|
||||
if (this.keepRendering) { requestAnimationFrame(this.renderModel.bind(this)); }
|
||||
|
||||
if (!this.clock) { this.clock = new THREE.Clock(); }
|
||||
|
||||
if (RC.channels[0] && RC.channels[1] && RC.channels[2]) {
|
||||
var delta = this.clock.getDelta(),
|
||||
roll = delta * this.rollScale(RC.channels[0]),
|
||||
pitch = delta * this.pitchScale(RC.channels[1]),
|
||||
yaw = delta * this.yawScale(RC.channels[2]);
|
||||
|
||||
this.model.rotateBy(pitch, yaw, roll);
|
||||
}
|
||||
};
|
||||
|
||||
TABS.pid_tuning.cleanup = function (callback) {
|
||||
$(window).off('resize', $.proxy(this.model.resize, this.model));
|
||||
|
||||
this.keepRendering = false;
|
||||
|
||||
if (callback) callback();
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue