rrt

Crates.iorrt
lib.rsrrt
version0.7.0
sourcesrc
created_at2017-07-25 05:34:47.518875
updated_at2023-02-03 07:20:52.02681
descriptionPath finding using dual-RRT connect
homepage
repositoryhttps://github.com/openrr/rrt
max_upload_size
id24967
size81,670
Mitsuharu Kojima (mitsuharu-kojima)

documentation

README

rrt

Build Status crates.io docs

RRT (Rapidly-exploring Random Tree) library in Rust.

Only Dual RRT Connect is supported.

Examples

There is an example to solve collision avoid problem.

cargo run --release --example collision_avoid

Below is the simplest example. It search the path from [-1.2, 0.0] to [1.2, 0.0] avoiding [-1, -1] - [1, 1] region. There are only one function dual_rrt_connect, which takes start, goal, is free function, random generation function, unit length of extend, max repeat num.

use rand::distributions::{Distribution, Uniform};
let result = rrt::dual_rrt_connect(
    &[-1.2, 0.0],
    &[1.2, 0.0],
    |p: &[f64]| !(p[0].abs() < 1.0 && p[1].abs() < 1.0),
    || {
        let between = Uniform::new(-2.0, 2.0);
        let mut rng = rand::thread_rng();
        vec![between.sample(&mut rng), between.sample(&mut rng)]
    },
    0.2,
    1000,
)
.unwrap();
println!("{result:?}");
assert!(result.len() >= 4);
Commit count: 75

cargo fmt