How alexprinse/project_o works
1. Overall shape
This repo is a layered robotics mission pipeline. The top-level Python app accepts a natural-language command, turns it into a structured mission, validates it against safety rules, and then dispatches it to either ROS 2 robot control, a multi-robot coordination layer, or a mock/offline backend.
2. Entry points and modes
main.py is the primary runtime entrypoint. It selects the robot profile, reads the prompt, and switches between --ros execution and --mock-llm offline mode. Dockerfile, docker-compose.yml, and setup_simulation.sh support two deployment paths: native ROS/Gazebo on the host or a fully containerized simulator stack.
3. Natural-language to mission translation
The llm/ package is the parsing boundary. llm/client.py wraps the Gemini API, while llm/prompts.py builds a dynamic system prompt from configuration and waypoint catalogs. The important input data comes from config/waypoints_*.yaml and config/settings.yaml, which let the model resolve named places like patrol routes or waypoint labels into mission fields.
4. Validation as a hard gate
validator/schema.py defines the mission contract, and validator/validator.py enforces it before any robot action occurs. This is the repository’s safety boundary: malformed JSON, out-of-range coordinates, invalid loop counts, or unsupported mission shapes are rejected before execution.
5. Deterministic execution layer
executor/executor.py converts validated missions into concrete robot actions. It is the orchestration boundary that decides whether a mission is a simple navigation task, a multi-robot task, or a vision-follow task, and then routes control to the right subsystem.
6. Robot abstraction and backends
The robot/ package hides the physical/simulated backend behind controller implementations in base.py, ros2_controller.py, mock_controller.py, and the legacy ebot_controller.py. This makes the mission engine independent from the underlying robot stack while still supporting both TurtleBot3/Nav2 and the older e-Yantra ebot path.
7. Multi-robot coordination subsystem
The robot/formation/ modules implement squad behavior: squad_commander.py routes the mission, manager.py manages formation state and live re-planning, tasks.py handles route splitting and regroup logic, and formations.py defines formation geometry. This layer is only activated when the parsed mission targets multiple robots, so it sits between mission execution and individual robot navigation.
8. Navigation and SLAM boundary
For TurtleBot3, the ROS 2 stack is built around Nav2 and SLAM Toolbox. config/nav2_params.yaml tunes navigation behavior, config/launch/multi_slam_launch.py starts namespaced SLAM instances for multi-robot operation, and the warehouse map/world files in config/maps/ and config/worlds/ define the static simulation environment. The robot controller adapts its behavior depending on whether AMCL or SLAM Toolbox is active.
9. Vision-based follow subsystem
Target detection and pursuit live inside robot/ros2_controller.py. It uses YOLOv8 for object detection, converts ROS camera images directly into OpenCV frames, publishes annotated output for RViz, and controls motion based on target position and size. scripts/swap_object.py is the companion tool used to spawn or swap Gazebo objects for testing.
10. Simulation assets and ROS workspace layout
The eyrc_ws/src/ tree contains the simulation-specific ROS packages and assets: ur_description, ur_simulation_gz, ebot_description, eyantra_warehouse, linkattacher_msgs, and ur5_control. These packages provide robot descriptions, launch files, Gazebo models, custom services, and legacy task scaffolding. They are support infrastructure around the mission pipeline rather than the pipeline itself.
11. Legacy ebot versus TurtleBot3 boundary
The repo supports two distinct robot ecosystems, but they are intentionally separated. TurtleBot3 is the primary architecture for Nav2, SLAM, and vision tasks; ebot is retained only for the core single-robot task and uses a different simulation and control model. The README explicitly treats them as non-coexistable stacks.
12. End-to-end data flow
The main flow is: user prompt → LLM prompt construction → structured mission JSON → Pydantic validation → mission executor → robot controller → Nav2/Gazebo or vision loop. The key architectural feature is that language understanding is decoupled from actuation by a validation gate, so no robot-side action can happen without passing through the schema and safety constraints first.
Main entry points: ros2_controller.py ROS 2 controller · executor.py Executor · main.py main.py · base.py Base controller
Components 24
Mission app
Top-level mission parsing, validation, and execution pipeline.
- main.py · Runtime entrypoint that selects mode, robot profile, and prompt input.
main.py - LLM client · Wraps the Gemini API for natural-language mission generation.
llm/client.py - Prompt builder · Builds system prompts from settings and waypoint catalogs.
llm/prompts.py - Mission schema · Defines the structured mission contract used for validation.
validator/schema.py - Validator · Rejects malformed or unsafe missions before execution.
validator/validator.py - Executor · Dispatches validated missions to the appropriate execution path.
executor/executor.py
Robot backends
Robot abstraction layers and runtime controllers.
- Base controller · Common controller interface behind robot-specific implementations.
robot/base.py - ROS 2 controller · Primary TurtleBot3 controller for navigation and vision-follow behavior.
robot/ros2_controller.py - Mock controller · Offline or simulated execution backend for non-ROS runs.
robot/mock_controller.py - ebot controller · Legacy controller path for the older ebot stack.
robot/ebot_controller.py
Coordination
Multi-robot squad coordination subsystem.
- Squad commander · Routes multi-robot missions into the coordination subsystem.
robot/formation/squad_commander.py - Formation manager · Maintains formation state and live re-planning decisions.
robot/formation/manager.py - Formation tasks · Splits routes and handles regroup logic for squad missions.
robot/formation/tasks.py - Formations · Defines squad formation shapes and spacing geometry.
robot/formation/formations.py
ROS workspace
Simulation and legacy ROS packages in eyrc_ws/src.
- Eyantra warehouse · Simulation package with warehouse task launches and models.
eyrc_ws/src/eyantra_warehouse - UR description · UR robot description, URDF/xacro, and visualization assets.
eyrc_ws/src/ur_description - UR sim gz · Gazebo simulation package for UR arm control and spawning.
eyrc_ws/src/ur_simulation_gz - Link msgs · Custom attach/detach link services for simulation tasks.
eyrc_ws/src/linkattacher_msgs
Config and assets
Mission config, navigation, and environment resources.
- Nav2 params · Tuning for TurtleBot3 navigation behavior.
config/nav2_params.yaml - Settings · Runtime configuration for profiles and prompt assembly.
config/settings.yaml - Waypoints · Named waypoint catalogs for robot profiles.
config/waypoints_turtlebot3.yaml - Multi SLAM · Launches namespaced SLAM instances for multi-robot operation.
config/launch/multi_slam_launch.py - Warehouse map · Static warehouse map used by navigation and simulation.
config/maps/warehouse_map.yaml - Warehouse world · Gazebo warehouse world definition.
config/worlds/warehouse.world
Connections 27
- main.py → Prompt builder: build prompt · Constructs the command prompt from settings and waypoint catalogs.
- main.py → LLM client: request mission · Sends the prompt to the language model unless mock mode is used.
- Prompt builder → Settings: reads · Uses runtime configuration to shape the prompt.
- Prompt builder → Waypoints: reads · Injects waypoint labels and route hints into the prompt.
- LLM client → Executor: mission json · Returns structured mission content into the execution pipeline.
- Executor → Mission schema: checks contract · Relies on the mission schema for mission shape and field expectations.
- Executor → Validator: validate · Runs the hard safety gate before any robot action.
- Validator → Mission schema: enforces · Validates JSON structure, bounds, and mission constraints.
- Executor → Base controller: dispatch via · Uses the common controller interface for all backends.
- Base controller → ROS 2 controller: implements · Primary ROS 2/TurtleBot3 control implementation.
- Base controller → Mock controller: implements · Offline or non-ROS execution implementation.
- Base controller → ebot controller: implements · Legacy ebot control implementation.
- Executor → Squad commander: multi-robot · Routes multi-robot missions into squad coordination.
- Squad commander → Formation manager: manage · Tracks formation state and replanning.
- Formation manager → Formation tasks: plan tasks · Splits routes and handles regroup behavior.
- Formation tasks → Formations: shape rules · Applies formation geometry and spacing constraints.
- ROS 2 controller → Nav2 params: tunes · Uses navigation parameters for movement behavior.
- ROS 2 controller → Multi SLAM: launches · Interacts with multi-robot SLAM launch configuration when needed.
- ROS 2 controller → Warehouse map: navigates on · Uses the warehouse map for localization and pathing.
- ROS 2 controller → Warehouse world: simulates in · Operates against the warehouse Gazebo world.
- ROS 2 controller → Link msgs: attach/detach · Uses custom ROS services for simulation task interactions.
- ROS 2 controller → UR description: robot model · Consumes robot descriptions and visual assets for ROS/Gazebo integration.
- UR sim gz → UR description: depends on · Simulation package builds on the UR model and descriptions.
- Eyantra warehouse → Warehouse world: launches · Starts warehouse-specific scenarios and environments.
- Eyantra warehouse → Link msgs: uses · Uses custom services in warehouse task flows.
- main.py → Mock controller: mock mode · Offline mode bypasses robot actuation.
- main.py → ROS 2 controller: ros mode · ROS mode activates the primary robot backend.