Skip to main content

Crate bevy_orca

Crate bevy_orca 

Source
Expand description

Hand-rolled ORCA (Optimal Reciprocal Collision Avoidance) — the local, unit-vs-unit avoidance layer beneath a global navigator (a flow field, a path follower). Given each agent’s preferred velocity (from the flow field), ORCA returns the collision-free velocity closest to it, assuming every neighbor does the same reasoning and each side takes half the avoidance (reciprocity). That reciprocity is what removes the oscillation and the mutual-cancel freeze of the old summed-force separation: two units on a head-on course each step aside by half instead of shoving equally and netting zero.

References:

  • van den Berg, Lin & Manocha, “Reciprocal Velocity Obstacles for Real-Time Multi-Agent Navigation”, ICRA 2008, DOI 10.1109/ROBOT.2008.4543489 (reciprocity removes oscillation).
  • van den Berg, Guy, Lin & Manocha, “Reciprocal n-Body Collision Avoidance”, Robotics Research (ISRR 2009), Springer STAR 70, 2011, DOI 10.1007/978-3-642-19457-3_1 (the ORCA half-plane construction + 2-D linear program below).

The half-plane construction and the three-stage linear program follow the authors’ reference implementation, RVO2 (van den Berg et al., Apache-2.0), closely enough that its names are kept — linear_program1/linear_program2/linear_program3, t_left/t_right, and RVO_EPSILON as EPSILON — so the two can be read side by side. See NOTICE.

§Scope

Only agent↔agent avoidance lives here. Static geometry is the caller’s concern in two senses: a global navigator should not route through solid space in the first place, and final contact is whatever the caller’s collision resolver says it is. Walls therefore enter only as the optional walls half-planes described on new_velocity — the LP’s obstacle-line count from static geometry is otherwise zero.

Re-exports§

pub use crowd::Crowd;
pub use crowd::CrowdMember;
pub use crowd::CrowdParams;

Modules§

crowd
A whole crowd, solved as one batch.

Structs§

Agent
A disc agent in the xz ground plane (y dropped): position, current velocity, radius.
OrcaScratch
Reusable buffers for new_velocity_in, so a caller solving for a crowd allocates nothing after the first call.

Functions§

new_velocity
Compute the collision-avoiding velocity for agent nearest to pref_vel, given neighbors.
new_velocity_in
new_velocity, reusing the buffers in scratch.