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.
```rust use core::f32::consts::PI; use dubins_paths::{DubinsPath, PosRot, Result as DubinsResult};
// PosRot has the format [f32; 3] // It represents the car's [x, y, theta] // 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 let q0: PosRot = [0., 0., PI / 4.];
// The target end position and rotation let q1: PosRot = [100., -100., PI * (3. / 4.)];
// 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 let rho: f32 = 11.6;
// Calculate the shortest possible path between these two points with the given turning radius
let shortestpathpossible: DubinsResult
// Assert that the path was found! assert!(shortestpathpossible.is_ok()); ```
DubinsPath has many methods you should look into, such as length, extractsubpath, sample, and samplemany.
glam
- Use a glam compatible APIfast-math
- Enable the fast-math feature in glamLooking for some more detailed documentation? Head on over to the docs.rs page!