Skip to content

Commit

Permalink
fix calibration/offset mode when stage is rotated
Browse files Browse the repository at this point in the history
  • Loading branch information
galister committed Sep 15, 2024
1 parent c48bab5 commit c2c0e46
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 8 deletions.
7 changes: 3 additions & 4 deletions src/calibrator/offset.rs
Original file line number Diff line number Diff line change
Expand Up @@ -122,13 +122,12 @@ impl Calibrator for OffsetMethod {
return Ok(StepResult::Continue);
}

let inv_stage = TransformD::from(
let stage = TransformD::from(
data.monado
.get_reference_space_offset(mnd::ReferenceSpaceType::Stage)?,
)
.inverse();
);

let (pose_a, pose_b) = (inv_stage * pose_a, inv_stage * pose_b);
let (pose_a, pose_b) = (stage * pose_a, stage * pose_b);

let target_a = pose_b * self.target_offset;

Expand Down
7 changes: 3 additions & 4 deletions src/calibrator/sampled.rs
Original file line number Diff line number Diff line change
Expand Up @@ -101,13 +101,12 @@ impl SampledMethod {
.locate(&data.stage, data.now)?
.into_transformd()?;

let inv_stage = TransformD::from(
let stage = TransformD::from(
data.monado
.get_reference_space_offset(mnd::ReferenceSpaceType::Stage)?,
)
.inverse();
);

let (new_a, new_b) = (inv_stage * new_a, inv_stage * new_b);
let (new_a, new_b) = (stage * new_a, stage * new_b);
self.samples.push(Sample { a: new_a, b: new_b });

Ok(())
Expand Down

0 comments on commit c2c0e46

Please sign in to comment.