comments
This commit is contained in:
parent
6cda14bc32
commit
3cc6264f2a
@ -53,6 +53,8 @@ scene.add(pointLight);
|
|||||||
cube.position.x = 0
|
cube.position.x = 0
|
||||||
cube2.position.x = 0
|
cube2.position.x = 0
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// calibration globals
|
// calibration globals
|
||||||
let manCalibration = new THREE.Euler( 0, 0, 0, 'XYZ' )
|
let manCalibration = new THREE.Euler( 0, 0, 0, 'XYZ' )
|
||||||
let calibrationRot = new THREE.Quaternion()
|
let calibrationRot = new THREE.Quaternion()
|
||||||
@ -62,6 +64,7 @@ let calYaw = 0
|
|||||||
|
|
||||||
let quaternionOffset = document.getElementById("quaternionOffset")
|
let quaternionOffset = document.getElementById("quaternionOffset")
|
||||||
|
|
||||||
|
// function to set current cube rotation from sensor data with respect to calibration
|
||||||
function renderTCP(x, y, z) {
|
function renderTCP(x, y, z) {
|
||||||
let calibration = new THREE.Quaternion().setFromEuler(manCalibration)
|
let calibration = new THREE.Quaternion().setFromEuler(manCalibration)
|
||||||
let eul = new THREE.Euler( x, y, z, 'YXZ' );
|
let eul = new THREE.Euler( x, y, z, 'YXZ' );
|
||||||
@ -73,6 +76,7 @@ function renderTCP(x, y, z) {
|
|||||||
renderer.render(scene, camera);
|
renderer.render(scene, camera);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// function to set current cube rotation from sensor data
|
||||||
function renderSerial(x, y, z) {
|
function renderSerial(x, y, z) {
|
||||||
let eul = new THREE.Euler( x, y, z, 'YXZ' ); // XYZ XZY YZX YXZ ZXY ZYX
|
let eul = new THREE.Euler( x, y, z, 'YXZ' ); // XYZ XZY YZX YXZ ZXY ZYX
|
||||||
|
|
||||||
@ -137,9 +141,9 @@ function calibrate(evt) {
|
|||||||
let dif = new THREE.Euler().setFromQuaternion( diff )
|
let dif = new THREE.Euler().setFromQuaternion( diff )
|
||||||
console.log("OLD:","pitch", old.x * 180/Math.PI, "yaw", old.y * 180/Math.PI, "roll", old.z * 180/Math.PI)
|
console.log("OLD:","pitch", old.x * 180/Math.PI, "yaw", old.y * 180/Math.PI, "roll", old.z * 180/Math.PI)
|
||||||
console.log("DIFF:","pitch", dif.x * 180/Math.PI, "yaw", dif.y * 180/Math.PI, "roll", dif.z * 180/Math.PI)
|
console.log("DIFF:","pitch", dif.x * 180/Math.PI, "yaw", dif.y * 180/Math.PI, "roll", dif.z * 180/Math.PI)
|
||||||
calPitch = dif.x // * 180/Math.PI
|
calPitch = dif.x
|
||||||
calYaw = dif.y // * 180/Math.PI
|
calYaw = dif.y
|
||||||
calRoll = dif.z // * 180/Math.PI
|
calRoll = dif.z
|
||||||
calibrationRot = diff
|
calibrationRot = diff
|
||||||
}
|
}
|
||||||
document.getElementById("deleteCalibration").onclick = delCalibration
|
document.getElementById("deleteCalibration").onclick = delCalibration
|
||||||
@ -172,6 +176,7 @@ let altimeter = $.flightIndicator('#altimeter', 'altimeter', options);
|
|||||||
let airspeedLabel = document.getElementById("airspeedLabel")
|
let airspeedLabel = document.getElementById("airspeedLabel")
|
||||||
let altitudeLabel = document.getElementById("altitudeLabel")
|
let altitudeLabel = document.getElementById("altitudeLabel")
|
||||||
|
|
||||||
|
// function to set analog indictors from current sensor data
|
||||||
function setIndicatorsTcp(sensordata) {
|
function setIndicatorsTcp(sensordata) {
|
||||||
let q = new THREE.Euler().setFromQuaternion( cube2.quaternion, 'YXZ' ) // XYZ XZY YZX YXZ ZXY ZYX
|
let q = new THREE.Euler().setFromQuaternion( cube2.quaternion, 'YXZ' ) // XYZ XZY YZX YXZ ZXY ZYX
|
||||||
|
|
||||||
@ -185,6 +190,7 @@ function setIndicatorsTcp(sensordata) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// function to set analog indictors from current sensor data
|
||||||
function setIndicatorsSer(sensordata) {
|
function setIndicatorsSer(sensordata) {
|
||||||
if (sensordata.Orientation[0] !== 0 && sensordata.Orientation[1] !== 0) {
|
if (sensordata.Orientation[0] !== 0 && sensordata.Orientation[1] !== 0) {
|
||||||
attitudeSer.setPitch(sensordata.Orientation[0])
|
attitudeSer.setPitch(sensordata.Orientation[0])
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user