How nvlabs/industreallib works
1. What this repository is
IndustRealLib is a Python deployment library for running a subset of IndustReal’s real-robot assembly policies on a Franka Panda. It is not a training monolith; the runtime focus is on taking perception outputs and RL policy checkpoints, then driving the robot through Franka-facing control.
2. Top-level execution boundary
The main runtime starts from two CLI entry points in scripts/: run_task.py for a single task instance and run_sequence.py for a multi-task sequence instance. run_simple_action.py is a small control-test harness for direct robot actions such as homing, gripper open/close, and pose moves.
3. External systems and hardware
The architecture depends on a Franka robot controlled through frankapy and franka-interface, plus an Intel RealSense D400 camera mounted on the robot. Isaac Gym is used offline to train the shipped RL policies, but at runtime the repo consumes pretrained checkpoints rather than simulating. AprilTags are part of the perception/calibration loop.
4. Package-level subsystem split
Under src/industreallib/, the code is divided into four main runtime subsystems: control, perception, rl, and tasks, with sequences layered on top of tasks. This is the key architectural boundary: perception finds targets, RL decides motion, control sends robot commands, and task/sequence classes glue those pieces together.
5. Control subsystem
control/scripts/control_utils.py contains thin wrappers around Franka motion and gripper operations. These are the low-level actions used by run_simple_action.py and by task classes before/after a policy-driven motion, such as going home, moving upward, or opening/closing the gripper.
6. Perception subsystem
perception/ contains the camera-to-world calibration and object localization pipeline. The runtime flow starts with extrinsics from JSON, then workspace mapping using an AprilTag reference, then object detection using checkpoints such as industreal_detector_pegs.pt, ..._gears.pt, and ..._connectors.pt. The outputs are stored as object detections and workspace mappings in the local io/ files.
7. Perception configuration and calibration data
perception/configs/perception.yaml selects scene-specific settings, checkpoint choice, and mapping behavior. The perception/scripts/ tools are operational utilities rather than always-on services: calibrate_extrinsics.py calibrates camera pose, map_workspace.py builds the image-to-world mapping, and detect_objects.py performs inference. The repo ships the calibration and mapping artifacts as JSON files under perception/io/.
8. RL policy subsystem
rl/checkpoints/ stores pretrained policies, each as a checkpoint directory with a config.yaml and a .pth network file. These policies are organized by skill, such as reach, pick, place, and insert, plus a generic policy. At runtime, task classes load these checkpoints and generate actions from the current observation vector.
9. Task subsystem
tasks/classes/ defines the core execution model. IndustRealTaskBase provides common behavior: load policy, get observations, turn policy actions into pose targets, and execute pre/post-goal procedures. The concrete subclasses IndustRealTaskReach, ...Pick, ...Place, and ...Insert specialize only the task-specific observation logic and task behavior.
10. Task instance configurations
tasks/instance_configs/ contains YAML descriptions of concrete task setups, such as pick_pegs.yaml, insert_gears.yaml, and reach.yaml. These configs bind a generic task class to a specific object type, policy choice, control parameters, and scene assumptions. They are the primary mechanism for varying behavior without changing code.
11. Sequence subsystem
sequences/classes/industreal_sequence_base.py provides orchestration for chaining tasks in a fixed order. Sequence instance configs in sequences/instance_configs/ specify which task instances to run and which objects each task should act on. In effect, sequences are a higher-level scheduler over task instances, not a separate control stack.
12. Data flow from camera to robot
The typical runtime path is: camera and calibration data are read, AprilTag-based workspace mapping converts image coordinates to robot-frame goals, object detection identifies target parts, the task instance converts those goals into task observations, the RL policy produces actions, and control utilities send the resulting pose/gripper commands to Franka. This flow is repeated once per object or per stage in a sequence.
13. Operational artifacts and persistence
The repo includes shipped artifacts needed for deployment: detector checkpoints, RL policy checkpoints, extrinsics calibration files, workspace mapping files, and task/sequence YAMLs. These assets define the runtime environment as much as the code does, so an architecture diagram should show them as configuration and model inputs feeding the live pipeline.
14. Training code is auxiliary
The perception/scripts/training/ directory contains Mask R-CNN-style training utilities for object detection. This code is useful for reproducing or updating perception models, but it is not in the main deployment loop. The live system consumes the trained checkpoint artifacts produced from this area.
15. Main architectural boundary to draw
The cleanest diagram boundary is between the physical robot/camera world and the Python deployment stack. Inside the stack, show three layers: perception produces goals, tasks/policies produce skill-level motion, and control executes robot commands. Above them, run_task.py and run_sequence.py select instances through YAML configs, while run_simple_action.py bypasses perception and RL for direct robot tests.
Main entry points: industreal_task_base.py task base · detect_objects.py object detect · calibrate_extrinsics.py calibration · control_utils.py control utils
Components 21
Runtime entrypoints
CLI entry points that start deployment or direct robot actions.
- run task · Starts a single task instance from YAML configuration.
scripts/run_task.py - run sequence · Starts a multi-task sequence from sequence configuration.
scripts/run_sequence.py - simple action · Bypasses perception and RL for direct robot control tests.
scripts/run_simple_action.py
Deployment stack
Core Python subsystems for perception, tasks, sequences, and control.
- control utils · Thin wrappers for homing, gripper, and pose commands.
src/industreallib/control/scripts/control_utils.py - calibration · Extrinsics calibration and workspace mapping around AprilTag reference data.
src/industreallib/perception/scripts/calibrate_extrinsics.py - object detect · Runs detector inference to localize target parts in the scene.
src/industreallib/perception/scripts/detect_objects.py - task base · Loads policies, builds observations, converts actions to robot targets, and handles task lifecycle.
src/industreallib/tasks/classes/industreal_task_base.py - task variants · Reach, pick, place, and insert task classes that define task-specific observation and behavior.
src/industreallib/tasks/classes - sequence base · Orchestrates fixed-order execution of multiple task instances.
src/industreallib/sequences/classes/industreal_sequence_base.py - sequence utils · Utilities supporting sequence setup and execution.
src/industreallib/sequences/scripts/sequence_utils.py
Operational assets
Shipped checkpoints, calibration files, and instance configs used at runtime.
- perception cfg · Selects perception scene behavior, checkpoints, and mapping options.
src/industreallib/perception/configs/perception.yaml - detectors · Pretrained object detectors for pegs, gears, and connectors.
src/industreallib/perception/checkpoints - perception I/O · Saved extrinsics, workspace mapping, detections, and camera parameters.
src/industreallib/perception/io - task configs · Concrete task setups binding task class, object type, policy, and control parameters.
src/industreallib/tasks/instance_configs - policy checkpoints · Pretrained skill policies with config and network weights for reach, pick, place, insert, and generic use.
src/industreallib/rl/checkpoints - sequence configs · Defines which task instances run and which objects each stage targets.
src/industreallib/sequences/instance_configs - training tools · Offline perception training utilities used to produce detector checkpoints, not part of the live deployment loop.
src/industreallib/perception/scripts/training
Physical systems
Robot, camera, and external libraries that the stack drives or depends on.
- Franka Panda · Real robot arm and gripper driven by the deployment stack.
- RealSense D400 · Mounted camera providing runtime visual observations.
- Franka libs · External Franka control libraries used to send motions and gripper actions.
- AprilTags · Reference markers used in calibration and workspace mapping.
Connections 24
- run task → task base: loads · Task CLI instantiates a task from configuration.
- run sequence → sequence base: loads · Sequence CLI instantiates the sequence orchestrator.
- simple action → control utils: calls · Direct action harness invokes low-level control wrappers.
- sequence base → task base: runs · Sequences coordinate task instances in order.
- sequence base → sequence configs: reads · Sequence orchestration is driven by sequence YAMLs.
- sequence utils → sequence base: supports · Helpers assist sequence setup and execution.
- task base → task variants: specializes · Concrete task classes extend the task base.
- task base → policy checkpoints: loads · Tasks load pretrained policies for skill execution.
- task base → control utils: executes · Task actions are converted to robot commands through control utilities.
- task base → task configs: configured by · Task instances are selected and parameterized by YAML.
- task base → object detect: consumes · Task observations depend on detected object targets.
- task base → perception I/O: consumes · Tasks use calibration and mapping artifacts.
- object detect → detectors: uses · Inference runs on shipped detector weights.
- object detect → perception cfg: reads · Detection behavior is selected by perception configuration.
- calibration → AprilTags: references · Workspace mapping relies on AprilTag calibration reference.
- calibration → RealSense D400: calibrates · Calibration aligns camera pose to the robot/world frame.
- calibration → perception I/O: writes · Calibration and mapping artifacts are stored in local IO files.
- object detect → perception I/O: writes · Object detections are persisted for downstream task use.
- control utils → Franka libs: depends on · Control wrappers sit on top of Franka middleware.
- control utils → Franka Panda: drives · Commands are issued to the real robot and gripper.
- run task → object detect: invokes · Single-task execution starts the perception pipeline.
- run task → calibration: invokes · Task runs rely on calibrated workspace mapping.
- run sequence → object detect: invokes · Sequence stages consume perception outputs as needed.
- training tools → detectors: produces · Offline training utilities generate the detector artifacts.