Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 | 3x 1x 1x 1x 1x 1x 6x 6x 6x 2x 2x 2x 2x 4x 6x 6x 6x 6x 6x | // Generated by ReScript, PLEASE EDIT WITH CARE
import * as SensorToBody$WsteinRegripCore from "./SensorToBody.res.mjs";
import * as GyroOrientation$WsteinRegripCore from "./GyroOrientation.res.mjs";
import * as OrientationStabilizer$WsteinRegripCore from "./OrientationStabilizer.res.mjs";
function makeConfig(stabilizer) {
return {
stabilizer: stabilizer,
sensorToBody: SensorToBody$WsteinRegripCore.default
};
}
let initial = {
gyro: GyroOrientation$WsteinRegripCore.initial,
stabilizer: OrientationStabilizer$WsteinRegripCore.initial,
previousTimestamp: undefined
};
function reset(param) {
return initial;
}
function resetStabilizer(state) {
return {
gyro: state.gyro,
stabilizer: OrientationStabilizer$WsteinRegripCore.initial,
previousTimestamp: state.previousTimestamp
};
}
function withStabilizerConfig(config, stabilizer) {
return {
stabilizer: stabilizer,
sensorToBody: config.sensorToBody
};
}
function withSensorToBody(config, sensorToBody) {
return {
stabilizer: config.stabilizer,
sensorToBody: sensorToBody
};
}
function step(state, raw, timestamp, velocity, config, stabilizerEnabled) {
let match = GyroOrientation$WsteinRegripCore.relative(state.gyro, raw, config.sensorToBody);
let relative = match[1];
let velocityMagnitude;
if (velocity !== undefined) {
let z = velocity.z;
let y = velocity.y;
let x = velocity.x;
velocityMagnitude = Math.sqrt(x * x + y * y + z * z);
} else {
velocityMagnitude = 0;
}
let previous = state.previousTimestamp;
let dtSeconds = previous !== undefined ? Math.max(0, (timestamp - previous) / 1000) : 0;
let match$1 = stabilizerEnabled ? OrientationStabilizer$WsteinRegripCore.stepSample(state.stabilizer, relative, velocityMagnitude, dtSeconds, config.stabilizer) : [
state.stabilizer,
{
driftCorrected: relative,
stabilized: relative
}
];
let stabilizerSample = match$1[1];
return [
{
gyro: match[0],
stabilizer: match$1[0],
previousTimestamp: timestamp
},
{
relative: relative,
driftCorrected: stabilizerSample.driftCorrected,
stabilized: stabilizerSample.stabilized,
velocityMagnitude: velocityMagnitude,
dtSeconds: dtSeconds
}
];
}
export {
makeConfig,
initial,
reset,
resetStabilizer,
withStabilizerConfig,
withSensorToBody,
step,
}
/* GyroOrientation-WsteinRegripCore Not a pure module */
|