Skip to main content

Crate rustsim_mobility

Crate rustsim_mobility 

Source
Expand description

Multi-modal mobility for rustsim.

This crate is the glue layer that lets pedestrians, cyclists, cars, taxis, buses, trains, and lifts participate in the same simulation without any one domain crate having to know about the others.

It provides:

  • leg — a trip broken into per-mode legs with waypoints in 2-D or 3-D.
  • mode_state — a deterministic state machine that advances a traveller through their legs (walk → board → ride → alight → walk → drive → park → walk → …).
  • obstacle — a shared Obstacle trait every domain can implement, so crowd models can see vehicles and vehicles can see crowd clusters.
  • router — a multi-modal Dijkstra over mode-tagged graphs, with construction helpers for rustsim-traffic link metadata.
  • policy — cross-domain queue, dispatch, dwell, and control policy contracts re-exported for multimodal orchestration.

The crate is deliberately small and opinionated — it is not a full MATSim/SUMO replacement, it is the engineering contract that keeps domain crates decoupled while still allowing them to interact.

Re-exports§

pub use leg::Leg;
pub use leg::TripPlan;
pub use leg::Waypoint;
pub use mode_state::ModeController;
pub use mode_state::ModeState;
pub use mode_state::TravellerContext;
pub use obstacle::Obstacle;
pub use obstacle::ObstacleKind;
pub use obstacle::ObstacleSnapshot;
pub use obstacle::PedestrianObstacle;
pub use obstacle::VehicleObstacle;
pub use router::only;
pub use router::shortest_path;
pub use router::ModalEdge;
pub use router::ModalGraph;
pub use router::ModalGraphBuildError;
pub use router::ModalRoute;

Modules§

leg
Trip plans made of per-mode Legs.
mode_state
Mode-transition state machine for travellers.
obstacle
Cross-domain obstacle trait.
policy
Cross-domain mobility policy re-exports.
prelude
Convenience re-exports.
router
Mode-tagged routing graph and Dijkstra router.

Structs§

CapacityStopQueuePolicy
Stop queue policy that enforces the stop’s soft capacity as a hard cap.
ControlContext
Signal/control context for an approach or movement.
DispatchContext
Dispatch request context for one route at one simulation time.
FifoBoardingPolicy
FIFO boarding policy with an optional per-stop-event boarding cap.
FifoGapPolicy
FIFO policy with a fixed gap to the leader and fixed exit clearance.
FixedControlPolicy
Fixed-rule control policy for uncontrolled, yield, stop, and signal controls.
LinearDwellPolicy
Linear dwell policy backed by DwellParams.
ScheduledDispatchPolicy
Schedule-following dispatch policy with optional active-vehicle caps.
SpeedDecision
Speed chosen by a queue policy.

Enums§

ControlDecision
Control decision for a movement.
DispatchDecision
Decision returned by a dispatch policy.
SpeedConstraint
Why a policy constrained an agent’s speed.

Traits§

BoardingPolicy
Policy for deciding which queued passengers board a vehicle.
ControlPolicy
Policy that decides whether a movement may proceed through a control point.
DispatchPolicy
Policy that decides whether a route should dispatch a vehicle.
DwellPolicy
Policy for computing stop dwell times from passenger exchange counts.
QueuePolicy
Policy for choosing an agent’s link speed from ordered occupancy.
StopQueuePolicy
Policy for admitting passengers to a stop queue.

Functions§

board_with_policy
Apply a boarding policy to a queue and vehicle.