How nuomizai/simple_test works
What this project is (type + purpose)
XROCS is a Python hardware interface / robotics control SDK that provides a unified API to control a robot arm (UR5), a camera (Orbbec), and a gripper (Robotiq). It is not a traditional “web system”; it’s a robotics integration library that likely runs on a control PC and talks to:
• the robot controller (UR),
• ROS2 nodes for camera acquisition (Orbbec),
• and the gripper driver (Robotiq),
while exposing a clean Python interface to higher-level applications (e.g., RL environments like rl_envs / HIL-RL).
Read the file tree as architecture clues
Top-level files indicate the main modules and integration points:
• ur_station.py / ur.py
UR robot arm abstraction + a “station” orchestration concept (robot + peripherals together).
• robotiq_gripper.py
Robotiq gripper interface (likely via UR tool IO or separate connection, depending on implementation).
• orbbec_camera_ros2.py, ros2_node_manager.py
Camera is integrated through ROS2 nodes; there’s a manager to start/stop/monitor ROS2 nodes.
• camera_utils.py
Utility layer for camera data transforms, conversions, calibration helpers, etc.
• core/config_loader.py, configuration.toml
• core/station_loader.py
Factory/loader: constructs the “station” from config (dependency injection style).
• rg_driver_opt.py
Looks like “Robotiq Gripper driver optimization” or alternative backend; treat as an optional driver path.
• Rate.py
Common robotics control primitive (rate/loop timing). This matters for depicting control loops.
This structure implies a layered architecture:
1) Application layer (examples in external repos + ur_station_example.py referenced in README)
Station orchestration layer (ur_station.py, station loader)
3) Device abstraction / driver layer (ur.py, robotiq_gripper.py, orbbec_camera_ros2.py)
What to put
• a Container/Context view (what processes exist and what they connect to), and
• a Component view (how the Python package is internally organized).
External actors / systems
• User application (e.g., rl_envs/base_env.py, HIL-RL, scripts like ur_station_example.py)
• UR Controller (physical UR5 controller; network endpoint)
• Robotiq Gripper hardware (attached to UR tool or separate controller)
• Orbbec Camera hardware
• ROS2 runtime (daemon + nodes; camera drivers typically run as ROS2 nodes)
XROCS runtime (your Python process)
Inside the “XROCS Python Process” boundary, include:
• Config subsystem
• configuration.toml
• core/config_loader.py
• Station factory / loader
• core/station_loader.py
• Station abstraction
• ur_station.py (represents “the whole lab station”: robot + camera + gripper)
• Robot interface
• ur.py
• Gripper interface
• robotiq_gripper.py
• optionally rg_driver_opt.py (as an alternate/optional implementation)
• Camera interface
• orbbec_camera_ros2.py
• camera_utils.py
• ROS2 node orchestration
• ros2_node_manager.py
• Timing
• Rate.py (control loop timing; show as used by station/robot loops)
URStation → delegates
• motion commands to UR driver (ur.py)
• gripper commands to Robotiq driver (robotiq_gripper.py)
• camera start/stop/stream calls to Orbbec ROS2 adapter (orbbec_camera_ros2.py)
3. Orbbec ROS2 adapter → uses ROS2NodeManager (ros2_node_manager.py) to launch/monitor ROS2 camera nodes
5. Gripper driver → communicates to the gripper (either “via UR tool interface” or “direct”; if uncertain, show as “Gripper link (UR tool / fieldbus / network)”)
Configuration path
• configuration.toml → core/config_loader.py → core/station_loader.py → constructs URStation, UR, OrbbecCameraROS2, RobotiqGripper with correct endpoints/topics/params.
Architectural patterns to call out (explicitly annotate
• Facade / Unified Interface: ur_station.py is the single entry point that unifies robot + camera + gripper.
• Adapter pattern: orbbec_camera_ros2.py adapts ROS2 camera nodes/topics into a Python-friendly camera API.
• Factory/Dependency Injection: core/station_loader.py builds the station from config (swap hardware without changing higher-level code).
• Layering: app → station → drivers → external runtimes/hardware.
Runtime/Deployment View
• [User App / RL Env / Example Script]
→ (calls) [XROCS: URStation]
→ [UR Driver (ur.py)] → (TCP/IP) → [UR Controller] → [UR5 Arm]
→ [Robotiq Driver (robotiq_gripper.py)] → (tool IO / link) → [Robotiq Gripper]
→ [Orbbec Adapter (orbbec_camera_ros2.py)]
→ [ROS2NodeManager (ros2_node_manager.py)] → (spawn/manage) → [ROS2 Orbbec Camera Node(s)]
← (ROS2 topics) ← [ROS2 Orbbec Camera Node(s)] ← (USB) ← [Orbbec Camera HW]
→ [camera_utils.py] → (frames) → back to [User App]
• [configuration.toml] → [config_loader] → [station_loader] → builds [URStation]
• [Rate.py] used by [URStation] and/or [User App] for loop timing
That is already “detailed and essential” for this project.