How roben-aast/shell_controller_2025 works
Project Type & Purpose
• This is a robotics-simulation + reinforcement-learning (RL) training pipeline.
• It integrates:
• CARLA (autonomous‐driving simulator)
• ROS (Robot Operating System) nodes & bridges
• A custom OpenAI‐Gym wrapper (gym_carla)
• An RL agent (PPO) with hyperparameter tuning (Optuna)
• C++ simulation nodes (shell_simulation) built via ROS/CMake
• Python package modules for brain, training, utilities
Top-Level Components
a. External Simulator
• CARLA UE4 process (launched via CarlaUE4.sh)
b. ROS Layer
• carla_shell_bridge (in sem-apc-ros-bridge / roslaunch carla_shell_bridge)
• shell_simulation node (in shell_simulation/src)
• Any additional ROS interfaces (e.g., sem-apc-carla-interface)
c. Gym Environment
• roben_ai/ai_src/gym_carla (custom Gym env)
• make_env.py entrypoint
d. RL Agent & Training
• Models: actor.py, critic.py, backbone.py
• Trainer: training/trainer.py, training/loss.py
• Hyperparameter search: optuna_study.py
• Logs & DB: ppo_carla.db, TensorBoard events under runs/
e. Configuration & Utilities
• roben_ai/config/hyperparams.py
• Utils: utils/types.py
• CLI scripts: scripts/install_requirements.py
f. Packaging & Testing
• setup.py / setup.cfg / requirements.txt
• Tests in test/
Relationships & Data Flow
1. CARLA simulator publishes sensor data & world state over ROS topics.
2. carla_shell_bridge subscribes to CARLA topics, republishes them into ROS.
3. shell_simulation node reads sensor topics, may inject control or logging.
4. Gym wrapper (gym_carla/envs/carla_env.py) acts as ROS subscriber/publisher:
• Receives observations
• Sends action messages back into ROS
5. The RL agent (trainer) calls Gym’s step(), passing actions, receives observations + rewards.
6. trainer.py updates actor/critic networks, logs scalar metrics to TensorBoard, saves models.
7. Optuna script wraps the trainer to iterate hyperparameter trials, reading/writing ppo_carla.db.
8. Configuration parameters drive network architecture and training loop.
Architectural Patterns & Principles
• Modular layering: Simulator ↔ ROS middleware ↔ Gym wrapper ↔ Agent/trainer
• Publish/subscribe (ROS topics) decouples simulation from agent.
• Client–server style for Gym→Trainer interactions.
• Separation of concerns:
• C++ code for simulation nodes
• Python code for RL & wrappers
• Extensibility: Hyperparameters in standalone config; new models can be added under models/.