Implementation:ARISE Initiative Robosuite TwoArmEnv Base
| Knowledge Sources | |
|---|---|
| Domains | Robotics, Simulation, Manipulation |
| Last Updated | 2026-02-15 07:00 GMT |
Overview
Concrete tool for providing the base class for all two-arm manipulation environments in robosuite.
Description
The TwoArmEnv class is an abstract base class that extends ManipulationEnv to provide shared infrastructure for all two-arm (bimanual) manipulation tasks in robosuite. It handles robot configuration validation, gripper-to-target distance computation for both arms, and end-effector state properties. This class is the parent of TwoArmHandover, TwoArmLift, TwoArmPegInHole, and TwoArmTransport.
The class supports three robot configurations: a single bimanual robot (automatically set to "single-robot" configuration), two robots in "opposed" configuration (facing each other across the table), or two robots in "parallel" configuration (side by side). The _check_robot_configuration method validates that either exactly one bimanual robot or exactly two robots of any type are provided. It also maintains backward compatibility by mapping old configuration names ("single-arm-opposed", "single-arm-parallel") to the new names ("opposed", "parallel").
Key helper methods include _gripper0_to_target and _gripper1_to_target, which compute the distance or distance vector between each arm's gripper and a specified target (body, geom, or site). In single-robot mode, gripper0 maps to the right arm and gripper1 maps to the left arm. In two-robot mode, gripper0 maps to the first robot and gripper1 to the second. Properties _eef0_xpos, _eef1_xpos, _eef0_xmat, and _eef0_xquat provide convenient access to each arm's end-effector position and orientation.
Usage
This class should not be instantiated directly. Instead, use one of its concrete subclasses (TwoArmHandover, TwoArmLift, TwoArmPegInHole, TwoArmTransport) that define specific bimanual tasks. Subclass from TwoArmEnv when creating new two-arm manipulation environments to inherit robot configuration validation and gripper utility methods.
Code Reference
Source Location
- Repository: ARISE_Initiative_Robosuite
- File: robosuite/environments/manipulation/two_arm_env.py
- Lines: 1-147
Signature
class TwoArmEnv(ManipulationEnv):
"""A manipulation environment intended for two robot arms."""
_PREV_CONFIG_TO_NEW_CONFIG = {
"single-arm-opposed": "opposed",
"single-arm-parallel": "parallel",
}
def _check_robot_configuration(self, robots):
...
def _gripper0_to_target(self, target, target_type="body", return_distance=False):
...
def _gripper1_to_target(self, target, target_type="body", return_distance=False):
...
@property
def _eef0_xpos(self):
...
@property
def _eef1_xpos(self):
...
@property
def _eef0_xmat(self):
...
@property
def _eef0_xquat(self):
...
Import
from robosuite.environments.manipulation.two_arm_env import TwoArmEnv
I/O Contract
Inputs
| Name | Type | Required | Description |
|---|---|---|---|
| robots | str or list of str | Yes | Either 1 bimanual robot or 2 robots of any type |
| env_configuration | str | No | "opposed", "parallel", or "default" (auto-selects "opposed" for 2 robots). Legacy names "single-arm-opposed" and "single-arm-parallel" are also accepted. |
Outputs
| Name | Type | Description |
|---|---|---|
| _eef0_xpos | np.array (3,) | Position of Robot 0's right end-effector (or first robot's EEF in two-robot mode) |
| _eef1_xpos | np.array (3,) | Position of Robot 1's end-effector (left arm for bimanual; second robot's right arm for two-robot mode) |
| _eef0_xmat | np.array (3,3) | Rotation matrix of EEF0 |
| _eef0_xquat | np.array (4,) | Quaternion (xyzw) of EEF0 |
Usage Examples
# TwoArmEnv is an abstract base class and should not be instantiated directly.
# Instead, use one of its concrete subclasses:
import robosuite as suite
# Using TwoArmLift (a TwoArmEnv subclass) with two separate robots
env = suite.make(
env_name="TwoArmLift",
robots=["Panda", "Panda"],
env_configuration="opposed",
has_renderer=False,
has_offscreen_renderer=False,
use_camera_obs=False,
)
# Using TwoArmHandover with a single bimanual robot
env_bimanual = suite.make(
env_name="TwoArmHandover",
robots="IIWA", # bimanual robot
has_renderer=False,
has_offscreen_renderer=False,
use_camera_obs=False,
)