2 unstable releases
0.1.0 | Jul 1, 2022 |
---|---|
0.0.0 | Jun 23, 2022 |
#1100 in Math
5KB
115 lines
License · Docs
You want to move your robot from point A to point B. That's all you ever want to do, really. The question is, how do you model the multiple frames that exist in your environment?
Say you have the following:
In short — Frames solves for (x, y, θ)
like so:
use frames::prelude::*;
use nalgebra::{Isometry2, Vector2};
use std::f32::consts::PI;
fn main() -> Result<(), FrameError> {
let mut frames = Frames::new();
let field = Frame::new("field");
let robot = Frame::new("robot");
frames.add_frame(field, Isometry2::new(Vector2::new(0., 0.), 0.))?;
frames.add_frame(robot, Isometry2::new(Vector2::new(1., 1.), PI))?;
let x = Point::new("x");
frames.add_point_in_context(
x,
Isometry2::new(Vector2::new(7., 5.), PI),
field,
)?;
assert_eq!(
frames.get_point_in_context(x, robot)?,
Isometry2::new(Vector2::new(6., 4.), 0.)
);
Ok(())
}
Features
- Efficient — optimized, no-nonsense calculations.
- Scalable — calculate in any dimensions.
- Type-safe — errors can be seen at compile-time.
Dependencies
~3.5MB
~73K SLoC