### Test robosuite Installation (Source) Source: https://robosuite.ai/docs/_sources/installation Executes a sample demonstration script to verify the robosuite installation when installed from source. This ensures all dependencies and the library itself are working. ```sh python robosuite/demos/demo_random_action.py ``` -------------------------------- ### Test robosuite Installation (Pip) Source: https://robosuite.ai/docs/_sources/installation Executes a sample demonstration script to verify that robosuite has been installed correctly and is functional. This command should be run after installing via pip. ```sh python -m robosuite.demos.demo_random_action ``` -------------------------------- ### Install robosuite Base Requirements from Source Source: https://robosuite.ai/docs/_sources/installation Installs the core dependencies for robosuite from a requirements file after cloning the repository. This also installs the library in an editable format. ```sh pip3 install -r requirements.txt ``` -------------------------------- ### Install robosuite from Pip Source: https://robosuite.ai/docs/_sources/installation Installs the robosuite library using pip. Assumes prerequisites like MuJoCo are already set up. This is the recommended method for most users. ```sh pip install robosuite ``` -------------------------------- ### Install MuJoCo Source: https://robosuite.ai/docs/installation Installs the MuJoCo package using pip. This is a prerequisite for robosuite and may be needed if the package is not found. ```bash pip install mujoco ``` -------------------------------- ### Clone robosuite Repository Source: https://robosuite.ai/docs/_sources/installation Clones the robosuite project from its GitHub repository. This is the first step for installing from source and allows for local modifications. ```sh git clone https://github.com/ARISE-Initiative/robosuite.git cd robosuite ``` -------------------------------- ### Install robosuite Extra Dependencies from Source Source: https://robosuite.ai/docs/_sources/installation Installs optional add-on functionalities for robosuite, such as OpenAI Gym interfaces, inverse kinematics controllers, and teleoperation support. This requires an extra requirements file. ```sh pip3 install -r requirements-extra.txt ``` -------------------------------- ### Create Virtual Environment Source: https://robosuite.ai/docs/installation Commands to create and activate a Python virtual environment for robosuite installation. This helps in isolating project dependencies. ```bash virtualenv -p python3 . && source bin/activate ``` -------------------------------- ### Find MuJoCo Package Path Source: https://robosuite.ai/docs/_sources/installation A Python snippet to help users locate the installation path of the MuJoCo package. This is useful for troubleshooting when the 'mujoco.dll not found' error occurs on Windows. ```python import mujoco print(mujoco.__path__) ``` -------------------------------- ### Run Single-Arm Environment Example Source: https://robosuite.ai/docs/_sources/demos Example command to run a single-arm robot environment, specifically the 'PickPlaceCan' task with a 'Sawyer' robot. ```bash $ python demo_device_control.py --environment PickPlaceCan --robots Sawyer ``` -------------------------------- ### Starting Gripper Tester Simulation Source: https://robosuite.ai/docs/genindex Starts the simulation specifically for the GripperTester, likely to evaluate gripper performance or test gripper behaviors. ```python from robosuite.models.grippers.gripper_tester import GripperTester # Instantiate GripperTester and start simulation gripper_tester = GripperTester() gripper_tester.start_simulation() ``` -------------------------------- ### Create Conda Environment Source: https://robosuite.ai/docs/installation Commands to create and activate a Conda environment with a specific Python version for robosuite. Conda is a popular package and environment management system. ```bash conda create -n robosuite python=3.10 ``` -------------------------------- ### Mac specific Python command Source: https://robosuite.ai/docs/installation On macOS, the 'python' command needs to be prepended with 'mj' when using the default mjviewer renderer. ```bash mjpython ... ``` -------------------------------- ### Setup References (Python) Source: https://robosuite.ai/docs/source/robosuite Sets up necessary references for robots, bases, grippers, and objects. This should be called during every reset from the environment. ```python setup_references()# ``` -------------------------------- ### Install USD Exporter Dependencies Source: https://robosuite.ai/docs/demos Installs the required Python packages for exporting RoboSuite trajectories to USD format. These dependencies enable rendering in external applications. ```bash $ pip install usd-core pillow tqdm ``` -------------------------------- ### Setup Observables (Python) Source: https://robosuite.ai/docs/source/robosuite Sets up observables for the robot. This method returns a dictionary mapping observable names to their corresponding Observable objects. ```python setup_observables()# ``` -------------------------------- ### Install USD Exporter Dependencies Source: https://robosuite.ai/docs/_sources/demos Installs the necessary Python packages for exporting RoboSuite trajectories to the USD format. These dependencies include 'usd-core', 'pillow', and 'tqdm'. ```shell pip install usd-core pillow tqdm ``` -------------------------------- ### TwoArmPegInHole Environment Setup Source: https://robosuite.ai/docs/source/robosuite.environments This snippet outlines the constructor for the TwoArmPegInHole environment, detailing its numerous parameters for setting up a two-arm manipulation task. ```APIDOC ## Class robosuite.environments.manipulation.two_arm_peg_in_hole.TwoArmPegInHole ### Description This class corresponds to the peg-in-hole task for two robot arms. ### Method __init__ ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body - **robots** (str or list of str) - Required - Specification for specific robot(s) Note: Must be either 2 robots or 1 bimanual robot! - **env_configuration** (str) - Optional - Specifies how to position the robots within the environment if two robots inputted. Can be either: 'parallel' or 'opposed'. - **controller_configs** (str or list of dict) - Optional - If set, contains relevant controller parameters for creating a custom controller. Else, uses the default controller for this specific task. - **gripper_types** (str or list of str) - Optional - type of gripper, used to instantiate gripper models from gripper factory. For this environment, setting a value other than the default (None) will raise an AssertionError. - **initialization_noise** (dict or list of dict) - Optional - Dict containing the initialization noise parameters. Expected keys: 'magnitude' (float or None) and 'type' (str: 'gaussian' or 'uniform'). - **use_camera_obs** (bool or list of bool) - Optional - If True, every observation for a specific robot includes a rendered image. - **use_object_obs** (bool) - Optional - If True, include object (peg) information in the observation. - **reward_scale** (None or float) - Optional - Scales the normalized reward function by the amount specified. - **reward_shaping** (bool) - Optional - If True, use dense rewards. - **peg_radius** (2-tuple) - Optional - Low and high limits of the (uniformly sampled) radius of the peg. - **peg_length** (float) - Optional - Length of the peg. - **has_renderer** (bool) - Optional - If true, render the simulation state in a viewer instead of headless mode. - **has_offscreen_renderer** (bool) - Optional - True if using off-screen rendering. - **render_camera** (str) - Optional - Name of camera to render if has_renderer is True. - **render_collision_mesh** (bool) - Optional - True if rendering collision meshes in camera. False otherwise. - **render_visual_mesh** (bool) - Optional - True if rendering visual meshes in camera. False otherwise. - **render_gpu_device_id** (int) - Optional - Corresponds to the GPU device id to use for offscreen rendering. - **control_freq** (float) - Optional - How many control signals to receive in every second. - **lite_physics** (bool) - Optional - Whether to use lite physics. - **horizon** (int) - Optional - The horizon for the environment. - **ignore_done** (bool) - Optional - Whether to ignore the done condition. - **hard_reset** (bool) - Optional - Whether to perform a hard reset. - **camera_names** (str or list of str) - Optional - Names of the cameras to use. - **camera_heights** (int or list of int) - Optional - Heights of the cameras. - **camera_widths** (int or list of int) - Optional - Widths of the cameras. - **camera_depths** (bool or list of bool) - Optional - Whether to use camera depths. - **camera_segmentations** (str or list of str) - Optional - Segmentations for the cameras. - **renderer** (str) - Optional - The renderer to use. - **renderer_config** (dict) - Optional - Configuration for the renderer. - **seed** (int) - Optional - Seed for the random number generator. ### Request Example ```json { "robots": "sawyer", "env_configuration": "parallel", "controller_configs": null, "gripper_types": null, "initialization_noise": {"magnitude": 0.0, "type": "gaussian"}, "use_camera_obs": true, "use_object_obs": true, "reward_scale": 1.0, "reward_shaping": false, "peg_radius": [0.015, 0.03], "peg_length": 0.13, "has_renderer": false, "has_offscreen_renderer": true, "render_camera": "frontview", "render_collision_mesh": false, "render_visual_mesh": true, "render_gpu_device_id": -1, "control_freq": 20, "lite_physics": true, "horizon": 1000, "ignore_done": false, "hard_reset": true, "camera_names": "agentview", "camera_heights": 256, "camera_widths": 256, "camera_depths": false, "camera_segmentations": null, "renderer": "mjviewer", "renderer_config": null, "seed": null } ``` ### Response #### Success Response (200) (No specific response details provided for the constructor itself, as it initializes the environment state.) #### Response Example N/A (Constructor does not return a value, it sets up the environment object.) ``` -------------------------------- ### Run Two-Arm Multi-Robot Environment Example Source: https://robosuite.ai/docs/_sources/demos Example command for a two-arm environment involving multiple single-arm robots, specifying their configuration ('parallel' or 'opposed'). This example uses two 'Sawyer' robots in a parallel configuration for 'TwoArmLift'. ```bash $ python demo_device_control.py --environment TwoArmLift --robots Sawyer Sawyer --config parallel ``` -------------------------------- ### Setup References (Python) Source: https://robosuite.ai/docs/simulation/robot Sets up references for the robot, grippers, and associated objects. This function should be called during every environment reset. ```python def setup_references(): # Sets up necessary reference for robots, grippers, and objects. # Note that this should get called during every reset from the environment ... ``` -------------------------------- ### RoboSuite Environment Policy Loop Example Source: https://robosuite.ai/docs/modules/environments This Python code demonstrates a basic policy loop for interacting with a RoboSuite environment. It shows how to reset the environment, generate a random action based on the action specification, take a step in the environment, and accumulate rewards. This serves as a fundamental example for agent rollouts. ```python import numpy as np def get_policy_action(obs): # a trained policy could be used here, but we choose a random action low, high = env.action_spec return np.random.uniform(low, high) # reset the environment to prepare for a rolloutobs = env.reset() done = False ret = 0. while not done: action = get_policy_action(obs) # use observation to decide on an action obs, reward, done, _ = env.step(action) # play action ret += reward print("rollout completed with return {}".format(ret)) ``` -------------------------------- ### Mink Controller Example Usage Source: https://robosuite.ai/docs/_sources/changelog Provides an example of how to use the Mink controller, a composite controller within the Robosuite framework. This demonstrates the refactoring for composite controller usage. ```python please see example of [usage](https://github.com/ARISE-Initiative/robosuite/blob/29e73bd41f9bc43ba88bb7d2573b868398905819/robosuite/examples/third_party_controller/mink_controller.py#L421) ``` -------------------------------- ### Setup Robot References Source: https://robosuite.ai/docs/simulation/robot Sets up necessary references for robots, bases, grippers, and objects. This is crucial for internal object management within the simulation. ```python def setup_references(self): """Sets up necessary reference for robots, bases, grippers, and objects.""" pass ``` -------------------------------- ### Setup Observables (Python) Source: https://robosuite.ai/docs/simulation/robot Configures and returns a dictionary of observables for the robot, mapping names to their corresponding Observable objects. ```python def setup_observables(): # Sets up observables to be used for this robot # Returns: Dictionary mapping observable names to its corresponding Observable object # Return type: OrderedDict ... ``` -------------------------------- ### Setup References for Robot Components Source: https://robosuite.ai/docs/simulation/robot Configures essential references for the robot, its grippers, and any associated objects. This method should be called during each environment reset. ```python setup_references() ``` -------------------------------- ### Starting Device Control Source: https://robosuite.ai/docs/genindex Initiates control for various device types, such as the generic Device, DualSense controller, and MJGUI. This is essential for enabling real-time interaction with the simulation. ```python device.start_control() dual_sense.start_control() mujoco_gui.start_control() ``` -------------------------------- ### Get MuJoCo Model Source: https://robosuite.ai/docs/tutorials/add_environment Generates a MuJoCo simulation model from the constructed world. This model can then be used to initialize simulation data. ```python model = world.get_model(mode="mujoco") ``` -------------------------------- ### Setup Robot Observables Source: https://robosuite.ai/docs/simulation/robot Sets up observables to be used for this robot. Returns a dictionary mapping observable names to their corresponding Observable objects. ```python def setup_observables(self): """Sets up observables to be used for this robot.""" pass ``` -------------------------------- ### Demonstrate robosuite Environment Configuration (Python) Source: https://robosuite.ai/docs/_sources/demos This script highlights the modular design of robosuite's simulated environments. Users can configure environments by selecting environments, robots, and controllers from the command line. It supports all defined environments, robots, and controllers via suite.ALL_ENVIRONMENTS, suite.ALL_ROBOTS, and suite.ALL_PART_CONTROLLERS respectively. ```python import robosuite as suite # Example of accessing supported components all_environments = suite.ALL_ENVIRONMENTS all_robots = suite.ALL_ROBOTS all_controllers = suite.ALL_PART_CONTROLLERS all_grippers = suite.ALL_GRIPPERS # The demo_random_action.py script itself would instantiate and run an environment. # Example instantiation (not the full script): # env = suite.make("PickPlace", robot="Sawyer", controller_type="OSC_POSE", # gripper="RethinkGripper", # has_renderer=True, # render_ tốc_độ=1) # Render speed is in seconds per frame # env.reset() # env.step(env.action_space.sample()) ``` -------------------------------- ### Modify EGL Binding on Windows Source: https://robosuite.ai/docs/_sources/installation A Python code snippet modification to resolve EGL issues on Windows. It involves changing the environment variable for MuJoCo's OpenGL binding from 'egl' to 'wgl'. ```python if _SYSTEM == "Darwin": os.environ["MUJOCO_GL"] = "cgl" else: os.environ["MUJOCO_GL"] = "wgl" ``` -------------------------------- ### Object Placement Example Source: https://robosuite.ai/docs/_sources/modules/objects Demonstrates how to use the offset methods of a MujocoObject to calculate and set the position of an object relative to another surface, like placing an object on a table. ```python table_top = np.array([0, 1, 0]) bottom_offset = obj.get_bottom_offset() pos = table_top - bottom_offset # pos + bottom_offset = table_top obj_xml = obj.get_obj().set("pos", array_to_string(pos)) # Set the top-level body of this object ``` -------------------------------- ### Run Standardized RoboSuite Environment Source: https://robosuite.ai/docs/_sources/basicusage Demonstrates how to instantiate and interact with a standardized RoboSuite environment. This example shows environment creation, taking random actions, and rendering the simulation. It's useful for benchmarking and qualitative evaluation. ```python import numpy as np import robosuite as suite # create environment instance env = suite.make( env_name="Lift", # try with other tasks like "Stack" and "Door" robots="Panda", # try with other robots like "Sawyer" and "Jaco" has_renderer=True, has_offscreen_renderer=False, use_camera_obs=False, ) # reset the environment env.reset() for i in range(1000): action = np.random.randn(*env.action_spec[0].shape) * 0.1 obs, reward, done, info = env.step(action) # take action in the environment env.render() # render on display ``` -------------------------------- ### Running Human Demonstrations with Mujoco GUI Device Source: https://robosuite.ai/docs/_sources/modules/devices Example command to run a script for collecting human demonstrations using the Mujoco GUI device. This command specifies the environment, robot, device, camera, and controller. It also includes a note for Mac users to use 'mjpython'. ```shell mjpython robosuite/scripts/collect_human_demonstrations.py --environment Lift --robots Panda --device mjgui --camera frontview --controller WHOLE_BODY_IK ``` -------------------------------- ### Run RoboSuite Renderer Demo Source: https://robosuite.ai/docs/_sources/demos This command demonstrates how to run the RoboSuite renderer demo script, specifying the default renderer. It's a basic example for showcasing rendering capabilities. ```shell python demo_renderers.py --renderer default ``` -------------------------------- ### MobileRobot Reset and Setup Source: https://robosuite.ai/docs/source/robosuite Provides methods for resetting the robot's pose and setting up its observables and references. The reset method can randomize initializations or use a deterministic pose. ```python class MobileRobot(_robot_type : str_, _idn =0_, _composite_controller_config =None_, _initial_qpos =None_, _initialization_noise =None_, _base_type ='default'_, _gripper_type ='default'_, _control_freq =20_, _lite_physics =True_): ... def reset(self, _deterministic =False_, _rng =None_): """Sets initial pose of arm and grippers. Overrides gripper joint configuration if we’re using a deterministic reset (e.g.: hard reset from xml file) Parameters: deterministic (_bool_): If true, will not randomize initializations within the sim """ ... def setup_observables(self): """Sets up observables to be used for this robot Returns: Dictionary mapping observable names to its corresponding Observable object Return type: OrderedDict """ ... def setup_references(self): """Sets up necessary reference for robots, grippers, and objects. Note that this should get called during every reset from the environment """ ... ``` -------------------------------- ### Robosuite Visualization Method Source: https://robosuite.ai/docs/source/robosuite.environments This method visualizes gripper site proportional to the distance to the door handle. It takes a dictionary of visualization settings as input, specifying which components should be visualized, including 'grippers' and other relevant options. ```python def visualize(vis_settings): """ In addition to super call, visualize gripper site proportional to the distance to the door handle. Parameters: vis_settings (_dict_): Visualization keywords mapped to T/F, determining whether that specific component should be visualized. Should have “grippers” keyword as well as any other relevant options specified. """ pass ``` -------------------------------- ### Run Two-Arm Bimanual Environment Example Source: https://robosuite.ai/docs/_sources/demos Example command to run a two-arm bimanual environment, such as 'TwoArmLift', using a single type of robot (e.g., 'Tiago'). ```bash $ python demo_device_control.py --environment TwoArmLift --robots Tiago ``` -------------------------------- ### Get Controller Name Source: https://robosuite.ai/docs/simulation/controller Retrieves the name of the controller instance. ```python controller_name = controller.name ``` -------------------------------- ### Get Default Mount Source: https://robosuite.ai/docs/source/robosuite.models.robots Placeholder property for default mount information. ```python @property def default_mount(self): pass ``` -------------------------------- ### RoboSuite Visualization Source: https://robosuite.ai/docs/source/robosuite.environments Visualizes the gripper site in proportion to its distance from the cube. Requires visualization settings to be passed as a dictionary. ```Python def visualize(vis_settings: dict): """ In addition to super call, visualize gripper site proportional to the distance to the cube. Parameters: vis_settings (dict): Visualization keywords mapped to T/F, determining whether that specific component should be visualized. Should have “grippers” keyword as well as any other relevant options specified. """ # Visualization logic would go here pass ``` -------------------------------- ### Initialize SequentialCompositeSampler with UniformRandomSamplers Source: https://robosuite.ai/docs/_sources/modules/objects Demonstrates initializing a SequentialCompositeSampler to manage multiple placement samplers. This example sets up individual UniformRandomSamplers for different nut objects, defining their specific placement ranges and offsets relative to a table surface. ```python # Establish named references to each nut object nut_names = ("SquareNut", "RoundNut") # Initialize the top-level sampler self.placement_initializer = SequentialCompositeSampler(name="ObjectSampler") # Create individual samplers per nut for nut_name, default_y_range in zip(nut_names, ([0.11, 0.225], [-0.225, -0.11])): self.placement_initializer.append_sampler( sampler=UniformRandomSampler( name=f"{nut_name}Sampler", x_range=[-0.115, -0.11], y_range=default_y_range, rotation=None, rotation_axis='z', ensure_object_boundary_in_range=False, ensure_valid_placement=True, reference_pos=self.table_offset, z_offset=0.02, ) ) ``` -------------------------------- ### Get Initial Joint Positions Source: https://robosuite.ai/docs/source/robosuite.models.robots Returns the default rest joint positions (qpos) for the robot. ```python @property def init_qpos(self): """Defines the default rest qpos of this robot """ pass ``` -------------------------------- ### Get Action Limits (NumPy) Source: https://robosuite.ai/docs/simulation/robot Retrieves the action limits for the robot. ```Python robot._action_limits ``` -------------------------------- ### Playback Demonstrations Script Source: https://robosuite.ai/docs/algorithms/demonstrations This describes the `playback_demonstrations_from_hdf5` script, which loads and replays recorded human demonstrations from an HDF5 file. It randomly selects episodes for playback. ```bash python playback_demonstrations_from_hdf5.py ``` -------------------------------- ### Get Joint Torque Controller Name Source: https://robosuite.ai/docs/simulation/controller Retrieves the name of the Joint Torque Controller instance. ```python controller_name = controller.name print(f"Controller Name: {controller_name}") ``` -------------------------------- ### Get Robot Models Source: https://robosuite.ai/docs/source/robosuite.models.robots Returns a list of all sub-models owned by this robot model, including the gripper if specified. ```python @property def models(self): """Returns a list of all m(sub-)models owned by this robot model. By default, this includes the gripper model, if specified """ pass ``` -------------------------------- ### Import and Interact with Grippers and Procedurally Generate Scenes Source: https://robosuite.ai/docs/_sources/demos Demonstrates importing grippers into a scene, making them interact with objects via actuators, and procedurally generating scenes using MJCF utility functions. ```python import robosuite.utils.mjcf_utils # Example would involve scene setup and gripper instantiation: # mjcf_utils.xml_path_completion('path/to/scene.xml') # gripper = robosuite.grippers.get_gripper('gripper_name') # gripper.attach_to_controller(controller) ``` -------------------------------- ### Get Default Gripper Source: https://robosuite.ai/docs/source/robosuite.models.robots Returns the name of the default gripper to be added to the robot's end effector. ```python @property def default_gripper(self): """Defines the default gripper type for this robot that gets added to end effector """ pass ``` -------------------------------- ### Get Robot Arm Type Source: https://robosuite.ai/docs/source/robosuite.models.robots Returns the type of the robot arm, which can be 'bimanual', 'single', or other future types. ```python @property def arm_type(self): """Type of robot arm. Should be either “bimanual” or “single” (or something else if it gets added in the future) """ pass ``` -------------------------------- ### Initialize Mujoco Environment Source: https://robosuite.ai/docs/simulation/environment Initializes the Mujoco environment with various rendering and simulation parameters. Supports toggling renderers, collision meshes, visual meshes, GPU device selection, control frequency, physics optimization, episode horizon, and reset behavior. ```python class _robosuite.environments.base.MujocoEnv(_has_renderer=False, _has_offscreen_renderer=True, _render_camera='frontview', _render_collision_mesh=False, _render_visual_mesh=True, _render_gpu_device_id=-1, _control_freq=20, _lite_physics=True, _horizon=1000, _ignore_done=False, _hard_reset=True, _renderer='mjviewer', _renderer_config=None, _seed=None): ``` -------------------------------- ### Get Part Controllers (Dictionary) Source: https://robosuite.ai/docs/simulation/robot Returns the controller dictionary for the robot's parts. ```Python robot._part_controllers ``` -------------------------------- ### Stack Environment Initialization (Python) Source: https://robosuite.ai/docs/source/robosuite.environments Initializes the Stack environment for a single robot arm. Allows configuration of robot, gripper, base, table properties, observation settings, and rendering. ```python class Stack(_robots_, _env_configuration ='default'_, _controller_configs =None_, _gripper_types ='default'_, _base_types ='default'_, _initialization_noise ='default'_, _table_full_size =(0.8, 0.8, 0.05)_, _table_friction =(1.0, 0.005, 0.0001)_, _use_camera_obs =True_, _use_object_obs =True_, _reward_scale =1.0_, _reward_shaping =False_, _placement_initializer =None_, _has_renderer =False_, _has_offscreen_renderer =True_, _render_camera ='agentview'_, _camera_heights =256_, _camera_widths =256_, _camera_depths =False_, _camera_segmentations =None_, _renderer ='mjviewer'_, _renderer_config =None_, _seed =None_): pass ``` -------------------------------- ### Apply Rendering Options in Simulation Source: https://robosuite.ai/docs/demos Demonstrates how to utilize different rendering options within the simulation environments. Supports 'default' and 'mujoco' renderers. ```python import robosuite # Example usage: # python demo_renderers.py --renderer default # python demo_renderers.py --renderer mujoco ``` -------------------------------- ### Get Gripper Name (String) Source: https://robosuite.ai/docs/simulation/robot Returns the name of the gripper associated with the specified arm. ```Python robot.get_gripper_name(arm='right') ``` -------------------------------- ### Get Controller Name Source: https://robosuite.ai/docs/simulation/controller Returns the name of the controller. This property provides a string identifier for the specific controller instance. ```python _property _name# Name of this controller Returns: controller name Return type: str ``` -------------------------------- ### Environment Configuration Parameters Source: https://robosuite.ai/docs/source/robosuite.environments This section details the parameters used for configuring the robosuite environment, including rendering options, physics settings, and camera configurations. ```APIDOC ## Environment Configuration Parameters ### Description Parameters that can be passed to the robosuite environment for configuration. ### Parameters #### Request Body - **render_collision_mesh** (bool) - True if rendering collision meshes in camera. False otherwise. - **render_visual_mesh** (bool) - True if rendering visual meshes in camera. False otherwise. - **render_gpu_device_id** (int) - Corresponds to the GPU device id to use for offscreen rendering. Defaults to -1, in which case the device will be inferred from environment variables (GPUS or CUDA_VISIBLE_DEVICES). - **control_freq** (float) - How many control signals to receive in every second. This sets the amount of simulation time that passes between every action input. - **lite_physics** (bool) - Whether to optimize for mujoco forward and step calls to reduce total simulation overhead. Set to False to preserve backward compatibility with datasets collected in robosuite <= 1.4.1. - **horizon** (int) - Every episode lasts for exactly @horizon timesteps. - **ignore_done** (bool) - True if never terminating the environment (ignore @horizon). - **hard_reset** (bool) - If True, re-loads model, sim, and render object upon a reset call, else, only calls sim.reset and resets all robosuite-internal variables. - **camera_names** (str or list of str) - Name of camera to be rendered. Should either be single str if same name is to be used for all cameras’ rendering or else it should be a list of cameras to render. Note: At least one camera must be specified if @use_camera_obs is True. Note: To render all robots’ cameras of a certain type (e.g.: “robotview” or “eye_in_hand”), use the convention “all-{name}” (e.g.: “all-robotview”) to automatically render all camera images from each robot’s camera list). - **camera_heights** (int or list of int) - Height of camera frame. Should either be single int if same height is to be used for all cameras’ frames or else it should be a list of the same length as “camera names” param. - **camera_widths** (int or list of int) - Width of camera frame. Should either be single int if same width is to be used for all cameras’ frames or else it should be a list of the same length as “camera names” param. - **camera_depths** (bool or list of bool) - True if rendering RGB-D, and RGB otherwise. Should either be single bool if same depth setting is to be used for all cameras or else it should be a list of the same length as “camera names” param. - **camera_segmentations** (None or str or list of str or list of list of str) - Camera segmentation(s) to use for each camera. Valid options are: > None: no segmentation sensor used > ‘instance’: segmentation at the class-instance level > ‘class’: segmentation at the class level > ‘element’: segmentation at the per-geom level If not None, multiple types of segmentations can be specified. A [list of str / str or None] specifies [multiple / a single] segmentation(s) to use for all cameras. A list of list of str specifies per-camera segmentation setting(s) to use. ### Raises **AssertionError** – Invalid number of robots specified ``` -------------------------------- ### Initialize and Update USD Scene Source: https://robosuite.ai/docs/demos Initializes the `USDExporter` with the MuJoCo model and an output directory, then updates the scene with the current simulation data. This prepares the trajectory for export. ```python exp = exporter.USDExporter(model=model, output_directory_name="usd_demo") exp.update_scene(data) ``` -------------------------------- ### Get Observation Modalities in RoboSuite AI Source: https://robosuite.ai/docs/simulation/environment Retrieves the set of all observation modalities configured for the environment. ```python _property observation_modalities# """ Modalities for this environment’s observations Returns: set: All observation modalities """ pass ``` -------------------------------- ### Get Observation Specification Source: https://robosuite.ai/docs/simulation/environment Returns the observation specification of the environment, detailing the structure and shape of observations. ```python observation_spec() ``` -------------------------------- ### Get Action Dimension in RoboSuite AI Source: https://robosuite.ai/docs/simulation/environment Returns the integer representing the size or dimension of the action space. ```python _property _action_dim# """ Size of the action space Returns: int: Action space dimension """ pass ``` -------------------------------- ### Adapt RoboSuite Environments to OpenAI Gym API Source: https://robosuite.ai/docs/demos Demonstrates adapting RoboSuite environments for compatibility with OpenAI Gym-style APIs using the `GymWrapper`, facilitating integration with RL libraries like OpenAI Baselines. ```Python import gym import robosuite from robosuite.wrappers import GymWrapper # Example usage: # robosuite_env = robosuite.make("CartPole", # has_renderer=True, # render_freq=100, # control_freq=20) # gym_env = GymWrapper(robotsuiter_env) # --- OpenAI Gym Example --- # env = gym.make('CartPole-v0') # for i_episode in range(20): # observation = env.reset() # for t in range(100): # env.render() # print(observation) # action = env.action_space.sample() # observation, reward, done, info = env.step(action) # if done: # print("Episode finished after {} timesteps".format(t+1)) # break ``` -------------------------------- ### Initialize Robot Components (__init__) Source: https://robosuite.ai/docs/genindex The __init__ method is fundamental for initializing various robotic components. This includes arenas, robots, and tasks. It sets up the initial state and configurations for these components. ```python class Arena: def __init__(self, ...): pass class BinsArena(Arena): def __init__(self, ...): super().__init__(...) class EmptyArena(Arena): def __init__(self, ...): super().__init__(...) class MultiTableArena(Arena): def __init__(self, ...): super().__init__(...) class PegsArena(Arena): def __init__(self, ...): super().__init__(...) class TableArena(Arena): def __init__(self, ...): super().__init__(...) class WipeArena(Arena): def __init__(self, ...): super().__init__(...) class MujocoGeneratedObject: def __init__(self, ...): pass class MujocoObject(MujocoGeneratedObject): def __init__(self, ...): super().__init__(...) class MujocoXMLObject(MujocoObject): def __init__(self, ...): super().__init__(...) class Task: def __init__(self, ...): pass ``` -------------------------------- ### Get Observation Names in RoboSuite AI Source: https://robosuite.ai/docs/simulation/environment Retrieves a set containing all names of the observables available in the environment. ```python _property observation_names# """ Grabs all names for this environment’s observables Returns: set: All observation names """ pass ``` -------------------------------- ### Mujoco Environment Initialization Source: https://robosuite.ai/docs/simulation/environment Initializes the Mujoco environment with various rendering and simulation parameters. Allows configuration of off-screen rendering, camera views, collision mesh rendering, and control frequency. ```APIDOC ## __init__ MujocoEnv ### Description Initializes a Mujoco Environment with configurable rendering and simulation properties. ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body * **has_renderer** (bool) - If true, render the simulation state in a viewer instead of headless mode. * **has_offscreen_renderer** (bool) - True if using off-screen rendering. * **render_camera** (str or list of str) - Name of camera to render if has_renderer is True. Can be 'None' for default angle. * **render_collision_mesh** (bool) - True if rendering collision meshes in camera. False otherwise. * **render_visual_mesh** (bool) - True if rendering visual meshes in camera. False otherwise. * **render_gpu_device_id** (int) - GPU device ID for offscreen rendering. Defaults to -1. * **control_freq** (float) - Control frequency (Hz) for the simulation. * **lite_physics** (bool) - Optimize for mujoco forward and step calls. Set to False for backward compatibility. * **horizon** (int) - Maximum number of timesteps per episode. * **ignore_done** (bool) - If True, the environment never terminates (ignores horizon). * **hard_reset** (bool) - If True, re-loads model, sim, and render object on reset. * **renderer** (str) - String for the renderer to use. * **renderer_config** (dict) - Dictionary for renderer configurations. * **seed** (int) - Environment seed. Defaults to None (unseeded). ### Request Example ```json { "has_renderer": false, "has_offscreen_renderer": true, "render_camera": "frontview", "render_collision_mesh": false, "render_visual_mesh": true, "render_gpu_device_id": -1, "control_freq": 20.0, "lite_physics": true, "horizon": 1000, "ignore_done": false, "hard_reset": true, "renderer": "mjviewer", "renderer_config": {}, "seed": null } ``` ### Response #### Success Response (200) None (Constructor does not return a value directly) #### Response Example None ``` -------------------------------- ### Get Number of Leg Joints Source: https://robosuite.ai/docs/simulation/robot Returns the total number of actuated joints in the robot's legs. ```python property _num_leg_joints ``` -------------------------------- ### Import and Interact with Grippers Procedurally Source: https://robosuite.ai/docs/demos Illustrates importing grippers into a scene, enabling interaction with objects via actuators, and procedurally generating scenes using MJCF utility functions. ```Python import robosuite from robosuite.utils import mjcf_utils # Example usage (conceptual): # scene = mjcf_utils.load_model("path/to/scene.xml") # gripper = mjcf_utils.find_element(scene, tag='body', attrib={'name': 'gripper_name'}) # object_to_grasp = mjcf_utils.find_element(scene, tag='body', attrib={'name': 'object_name'}) # ... (interaction logic) ``` -------------------------------- ### Get Controller Name (Robosuite AI) Source: https://robosuite.ai/docs/simulation/controller Returns the name of the controller. This property provides a string identifier for the specific controller instance. ```Python _property _name# Name of this controller Returns: controller name Return type: str ``` -------------------------------- ### Get Controller Name in RoboSuite AI Source: https://robosuite.ai/docs/simulation/controller Returns the name of the current controller instance. This property provides a string identifier for the controller. ```python _property _name# ``` -------------------------------- ### PickPlace Environment Initialization Source: https://robosuite.ai/docs/source/robosuite.environments Initializes the PickPlace environment for a single robot arm, allowing configuration of robots, controllers, grippers, and environment specifics. ```APIDOC ## PickPlace Environment ### Description This class corresponds to the pick place task for a single robot arm. It allows for detailed configuration of the environment, including robot specifications, controller settings, gripper types, and visual rendering options. ### Method __init__ ### Endpoint N/A (This is a class constructor) ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body - **robots** (str or list of str) - Required - Specification for specific robot arm(s) to be instantiated within this env. Must be a single single-arm robot. - **env_configuration** (str) - Optional - Specifies how to position the robots within the environment (default: "default"). - **controller_configs** (str or list of dict) - Optional - If set, contains relevant controller parameters for creating a custom controller. Else, uses the default controller. - **gripper_types** (str or list of str) - Optional - Type of gripper to instantiate. Default is "default". None removes the gripper. - **base_types** (None or str or list of str) - Optional - Type of base to instantiate. Default is "default". None results in no base. - **initialization_noise** (dict or list of dict) - Optional - Dict containing initialization noise parameters (magnitude, type). - **table_full_size** (3-tuple) - Optional - x, y, and z dimensions of the table (default: (0.39, 0.49, 0.82)). - **table_friction** (3-tuple) - Optional - The three mujoco friction parameters for the table. - **bin1_pos** (3-tuple) - Optional - Absolute cartesian coordinates of the bin initially holding the objects (default: (0.1, -0.25, 0.8)). - **bin2_pos** (3-tuple) - Optional - Absolute cartesian coordinates of the goal bin (default: (0.1, 0.28, 0.8)). - **z_offset** (float) - Optional - Amount of z offset for initializing objects in bin (default: 0.0). - **z_rotation** (float, tuple, or None) - Optional - Controls the range of z-rotation initialization for the objects. - **use_camera_obs** (bool) - Optional - If True, every observation includes rendered image(s) (default: True). - **use_object_obs** (bool) - Optional - If True, include object (cube) information in the observation (default: True). - **reward_scale** (None or float) - Optional - Scales the normalized reward function (default: 1.0). - **reward_shaping** (bool) - Optional - If True, use dense rewards (default: False). - **single_object_mode** (int) - Optional - Specifies which version of the task to do (default: 0). - **object_type** (None) - Optional - Specifies the type of object (if any). - **has_renderer** (bool) - Optional - Whether to enable rendering (default: False). - **has_offscreen_renderer** (bool) - Optional - Whether to enable offscreen rendering (default: True). - **render_camera** (str) - Optional - The rendering camera to use (default: "frontview"). - **render_collision_mesh** (bool) - Optional - Whether to render the collision mesh (default: False). - **render_visual_mesh** (bool) - Optional - Whether to render the visual mesh (default: True). - **render_gpu_device_id** (int) - Optional - GPU device ID for rendering (default: -1). - **control_freq** (int) - Optional - Control frequency of the environment (default: 20). - **lite_physics** (bool) - Optional - Use lite physics (default: True). - **horizon** (int) - Optional - Horizon for the environment (default: 1000). - **ignore_done** (bool) - Optional - Whether to ignore the done condition (default: False). - **hard_reset** (bool) - Optional - Whether to perform a hard reset (default: True). - **camera_names** (str) - Optional - Names of the cameras to use (default: "agentview"). - **camera_heights** (int) - Optional - Height of the camera images (default: 256). - **camera_widths** (int) - Optional - Width of the camera images (default: 256). - **camera_depths** (bool) - Optional - Whether to include depth information in camera observations (default: False). - **camera_segmentations** (None) - Optional - Segmentation information for cameras. - **renderer** (str) - Optional - The renderer to use (default: "mjviewer"). - **renderer_config** (None) - Optional - Configuration for the renderer. - **seed** (None) - Optional - Seed for random number generation. ``` -------------------------------- ### Get Joint Positions (NumPy) Source: https://robosuite.ai/docs/simulation/robot Returns a NumPy array containing the current joint positions (in angles/radians) of the robot. ```Python robot.__joint_positions ``` -------------------------------- ### Initialize Arm Controller - robosuite.controllers.parts.controller_factory.arm_controller_factory Source: https://robosuite.ai/docs/source/robosuite.controllers Generates a Controller instance for an arm, creating it with the specified name and parameters. It requires the controller name, a dictionary of parameters, and a reference to the Mujoco simulation object. ```Python robosuite.controllers.parts.controller_factory.arm_controller_factory(_name_ , _params_) ```