How devvirani13/generate-real-time-trajectories-for-a-single-handed-robotic-arm-for-different-tasks works
Main Components
• Environment Modules:
• sim_env.py – Implements simulation environments with joint space control (using Mujoco + DM_Control)
• ee_sim_env.py – Implements simulation environments with end-effector (EE) space control
• Policy and Model Components:
• policy.py – Serves as the adapter for the ACT policy
• scripted_policy.py – Contains scripted control logic for simulated environments (often used as baseline or for generating scripted episodes)
• (Potentially a ‘detr’ directory, as mentioned in the README, holding modified ACT models based on DETR)
• Training and Evaluation Modules:
• imitate_episodes.py – Script for training and evaluating the ACT policy (which likely runs episodes in simulation)
• record_sim_episodes.py – Used to record episodes (data collection in the simulation environment)
• visualize_episodes.py – Takes recorded data (stored in .hdf5) and converts it into visual media (videos), facilitating analysis
• Shared Utilities:
• constants.py – Shared constants across all modules, ensuring consistency of parameters and configuration
• utils.py – Contains helper functions and data loading capabilities which support all of the above components
Relationships and Interactions
• The simulation environments (sim_env.py and ee_sim_env.py) are central to both training and data collection, interfacing with the policy components.
• Policy components (policy.py and scripted_policy.py) interact with the environments to generate trajectories. They can be swapped or compared (ACT vs. scripted).
• imitate_episodes.py ties together the training, evaluation, and interaction between the policy and simulation environment. It is at the core of the training loop.
• record_sim_episodes.py and visualize_episodes.py handle the generation of test cases and the post hoc visualization and debugging of generated episodes.
• The constants and utils modules provide uniform support across all these components such that changes in configuration or data handling propagate consistently.
Architectural Patterns and Design Principles
• Modularity: Each file represents distinct functionality (simulation, policy, training, visualization), which allows for easy testing and replacement of components.
• Separation of Concerns: The system clearly separates simulation (environment generation and testing), policy logic (learning and scripted behavior), training/evaluation workflows, and auxiliary functionalities (constants and helper functions).
• Extensibility: With dedicated modules for environment types and clear adapter patterns in the policy, the system is built to support further extensions, whether to real-world trials or additional simulation modes.
• Use of Frameworks: The project relies on frameworks like Mujoco, DM_Control, PyTorch (and torchvision), and even DETR adaptations, as indicated by installation requirements and README instructions.
Technologies, Frameworks, and Libraries
• Python 3.8.10, PyTorch, torchvision for deep learning
• Mujoco and DM_Control for physics-based simulation environments
• OpenCV, matplotlib for visualization
• Other utilities (pyyaml, pyyaml, packaging, etc.) that support environment setup and configuration