rrt

Path finding using dual-RRT connect

8 releases (breaking)

0.7.0 Feb 3, 2023
0.6.0 Jan 19, 2022
0.5.0 Mar 3, 2021
0.4.0 May 23, 2018
0.1.1 Jul 25, 2017

#892 in Algorithms

Download history 97/week @ 2024-06-15 149/week @ 2024-06-22 42/week @ 2024-06-29 77/week @ 2024-07-06 105/week @ 2024-07-13 74/week @ 2024-07-20 164/week @ 2024-07-27 221/week @ 2024-08-03 136/week @ 2024-08-10 146/week @ 2024-08-17 264/week @ 2024-08-24 213/week @ 2024-08-31 209/week @ 2024-09-07 161/week @ 2024-09-14 220/week @ 2024-09-21 130/week @ 2024-09-28

760 downloads per month
Used in 9 crates (2 directly)

Apache-2.0

24KB
264 lines

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);

Dependencies

~1–1.6MB
~31K SLoC