30 stable releases

2.4.2 Oct 25, 2024
2.4.0 Aug 20, 2024
2.3.1 Jun 9, 2024
2.3.0 Mar 23, 2024
0.2.5 Oct 22, 2021

#70 in Simulation

Download history 3211/week @ 2024-09-15 1299/week @ 2024-09-22 2143/week @ 2024-09-29 2459/week @ 2024-10-06 2166/week @ 2024-10-13 2296/week @ 2024-10-20 2242/week @ 2024-10-27 1590/week @ 2024-11-03 1730/week @ 2024-11-10 2964/week @ 2024-11-17 1492/week @ 2024-11-24 1896/week @ 2024-12-01 1642/week @ 2024-12-08 1855/week @ 2024-12-15 694/week @ 2024-12-22 901/week @ 2024-12-29

5,173 downloads per month

MIT license

36KB
451 lines

Dubin's Paths

unsafe forbidden

Rust code for calculating Dubin's Paths

Credit to Andrew Walker for the original C code

I've ported the code to Rust and documented everything that I could understand. Documentation in the original repository was minimal.

Quick example

use core::f32::consts::PI;
use dubins_paths::{DubinsPath, PosRot, Result as DubinsResult};

// PosRot represents the car's (Pos)ition and (Rot)ation
// Where x and y are the coordinates on a 2d plane
// and theta is the orientation of the car's front in radians

// The starting position and rotation
// PosRot::from_f32 can also be used for const contexts
const q0: PosRot = PosRot::from_f32(0., 0., PI / 4.);

// The target end position and rotation
// PosRot implements From<[f32; 3]>
let q1 = [100., -100., PI * (3. / 4.)].into();

// The car's turning radius (must be > 0)
// This can be calculated by taking a cars angular velocity and dividing it by the car's forward velocity
// `turn radius = ang_vel / forward_vel`
let rho: f32 = 11.6;

// Calculate the shortest possible path between these two points with the given turning radius
let shortest_path_possible: DubinsResult<DubinsPath> = DubinsPath::shortest_from(q0, q1, rho);

// Assert that the path was found!
assert!(shortest_path_possible.is_ok());

DubinsPath has many methods you should look into, such as length, extract_subpath, sample, and sample_many.

Features

  • glam - Use a glam compatible API

More documentation

Looking for some more detailed documentation? Head on over to the docs.rs page!

Dependencies

~0–1MB
~29K SLoC