Please check the build logs for more information.
See Builds for ideas on how to fix a failed build, or Metadata for how to configure docs.rs builds.
If you believe this is docs.rs' fault, open an issue.
Dubin's Paths
Calculates a path between two points in space with starting and ending rotation requirements.
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.
The car is assumed to be a dubin's car. A dubin's car is a car that can only do 3 things: turn left, turn right, or go straight.
Examples
Basic usage
This will calculate the path that connects the current position and rotation of the car to the desired position and rotation.
use PI;
use ;
// 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_floats can also be used for const contexts
const q0: PosRot = from_floats;
// The target end position and rotation
// PosRot implements From<[f32; 3]>
let q1 = .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 = 11.6;
// Calculate the shortest possible path between these two points with the given turning radius
let shortest_path_possible: = shortest_from;
// Assert that the path was found!
assert!;
Sample path for points
Calculating the path is very optimized, and does not include any points along the path.
This means that if you want to get points along the path, extra work must be done.
Below, we calculate all points along a path spaced at a given interval. Use sample instead of sample_many to get only one point.
use PI;
use ;
let shortest_path_possible = shortest_from.unwrap;
// The distance between each sample point
let step_distance = 5.;
Features
std- (Default) Enables the use of the standard libraryalloc- (Default) Enablessample_manyandsample_many_rangelibm- Use the [libm] crate for math operationsglam- Use aglamcompatible APIserde- Implementations of [serde::Deserialize] and [serde::Serialize] for most typesrkyv- Implementations of [rkyv::Archive], [rkyv::Deserialize] and [rkyv::Serialize] for most types