All files / domain GyroOrientation.res.mjs

100% Statements 14/14
70% Branches 7/10
100% Functions 4/4
100% Lines 14/14

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          2x           2x         1x       15x 15x 15x 15x 15x                 9x 9x       9x 9x 9x 9x                              
// Generated by ReScript, PLEASE EDIT WITH CARE
 
import * as Quaternion$WsteinRegripCore from "./Quaternion.res.mjs";
import * as SensorToBody$WsteinRegripCore from "./SensorToBody.res.mjs";
 
let home = Quaternion$WsteinRegripCore.fromEuler({
  x: Quaternion$WsteinRegripCore.degreesToRadians(15),
  y: Quaternion$WsteinRegripCore.degreesToRadians(-20),
  z: 0
});
 
let initial = {
  basis: undefined
};
 
function reset(param) {
  return initial;
}
 
function relative(state, raw, sensorToBodyOpt) {
  let sensorToBody = sensorToBodyOpt !== undefined ? sensorToBodyOpt : SensorToBody$WsteinRegripCore.default;
  let q = SensorToBody$WsteinRegripCore.apply(sensorToBody, raw);
  let basis = state.basis;
  let basis$1 = basis !== undefined ? basis : Quaternion$WsteinRegripCore.conjugate(q);
  return [
    {
      basis: basis$1
    },
    Quaternion$WsteinRegripCore.premultiply(q, basis$1)
  ];
}
 
function applyHome(relative, homeOpt) {
  let home$1 = homeOpt !== undefined ? homeOpt : home;
  return Quaternion$WsteinRegripCore.premultiply(relative, home$1);
}
 
function step(state, raw, sensorToBodyOpt, homeOpt) {
  let sensorToBody = sensorToBodyOpt !== undefined ? sensorToBodyOpt : SensorToBody$WsteinRegripCore.default;
  let home$1 = homeOpt !== undefined ? homeOpt : home;
  let match = relative(state, raw, sensorToBody);
  return [
    match[0],
    applyHome(match[1], home$1)
  ];
}
 
export {
  home,
  initial,
  reset,
  relative,
  applyHome,
  step,
}
/* home Not a pure module */