jupedsim_scenarios.direct_steering_runtime#

Functions#

advance_path_target(wait_info)

assign_agent_target(agent, target)

body_intersects_polygon(x, y, polygon, agent_radius)

True if a disk of agent_radius centered at (x, y) overlaps polygon.

check_stage_reached(wait_info, stage_cfg, x, y, ...)

Determine whether the agent has reached its current stage.

ensure_agent_speed_state(agent_speed_state, agent_id, ...)

extract_agent_xy(agent)

get_agent_desired_speed(→ float | None)

is_inside_polygon(x, y, polygon)

normalize_speed_factor(→ float)

pick_stage_target(wait_state, next_stage_cfg)

Pick a target point in the stage polygon.

random_point_in_polygon(polygon, rng[, min_clearance])

restore_agent_speed(→ None)

sample_wait_time(stage_cfg, base_seed, step_index)

set_agent_desired_speed(→ bool)

update_checkpoint_speed(→ None)

Module Contents#

advance_path_target(wait_info)[source]#
assign_agent_target(agent, target)[source]#
body_intersects_polygon(x, y, polygon, agent_radius)[source]#

True if a disk of agent_radius centered at (x, y) overlaps polygon.

Used for exit-arrival checks where the routing’s arrival waypoint may land outside a narrow exit polygon (issue #15). Shapely’s polygon.distance(point) is 0 when the point is inside or on the boundary, so this also subsumes is_inside_polygon for any non-negative radius.

check_stage_reached(wait_info, stage_cfg, x, y, current_time, target)[source]#

Determine whether the agent has reached its current stage.

Transit stages (waiting_time=0, non-exit, with polygon) use entry-based transition: the agent only needs to enter the polygon and dwell briefly. Waiting stages and exits use the original distance-based check.

Returns True if the stage should be considered reached. May mutate wait_info[“inside_since”] as a side-effect.

ensure_agent_speed_state(agent_speed_state: dict[int, dict[str, Any]], agent_id: int, agent)[source]#
extract_agent_xy(agent)[source]#
get_agent_desired_speed(agent) float | None[source]#
is_inside_polygon(x, y, polygon)[source]#
normalize_speed_factor(value: Any) float[source]#
pick_stage_target(wait_state, next_stage_cfg)[source]#

Pick a target point in the stage polygon.

Transit stages (waiting_time=0, non-exit) use the polygon centroid so agents approach head-on without crossing paths. Waiting stages use a random interior point to distribute agents.

random_point_in_polygon(polygon, rng, min_clearance: float = 0.2)[source]#
restore_agent_speed(agent_speed_state: dict[int, dict[str, Any]], agent_id: int, agent) None[source]#
sample_wait_time(stage_cfg, base_seed, step_index)[source]#
set_agent_desired_speed(agent, speed: float) bool[source]#
update_checkpoint_speed(agent_speed_state: dict[int, dict[str, Any]], direct_steering_info: dict[str, dict[str, Any]] | None, agent_id: int, agent, checkpoint_key: str | None, stage_cfg: dict[str, Any] | None, x: float, y: float) None[source]#