Merge pull request #1 from kernel-machine/magnetometer_tab_model_replaced

Improvments for mag helper without iframe
pull/1449/head
ThisIsJustARandomGuy 3 years ago committed by GitHub
commit 8e90211b0f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Generator: Adobe Illustrator 18.1.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<svg version="1.1" id="Capa_1" x="0px" y="0px" viewBox="0 0 141.7 141.7" enable-background="new 0 0 141.7 141.7" xml:space="preserve" sodipodi:docname="cf_icon_mag.svg" inkscape:version="1.1.1 (3bf5ae0d25, 2021-09-20)" xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" xmlns="http://www.w3.org/2000/svg" xmlns:svg="http://www.w3.org/2000/svg"><defs id="defs23"/><sodipodi:namedview id="namedview21" pagecolor="#505050" bordercolor="#eeeeee" borderopacity="1" inkscape:pageshadow="0" inkscape:pageopacity="0" inkscape:pagecheckerboard="0" showgrid="false" inkscape:zoom="4.2416427" inkscape:cx="76.503378" inkscape:cy="93.949449" inkscape:window-width="1920" inkscape:window-height="1009" inkscape:window-x="1912" inkscape:window-y="-8" inkscape:window-maximized="1" inkscape:current-layer="Capa_1"/>
<circle style="fill:none;fill-opacity:1;stroke:#818181;stroke-width:9.18779;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" id="path2200" cx="71" cy="71" r="66.406105"/><g id="g2753" transform="matrix(0.7306188,0.73061884,-0.7306188,0.73061884,118.2884,-123.32009)"><path sodipodi:type="star" style="fill:#818181;fill-opacity:1;stroke:#818181;stroke-width:18.8976;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" id="path2629" inkscape:flatsided="true" sodipodi:sides="3" sodipodi:cx="247.46053" sodipodi:cy="651.80164" sodipodi:r1="133.89723" sodipodi:r2="66.948616" sodipodi:arg1="0.52359878" sodipodi:arg2="1.5707963" inkscape:rounded="0.06" inkscape:randomized="0" transform="matrix(0.15340448,0,0,0.21817923,62.659796,6.2483541)" inkscape:transform-center-y="-6.3174466" d="m 363.41893,718.75025 c -6.9575,12.05075 -224.95931,12.05075 -231.91681,0 -6.9575,-12.05075 102.0434,-200.84585 115.95841,-200.84585 13.915,0 122.9159,188.7951 115.9584,200.84585 z"/><path sodipodi:type="star" style="fill:none;fill-opacity:1;stroke:#818181;stroke-width:18.8976;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" id="path2629-5" inkscape:flatsided="true" sodipodi:sides="3" sodipodi:cx="247.46053" sodipodi:cy="651.80164" sodipodi:r1="133.89723" sodipodi:r2="66.948616" sodipodi:arg1="0.52359878" sodipodi:arg2="1.5707963" inkscape:rounded="0.06" inkscape:randomized="0" transform="matrix(-0.15340448,0,0,-0.21817923,138.5829,324.44189)" inkscape:transform-center-y="6.3174502" inkscape:transform-center-x="4.3853654e-06" d="m 363.41893,718.75025 c -6.9575,12.05075 -224.95931,12.05075 -231.91681,0 -6.9575,-12.05075 102.0434,-200.84585 115.95841,-200.84585 13.915,0 122.9159,188.7951 115.9584,200.84585 z"/></g></svg>

After

Width:  |  Height:  |  Size: 2.7 KiB

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Generator: Adobe Illustrator 18.1.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<svg version="1.1" id="Capa_1" x="0px" y="0px" viewBox="0 0 141.7 141.7" enable-background="new 0 0 141.7 141.7" xml:space="preserve" sodipodi:docname="cf_icon_mag.svg" inkscape:version="1.1.1 (3bf5ae0d25, 2021-09-20)" xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" xmlns="http://www.w3.org/2000/svg" xmlns:svg="http://www.w3.org/2000/svg"><defs id="defs23"/><sodipodi:namedview id="namedview21" pagecolor="#505050" bordercolor="#eeeeee" borderopacity="1" inkscape:pageshadow="0" inkscape:pageopacity="0" inkscape:pagecheckerboard="0" showgrid="false" inkscape:zoom="4.2416427" inkscape:cx="76.503378" inkscape:cy="93.949449" inkscape:window-width="1920" inkscape:window-height="1009" inkscape:window-x="1912" inkscape:window-y="-8" inkscape:window-maximized="1" inkscape:current-layer="g2753"/>
<circle style="fill:none;fill-opacity:1;stroke:#ffffff;stroke-width:9.18779;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" id="path2200" cx="71" cy="71" r="66.406105"/><g id="g2753" transform="matrix(0.7306188,0.73061884,-0.7306188,0.73061884,118.2884,-123.32009)"><path sodipodi:type="star" style="fill:#ffffff;fill-opacity:1;stroke:#ffffff;stroke-width:18.8976;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" id="path2629" inkscape:flatsided="true" sodipodi:sides="3" sodipodi:cx="247.46053" sodipodi:cy="651.80164" sodipodi:r1="133.89723" sodipodi:r2="66.948616" sodipodi:arg1="0.52359878" sodipodi:arg2="1.5707963" inkscape:rounded="0.06" inkscape:randomized="0" transform="matrix(0.15340448,0,0,0.21817923,62.659796,6.2483541)" inkscape:transform-center-y="-6.3174466" d="m 363.41893,718.75025 c -6.9575,12.05075 -224.95931,12.05075 -231.91681,0 -6.9575,-12.05075 102.0434,-200.84585 115.95841,-200.84585 13.915,0 122.9159,188.7951 115.9584,200.84585 z"/><path sodipodi:type="star" style="fill:none;fill-opacity:1;stroke:#ffffff;stroke-width:18.8976;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" id="path2629-5" inkscape:flatsided="true" sodipodi:sides="3" sodipodi:cx="247.46053" sodipodi:cy="651.80164" sodipodi:r1="133.89723" sodipodi:r2="66.948616" sodipodi:arg1="0.52359878" sodipodi:arg2="1.5707963" inkscape:rounded="0.06" inkscape:randomized="0" transform="matrix(-0.15340448,0,0,-0.21817923,138.5829,324.44189)" inkscape:transform-center-y="6.3174502" inkscape:transform-center-x="4.3853654e-06" d="m 363.41893,718.75025 c -6.9575,12.05075 -224.95931,12.05075 -231.91681,0 -6.9575,-12.05075 102.0434,-200.84585 115.95841,-200.84585 13.915,0 122.9159,188.7951 115.9584,200.84585 z"/></g></svg>

After

Width:  |  Height:  |  Size: 2.7 KiB

@ -999,6 +999,18 @@ li.active .ic_mixer {
background-image: url("../images/icons/cf_icon_mixer_white.svg");
}
.ic_mag {
background-image: url("../images/icons/cf_icon_mag_grey.svg");
}
.ic_mag:hover {
background-image: url("../images/icons/cf_icon_mag_white.svg");
}
li.active .ic_mag {
background-image: url("../images/icons/cf_icon_mag_white.svg");
}
#content {
margin-top: 0;
padding: 0;

File diff suppressed because one or more lines are too long

@ -21,22 +21,26 @@
<label for="magalign" data-i18n="configurationSensorAlignmentMag"></label>
</div>
<!--
value of roll and pitch must be inverted
Because the pitch of the mag is the roll of the quad and the roll of the mag is the pitch of the quad
-->
<div class="number">
<input type="number" id="alignRoll" data-setting="tz_offset" data-setting-multiplier="1" step="1" min="-180" max="180" />
<label for="alignRoll">
<span data-i18n="configurationSensorAlignmentMagRoll"></span>
<span data-i18n="configurationSensorAlignmentMagPitch"></span>
</label>
</div>
<div class="number">
<input type="number" id="alignPitch" data-setting="tz_offset" data-setting-multiplier="1" step="1" min="-180" max="180" />
<label for="alignPitch">
<span data-i18n="configurationSensorAlignmentMagPitch"></span>
<span data-i18n="configurationSensorAlignmentMagRoll"></span>
</label>
</div>
<div class="number">
<input type="number" id="alignYaw" data-setting="tz_offset" data-setting-multiplier="1" step="1" min="-180" max="180" />
<input type="number" id="alignYaw" data-setting="tz_offset" data-setting-multiplier="1" step="1" min="-180" max="360" />
<label for="alignYaw">
<span data-i18n="configurationSensorAlignmentMagYaw"></span>
</label>

@ -28,14 +28,15 @@ TABS.magnetometer.initialize = function (callback) {
var loadChain = [
mspHelper.loadMixerConfig,
mspHelper.loadSensorAlignment,
// Pitch and roll must be inverted
function(callback) {
mspHelper.getSetting("align_mag_roll").then(function (data) {
self.alignmentConfig.roll = parseInt(data.value, 10) / 10;
self.alignmentConfig.pitch = parseInt(data.value, 10) / 10;
}).then(callback)
},
function(callback) {
mspHelper.getSetting("align_mag_pitch").then(function (data) {
self.alignmentConfig.pitch = parseInt(data.value, 10) / 10;
self.alignmentConfig.roll = (parseInt(data.value, 10) / 10) - 180;
}).then(callback)
},
function(callback) {
@ -63,11 +64,12 @@ TABS.magnetometer.initialize = function (callback) {
},
mspHelper.saveSensorAlignment,
// Pitch/Roll/Yaw
// Pitch and roll must be inverted
function(callback) {
mspHelper.setSetting("align_mag_roll", self.alignmentConfig.roll * 10, callback);
mspHelper.setSetting("align_mag_roll", self.alignmentConfig.pitch * 10, callback);
},
function(callback) {
mspHelper.setSetting("align_mag_pitch", self.alignmentConfig.pitch * 10, callback);
mspHelper.setSetting("align_mag_pitch", (180+self.alignmentConfig.roll) * 10, callback);
},
function(callback) {
mspHelper.setSetting("align_mag_yaw", self.alignmentConfig.yaw * 10, callback);
@ -221,9 +223,10 @@ TABS.magnetometer.initialize3D = function () {
var modelMaterial = new THREE.MeshFaceMaterial(materials);
gps_model = new THREE.Mesh(geometry, modelMaterial);
gps_model.scale.set(5, 5, 5);
gps_model.scale.set(2.5, 2.5, 2.5);
// TODO This should depend on the selected drone model
gps_model.position.set(0, 0, 25);
gps_model.position.set(0, 0, 27);
gps_model.rotation.y = 3 * Math.PI / 2
scene.add(gps_model);
@ -252,13 +255,11 @@ TABS.magnetometer.initialize3D = function () {
scene.add(camera);
this.render3D = function () {
if (!model) {
if (!model || !gps_model) {
return;
}
gps_model.rotation.x = THREE.Math.degToRad(self.alignmentConfig.pitch);
gps_model.rotation.y = THREE.Math.degToRad(self.alignmentConfig.yaw);
gps_model.rotation.z = THREE.Math.degToRad(self.alignmentConfig.roll);
gps_model.rotation.set(THREE.Math.degToRad(self.alignmentConfig.pitch), THREE.Math.degToRad(-180-self.alignmentConfig.yaw), THREE.Math.degToRad(self.alignmentConfig.roll), 'YXZ');
// draw
renderer.render(scene, camera);

Loading…
Cancel
Save