# supaeromoon-erc-mdrs/obc-erc-rpi architecture

> Architecture diagram of the GitHub repository supaeromoon-erc-mdrs/obc-erc-rpi, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-05-25). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/supaeromoon-erc-mdrs/obc-erc-rpi
- Repository: https://github.com/supaeromoon-erc-mdrs/obc-erc-rpi

## Overview

##### Project Type and Purpose
- This is a multi-package robotics control and simulation stack (ROS2) for an on-board computer (OBC) and Raspberry Pi (ERC-RPI) environment.
- It includes low-level motor drivers, kinematics modules, keyboard/remote teleoperation, MoveIt planning, URDF descriptions, and Gazebo/rviz simulation packages.

##### File Structure Analysis
- Top-level “src” directory contains six ROS2 packages:
- arm_build – inverse kinematics, servo command node, keyboard interface, URDF/xacro model for the robotic arm.
- arm_test – MoveIt test configurations, controllers, launch scripts for demo and planning.
- erc_build – rover motion nodes (encoder, steering, messenger), Roboclaw driver nodes, keyboard control.
- roboticArm – sample scripts, two workspaces (hello_moveit C++ demo, manual Python control package with trajectory planner, end effector execution).
- sim_mdrs – simulation package mirroring hardware drivers and control nodes, Gazebo/Xacro models, custom messages, C++ controllers.
- testing – stand-alone scripts and driver tests.
- Each package has a package.xml, setup.py/cfg, launch folder (Python launch files), config folder (YAMLs for kinematics, joints, controllers), URDF/xacro models, and tests.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% User/Operator Layer
    subgraph "User/Operator Layer"
        direction TB
        Keyboard["Keyboard/Remote Teleop"]:::teleop
        click Keyboard "https://github.com/supaeromoon-erc-mdrs/obc-erc-rpi/blob/master/src/erc_build/erc_build/keyboard_control.py"
        click Keyboard "https://github.com/supaeromoon-erc-mdrs/obc-erc-rpi/blob/master/src/arm_build/arm_build/keyboard_arm.py"
    end

    %% Control & Planning Layer
    subgraph "Control & Planning Layer"
        direction TB
        ROS2Core["ROS2 Core (launch.bash)"]:::core
        click ROS2Core "https://github.com/supaeromoon-erc-mdrs/obc-erc-rpi/blob/master/launch.bash"

        subgraph "arm_build Package" 
            direction TB
            IK["inverse_kinematics"]:::planning
            click IK "https://github.com/supaeromoon-erc-mdrs/obc-erc-rpi/blob/master/src/arm_build/arm_build/inverse_kinematics.py"
            ServoCmd["servo_command_node"]:::hardware
            click ServoCmd "https://github.com/supaeromoon-erc-mdrs/obc-erc-rpi/blob/master/src/arm_build/arm_build/servo_command_node.py"
            KbArm["keyboard_arm"]:::teleop
            click KbArm "https://github.com/supaeromoon-erc-mdrs/obc-erc-rpi/blob/master/src/arm_build/arm_build/keyboard_arm.py"
        end

        subgraph "erc_build Package"
            direction TB
            Encoder["encoder_node"]:::hardware
            click Encoder "https://github.com/supaeromoon-erc-mdrs/obc-erc-rpi/blob/master/src/erc_build/erc_build/encoder_node.py"
            Steering["steering_node"]:::hardware
            click Steering "https://github.com/supaeromoon-erc-mdrs/obc-erc-rpi/blob/master/src/erc_build/erc_build/steering_node.py"
            RemoteMsg["remote_messages_node"]:::teleop
            click RemoteMsg "https://github.com/supaeromoon-erc-mdrs/obc-erc-rpi/blob/master/src/erc_build/erc_build/remote_messages_node.py"
            Roboclaw["roboclaw_node"]:::hardware
            click Roboclaw "https://github.com/supaeromoon-erc-mdrs/obc-erc-rpi/blob/master/src/erc_build/erc_build/roboclaw_node.py"
        end

        subgraph "arm_test Package (MoveIt)"
            direction TB
            MoveGroup["move_group"]:::planning
            RViz["rviz_interface"]:::planning
            click RViz "https://github.com/supaeromoon-erc-mdrs/obc-erc-rpi/blob/master/src/arm_test/launch/moveit_rviz.launch.py"
        end

        subgraph "roboticArm Meta-Package"
            direction TB
            TrajPlanner["trajectory_planner"]:::planning
            click TrajPlanner "https://github.com/supaeromoon-erc-mdrs/obc-erc-rpi/blob/master/src/roboticArm/src/robot_arm_manual_ws/src/my_python_pkg/my_python_pkg/trajectory_planner.py"
            EndEff["end_effector_execution"]:::planning
            click EndEff "https://github.com/supaeromoon-erc-mdrs/obc-erc-rpi/blob/master/src/roboticArm/src/robot_arm_manual_ws/src/my_python_pkg/my_python_pkg/end_effector_execution.py"
        end
    end

    %% Hardware/Simulation Layer
    subgraph "Hardware/Simulation Layer"
        direction TB
        subgraph "Hardware Drivers"
            direction TB
            RoboclawDrv["roboclaw_driver"]:::hardware
            click RoboclawDrv "https://github.com/supaeromoon-erc-mdrs/obc-erc-rpi/blob/master/src/erc_build/erc_build/roboclaw_driver.py"
            ServoHW["Servos & Sensors"]:::hardware
            URDFArm["arm.urdf.xacro"]:::config
            click URDFArm "https://github.com/supaeromoon-erc-mdrs/obc-erc-rpi/blob/master/src/arm_build/urdf/arm.urdf.xacro"
        end
        subgraph "sim_mdrs Package"
            direction TB
            DiffCtrl["diff_controller"]:::sim
            click DiffCtrl "https://github.com/supaeromoon-erc-mdrs/obc-erc-rpi/blob/master/src/sim_mdrs/sim_mdrs/diff_controller.py"
            GripperSim["gripper"]:::sim
            click GripperSim "https://github.com/supaeromoon-erc-mdrs/obc-erc-rpi/blob/master/src/sim_mdrs/sim_mdrs/gripper.py"
            TeleSim["telem_node"]:::sim
            click TeleSim "https://github.com/supaeromoon-erc-mdrs/obc-erc-rpi/blob/master/src/sim_mdrs/sim_mdrs/telem_node.py"
        end
        Gazebo["Gazebo"]:::external
        RVizExt["RViz"]:::external
    end

    %% Resources
    subgraph "Resources"
        direction TB
        ConfigYAML["controller YAMLs"]:::config
        SRDF["my_robot_arm.srdf"]:::config
    end

    %% Flows
    Keyboard -->|"/cmd_vel"| RemoteMsg
    Keyboard -->|"/teleop_arm_cmds"| KbArm
    IK -->|"IK Service"| ServoCmd
    MoveGroup -- "trajectory plan" --> TrajPlanner
    ROS2Core --> IK
    ROS2Core --> Encoder
    ROS2Core --> MoveGroup
    ServoCmd --> ServoHW
    Roboclaw --> RoboclawDrv
    DiffCtrl --> Gazebo
    GripperSim --> Gazebo
    RViz --> ROS2Core

    %% Styles
    classDef planning fill:#ADD8E6,stroke:#0000FF
    classDef hardware fill:#98FB98,stroke:#006400
    classDef teleop fill:#FFA500,stroke:#FF8C00
    classDef sim fill:#D3D3D3,stroke:#808080
    classDef config fill:#FFFACD,stroke:#FFD700
    classDef external fill:#F0F8FF,stroke:#4682B4
    classDef core fill:#E6E6FA,stroke:#9370DB
```
