Task: Extend Apollo sim_control to support dynamic obstacles with trigger-based movement.
1. Data Structure (Protobuf):
- Define a
DynamicObstacle message including:
id, type, polygon_vertices.
trajectory: A list of (x, y, v, t) points.
trigger: OneOf {reach_position, distance_to_ego, time_delay}.
2. Trigger Manager Logic (C++):
- Implement a
TriggerEvaluator class that runs in the sim_control loop.
- Function:
bool IsTriggered(const EgoState& ego, const TriggerConfig& config).
- If
spatial_trigger is used, implement a Point-in-Polygon check to see if the ego vehicle has entered the activation zone.
3. Frontend Interaction (React/Three.js):
- Path Editor: Reuse the Routing Editor logic to create a smooth path for the obstacle.
- Trigger Linkage: Visual representation of a "wire" connecting a trigger zone to an obstacle in the UI.
- State Management: Handle the obstacle's lifecycle:
IDLE (waiting for trigger) -> MOVING (following path) -> FINISHED.