Crates.io | frames |
lib.rs | frames |
version | 0.1.0 |
source | src |
created_at | 2022-06-23 20:08:33.740698 |
updated_at | 2022-07-01 15:51:59.755205 |
description | Contextual frames made simple. |
homepage | |
repository | https://github.com/bobbbay/frames |
max_upload_size | |
id | 612067 |
size | 6,705 |
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(())
}