### Install Dependencies for Documentation Source: https://github.com/farama-foundation/gymnasium-robotics/blob/main/docs/README.md Installs the necessary packages for building the documentation. Ensure you have Gym (or your fork) installed. ```bash pip install -r requirements.txt pip install gym ``` -------------------------------- ### Install Gymnasium-Robotics Source: https://github.com/farama-foundation/gymnasium-robotics/blob/main/docs/content/installation.md Use this command to install the core Gymnasium-Robotics package. ```bash pip install gymnasium-robotics ``` -------------------------------- ### Initialize Franka Kitchen Environment with Specific Tasks Source: https://github.com/farama-foundation/gymnasium-robotics/blob/main/docs/envs/franka_kitchen/index.md Use this snippet to create an instance of the FrankaKitchen-v1 environment and specify which tasks the robot should complete. Ensure gymnasium and gymnasium_robotics are installed and registered. ```python import gymnasium as gym import gymnasium_robotics gym.register_envs(gymnasium_robotics) env = gym.make('FrankaKitchen-v1', tasks_to_complete=['microwave', 'kettle']) ``` -------------------------------- ### Create and Interact with FetchPickAndPlace Environment Source: https://github.com/farama-foundation/gymnasium-robotics/blob/main/docs/index.md Demonstrates the standard Gymnasium interface for creating, resetting, and stepping through an environment. Ensure gymnasium and gymnasium-robotics are installed. The policy function must be defined by the user. ```python import gymnasium as gym import gymnasium_robotics gym.register_envs(gymnasium_robotics) env = gym.make("FetchPickAndPlace-v4", render_mode="human") observation, info = env.reset(seed=42) for _ in range(1000): action = policy(observation) # User-defined policy function observation, reward, terminated, truncated, info = env.step(action) if terminated or truncated: observation, info = env.reset() env.close() ``` -------------------------------- ### Install Gymnasium-Robotics with Latest MuJoCo-Py Bindings Source: https://github.com/farama-foundation/gymnasium-robotics/blob/main/docs/content/installation.md Install Gymnasium-Robotics along with the latest mujoco-py bindings for legacy environments. This is the recommended approach for compatibility with older mujoco-py versions. ```bash pip install gymnasium-robotics[mujoco-py] ``` -------------------------------- ### Instantiate HumanoidStandup Environment Source: https://github.com/farama-foundation/gymnasium-robotics/blob/main/docs/envs/MaMuJoCo/ma_humanoid_standup.md Instantiates the parallel HumanoidStandup environment with a 3x1 configuration. This setup is suitable for multi-agent scenarios. ```python env = mamujoco_v1.parallel_env("HumanoidStandup", "3x1") ``` -------------------------------- ### Instantiate Hand Environment with Boolean Touch Sensors Source: https://github.com/farama-foundation/gymnasium-robotics/blob/main/docs/envs/shadow_dexterous_hand/index.md Example of how to instantiate a Shadow Dexterous Hand environment with boolean touch sensors enabled. Ensure gymnasium_robotics is imported and environments are registered. ```python import gymnasium as gym import gymnasium_robotics gym.register_envs(gymnasium_robotics) env = gym.make('HandManipulateEgg_BooleanTouchSensors-v1') ``` -------------------------------- ### Using Multi-goal API Functions Source: https://github.com/farama-foundation/gymnasium-robotics/blob/main/README.md Demonstrates how to use the compute_reward, compute_terminated, and compute_truncated functions with original and substituted goals. This example requires the gymnasium and gymnasium_robotics libraries. ```python import gymnasium as gym import gymnasium_robotics gym.register_envs(gymnasium_robotics) env = gym.make("FetchReach-v4") env.reset() obs, reward, terminated, truncated, info = env.step(env.action_space.sample()) # The following always has to hold: assert reward == env.compute_reward(obs["achieved_goal"], obs["desired_goal"], info) assert truncated == env.compute_truncated(obs["achieved_goal"], obs["desired_goal"], info) assert terminated == env.compute_terminated(obs["achieved_goal"], obs["desired_goal"], info) # However goals can also be substituted: substitute_goal = obs["achieved_goal"].copy() substitute_reward = env.compute_reward(obs["achieved_goal"], substitute_goal, info) substitute_terminated = env.compute_terminated(obs["achieved_goal"], substitute_goal, info) substitute_truncated = env.compute_truncated(obs["achieved_goal"], substitute_goal, info) ``` -------------------------------- ### Install Gymnasium-Robotics with Original MuJoCo-Py Bindings Source: https://github.com/farama-foundation/gymnasium-robotics/blob/main/docs/content/installation.md Install Gymnasium-Robotics with original mujoco-py bindings for legacy environments. This version does not support cython>=3 and is intended for specific older use cases. ```bash pip install gymnasium-robotics[mujoco-py-original] ``` -------------------------------- ### Instantiate MaMuJoCo Humanoid Environment Source: https://github.com/farama-foundation/gymnasium-robotics/blob/main/docs/envs/MaMuJoCo/ma_humanoid.md Instantiate the parallel Humanoid environment from MaMuJoCo. Use `partitioning=None` for a single agent setup. ```python env = mamujoco_v1.parallel_env("Humanoid", None) ``` -------------------------------- ### Instantiate Parallel Half Cheetah Environment Source: https://github.com/farama-foundation/gymnasium-robotics/blob/main/docs/envs/MaMuJoCo/ma_half_cheetah.md Instantiates a parallel Half Cheetah environment with a '6x1' partition. This setup divides the environment's control among 6 agents, each controlling a single joint. ```python env = mamujoco_v1.parallel_env("HalfCheetah", "6x1") ``` -------------------------------- ### Instantiate MaMuJoCo Humanoid Parallel Environment Source: https://github.com/farama-foundation/gymnasium-robotics/blob/main/docs/envs/MaMuJoCo/ma_humanoid.md Instantiates the parallel Humanoid environment with a 3x1 configuration. This setup is used for multi-agent scenarios. ```python env = mamujoco_v1.parallel_env("Humanoid", "3x1") ``` -------------------------------- ### Instantiate MaMuJoCo Ant Environment Source: https://github.com/farama-foundation/gymnasium-robotics/blob/main/docs/envs/MaMuJoCo/ma_ant.md Instantiates the parallel Ant environment with a '4x2' partitioning. This setup divides the ant's control into four distinct agents, each managing a leg. ```python env = mamujoco_v1.parallel_env("Ant", "4x2") ``` -------------------------------- ### Get Parts and Edges for Ant-v5 Source: https://github.com/farama-foundation/gymnasium-robotics/blob/main/docs/envs/MaMuJoCo/index.md Retrieves the graph structure (nodes and edges) for the 'Ant-v5' environment. This is a prerequisite for creating custom agent factorizations. ```python from gymnasium_robotics.mamujoco_v1 import get_parts_and_edges unpartioned_nodes, edges, global_nodes = get_parts_and_edges('Ant-v5', None) ``` -------------------------------- ### Factorize Boston Dynamics Spot Arm Robot Source: https://github.com/farama-foundation/gymnasium-robotics/blob/main/docs/envs/MaMuJoCo/index.md Defines a factorization graph to separate the quadruped and arm components of the Boston Dynamics Spot robot into distinct agents. This setup is useful for multi-agent control scenarios where different parts of a robot have specialized functions. Ensure the MuJoCo Menagerie XML file is correctly referenced. ```python from gymnasium_robotics import mamujoco_v1 from gymnasium_robotics.envs.multiagent_mujoco.obsk import Node, HyperEdge # Define the factorization graph freejoint = Node( "freejoint", None, None, None, extra_obs={ "qpos": lambda data: data.qpos[2:7], "qvel": lambda data: data.qvel[:6], }, ) fl_hx = Node("fl_hx", -19, -19, 0) fl_hy = Node("fl_hy", -18, -18, 1) fl_kn = Node("fl_kn", -17, -17, 2) fr_hx = Node("fr_hx", -16, -16, 3) fr_hy = Node("fr_hy", -15, -15, 4) fr_kn = Node("fr_kn", -14, -14, 5) hl_hx = Node("hl_hx", -13, -13, 6) hl_hy = Node("hl_hy", -12, -12, 7) hl_kn = Node("hl_kn", -11, -11, 8) hr_hx = Node("hr_hx", -10, -10, 9) hr_hy = Node("hr_hy", -9, -9, 10) hr_kn = Node("hr_kn", -8, -8, 11) arm_sh0 = Node("arm_sh0", -7, -7, 12) arm_sh1 = Node("arm_sh1", -6, -6, 13) arm_el0 = Node("arm_el0", -5, -5, 14) arm_el1 = Node("arm_el1", -4, -4, 15) arm_wr0 = Node("arm_wr0", -3, -3, 16) arm_wr1 = Node("arm_wr1", -2, -2, 17) arm_f1x = Node("arm_f1x", -1, -1, 18) parts = [ ( # Locomoting Quadruped Component fl_hx, fl_hy, fl_kn, fr_hx, fr_hy, fr_kn, hl_hx, hl_hy, hl_kn, hr_hx, hr_hy, hr_kn, ), ( # Arm Manipulator Component arm_sh0, arm_sh1, arm_el0, arm_el1, arm_wr0, arm_wr1, arm_f1x, ), ] edges = [ HyperEdge(fl_hx, fl_hy, fl_kn), HyperEdge(fr_hx, fr_hy, fr_kn), HyperEdge(hl_hx, hl_hy, hl_kn), HyperEdge(hr_hx, hr_hy, hr_kn), HyperEdge( # Main "body" connections fl_hx, fl_hy, fr_hx, fr_hy, hl_hx, hl_hy, hr_hx, hr_hy, arm_sh0, arm_sh1, ), HyperEdge(arm_sh0, arm_sh1, arm_el0, arm_el1), HyperEdge(arm_el0, arm_el1, arm_wr0, arm_wr1), HyperEdge(arm_wr0, arm_wr1, arm_f1x), ] global_nodes = [freejoint] my_agent_factorization = {"partition": parts, "edges": edges, "globals": global_nodes} env = mamujoco_v1.parallel_env( "Ant", "quadruped|arm", agent_factorization=my_agent_factorization, xml_file="./mujoco_menagerie/boston_dynamics_spot/scene_arm.xml", ) ``` -------------------------------- ### Build Documentation Once Source: https://github.com/farama-foundation/gymnasium-robotics/blob/main/docs/README.md Builds the documentation using Sphinx. Navigate to the 'docs' directory before running this command. ```bash cd docs make dirhtml ``` -------------------------------- ### Instantiate HumanoidStandup Environment (No Partitioning) Source: https://github.com/farama-foundation/gymnasium-robotics/blob/main/docs/envs/MaMuJoCo/ma_humanoid_standup.md Use this code to instantiate the HumanoidStandup environment when no partitioning is applied. This results in a single agent with the full action space. ```python env = mamujoco_v1.parallel_env("HumanoidStandup", None) ``` -------------------------------- ### Instantiate Ant Environment (Default Partitioning) Source: https://github.com/farama-foundation/gymnasium-robotics/blob/main/docs/envs/MaMuJoCo/ma_ant.md Use this to instantiate the Ant environment with default partitioning, resulting in a single agent with an 8-dimensional action space. ```python env = mamujoco_v1.parallel_env("Ant", None) ``` -------------------------------- ### Instantiate Pusher Environment (3-Part Partitioning) Source: https://github.com/farama-foundation/gymnasium-robotics/blob/main/docs/envs/MaMuJoCo/ma_pusher.md Use this to instantiate the Pusher environment with a 3-part action space partitioning. This configuration results in three agents with different action space dimensions. ```python env = mamujoco_v1.parallel_env("Pusher", "3p") ``` -------------------------------- ### Instantiate Pusher Environment (No Partitioning) Source: https://github.com/farama-foundation/gymnasium-robotics/blob/main/docs/envs/MaMuJoCo/ma_pusher.md Use this to instantiate the Pusher environment when no action space partitioning is desired. The environment will have a single agent with a 7-dimensional action space. ```python env = mamujoco_v1.parallel_env("Pusher", None) ``` -------------------------------- ### Instantiate Ant Environment (2x4 Partitioning) Source: https://github.com/farama-foundation/gymnasium-robotics/blob/main/docs/envs/MaMuJoCo/ma_ant.md Use this to instantiate the Ant environment with '2x4' partitioning, creating two agents each with a 4-dimensional action space, controlling front and back legs separately. ```python env = mamujoco_v1.parallel_env("Ant", "2x4") ``` -------------------------------- ### Adroit Hand Environment Initialization Source: https://github.com/farama-foundation/gymnasium-robotics/blob/main/docs/envs/adroit_hand/index.md Demonstrates how to initialize the different Adroit Hand environments, including sparse reward variants. ```python import gymnasium as gym env = gym.make("AdroitHandDoor-v2", render_mode="human") observation, info = env.reset() for _ in range(1000): action = env.action_space.sample() # Replace with your agent's action observation, reward, terminated, truncated, info = env.step(action) if terminated or truncated: observation, info = env.reset() env.close() ``` ```python import gymnasium as gym env = gym.make("AdroitHandDoorSparse-v2", render_mode="human") observation, info = env.reset() for _ in range(1000): action = env.action_space.sample() # Replace with your agent's action observation, reward, terminated, truncated, info = env.step(action) if terminated or truncated: observation, info = env.reset() env.close() ``` ```python import gymnasium as gym env = gym.make("AdroitHandHammer-v2", render_mode="human") observation, info = env.reset() for _ in range(1000): action = env.action_space.sample() # Replace with your agent's action observation, reward, terminated, truncated, info = env.step(action) if terminated or truncated: observation, info = env.reset() env.close() ``` ```python import gymnasium as gym env = gym.make("AdroitHandHammerSparse-v2", render_mode="human") observation, info = env.reset() for _ in range(1000): action = env.action_space.sample() # Replace with your agent's action observation, reward, terminated, truncated, info = env.step(action) if terminated or truncated: observation, info = env.reset() env.close() ``` ```python import gymnasium as gym env = gym.make("AdroitHandPen-v2", render_mode="human") observation, info = env.reset() for _ in range(1000): action = env.action_space.sample() # Replace with your agent's action observation, reward, terminated, truncated, info = env.step(action) if terminated or truncated: observation, info = env.reset() env.close() ``` ```python import gymnasium as gym env = gym.make("AdroitHandPenSparse-v2", render_mode="human") observation, info = env.reset() for _ in range(1000): action = env.action_space.sample() # Replace with your agent's action observation, reward, terminated, truncated, info = env.step(action) if terminated or truncated: observation, info = env.reset() env.close() ``` ```python import gymnasium as gym env = gym.make("AdroitHandRelocate-v2", render_mode="human") observation, info = env.reset() for _ in range(1000): action = env.action_space.sample() # Replace with your agent's action observation, reward, terminated, truncated, info = env.step(action) if terminated or truncated: observation, info = env.reset() env.close() ``` ```python import gymnasium as gym env = gym.make("AdroitHandRelocateSparse-v2", render_mode="human") observation, info = env.reset() for _ in range(1000): action = env.action_space.sample() # Replace with your agent's action observation, reward, terminated, truncated, info = env.step(action) if terminated or truncated: observation, info = env.reset() env.close() ``` -------------------------------- ### Instantiate Half Cheetah with 2x3 Partitioning Source: https://github.com/farama-foundation/gymnasium-robotics/blob/main/docs/envs/MaMuJoCo/ma_half_cheetah.md Use this to create a Half Cheetah environment with two agents. Agent 0 controls the back leg (3 actions), and Agent 1 controls the front leg (3 actions). ```python env = mamujoco_v1.parallel_env("HalfCheetah", "2x3") ``` -------------------------------- ### Instantiate Half Cheetah with No Partitioning Source: https://github.com/farama-foundation/gymnasium-robotics/blob/main/docs/envs/MaMuJoCo/ma_half_cheetah.md Use this to create a Half Cheetah environment with a single agent. The action space will be a Box with 6 dimensions, controlling all leg rotors. ```python env = mamujoco_v1.parallel_env("HalfCheetah", None) ``` -------------------------------- ### Instantiate Hopper Environment (No Partitioning) Source: https://github.com/farama-foundation/gymnasium-robotics/blob/main/docs/envs/MaMuJoCo/ma_hopper.md Use this to instantiate the Hopper environment with a single agent and the default action space partitioning. ```python env = mamujoco_v1.parallel_env("Hopper", None) ``` -------------------------------- ### Instantiate Hopper Environment (3x1 Partitioning) Source: https://github.com/farama-foundation/gymnasium-robotics/blob/main/docs/envs/MaMuJoCo/ma_hopper.md Use this to instantiate the Hopper environment partitioned into 3 agents, each controlling a single joint. ```python env = mamujoco_v1.parallel_env("Hopper", "3x1") ``` -------------------------------- ### Instantiate CoupledHalfCheetah with None Partitioning Source: https://github.com/farama-foundation/gymnasium-robotics/blob/main/docs/envs/MaMuJoCo/ma_coupled_half_cheetah.md Use this to create the environment with a single agent when no specific partitioning is required. The action space will be a Box with 12 dimensions. ```python env = mamujoco_v1.parallel_env("CoupledHalfCheetah", None) ``` -------------------------------- ### Instantiate Reacher with '2x1' Partitioning Source: https://github.com/farama-foundation/gymnasium-robotics/blob/main/docs/envs/MaMuJoCo/ma_reacher.md Use this to create a Reacher environment partitioned into two agents, each controlling one joint of the robotic arm. ```python env = mamujoco_v1.parallel_env("Reacher", "2x1") ``` -------------------------------- ### Instantiate Walker2d with No Partitioning Source: https://github.com/farama-foundation/gymnasium-robotics/blob/main/docs/envs/MaMuJoCo/ma_walker2d.md Use this to create a Walker2d environment with a single agent. The action space will be equivalent to Gymnasium's MuJoCo/Walker2d. ```python env = mamujoco_v1.parallel_env("Walker2d", None) ``` -------------------------------- ### Instantiate InvertedDoublePendulum without Partition Source: https://github.com/farama-foundation/gymnasium-robotics/blob/main/docs/envs/MaMuJoCo/ma_single.md Use this to create a single-agent InvertedDoublePendulum environment using MaMuJoCo's parallel environment API without any partitioning. ```python env = mamujoco_v0.parallel_env("InvertedDoublePendulum", None) ``` -------------------------------- ### Instantiate Reacher with No Partitioning Source: https://github.com/farama-foundation/gymnasium-robotics/blob/main/docs/envs/MaMuJoCo/ma_reacher.md Use this to create a Reacher environment with a single agent, mirroring the default Gymnasium Reacher action space. ```python env = mamujoco_v1.parallel_env("Reacher", None) ``` -------------------------------- ### Instantiate Ant Environment with 2x4d Partitioning Source: https://github.com/farama-foundation/gymnasium-robotics/blob/main/docs/envs/MaMuJoCo/ma_ant.md Use this to create a parallel Ant environment partitioned diagonally. The environment is split into two agents, each controlling four joints. ```python env = mamujoco_v1.parallel_env("Ant", "2x4d") ``` -------------------------------- ### Instantiate InvertedPendulum without Partition Source: https://github.com/farama-foundation/gymnasium-robotics/blob/main/docs/envs/MaMuJoCo/ma_single.md Use this to create a single-agent InvertedPendulum environment using MaMuJoCo's parallel environment API without any partitioning. ```python env = mamujoco_v0.parallel_env("InvertedPendulum", None) ``` -------------------------------- ### Instantiate CoupledHalfCheetah with '1p1' Partitioning Source: https://github.com/farama-foundation/gymnasium-robotics/blob/main/docs/envs/MaMuJoCo/ma_coupled_half_cheetah.md Use this to create the environment with two agents, where each agent controls one half cheetah. The action space is split into two Boxes, each with 6 dimensions. ```python env = mamujoco_v1.parallel_env("CoupledHalfCheetah", "1p1") ``` -------------------------------- ### Instantiate Walker2d with '2x3' Partitioning Source: https://github.com/farama-foundation/gymnasium-robotics/blob/main/docs/envs/MaMuJoCo/ma_walker2d.md This creates a Walker2d environment partitioned into two agents, one for each leg. Each agent controls a subset of the joints. ```python env = mamujoco_v1.parallel_env("Walker2d", "2x3") ``` -------------------------------- ### Instantiate Swimmer Environment (2x1 Partitioning) Source: https://github.com/farama-foundation/gymnasium-robotics/blob/main/docs/envs/MaMuJoCo/ma_swimmer.md Instantiates the Swimmer environment with a '2x1' partitioning, splitting the action space between two agents, each controlling one rotor. ```python env = mamujoco_v1.parallel_env("Swimmer", "2x1") ``` -------------------------------- ### Instantiate Swimmer Environment (No Partitioning) Source: https://github.com/farama-foundation/gymnasium-robotics/blob/main/docs/envs/MaMuJoCo/ma_swimmer.md Instantiates the Swimmer environment with no action space partitioning, resulting in a single agent controlling both rotors. ```python env = mamujoco_v1.parallel_env("Swimmer", None) ``` -------------------------------- ### Rebuild Documentation Automatically Source: https://github.com/farama-foundation/gymnasium-robotics/blob/main/docs/README.md Continuously rebuilds the documentation as changes are detected. This command requires 'sphinx-autobuild' and should be run from the 'docs' directory. ```bash cd docs sphinx-autobuild -b dirhtml . _build ``` -------------------------------- ### Define Humanoid Agents and Action Spaces Source: https://github.com/farama-foundation/gymnasium-robotics/blob/main/docs/envs/MaMuJoCo/ma_humanoid.md Defines the agents and their respective action spaces for the partitioned Humanoid environment. Agent 0 controls the upper body (9 actions) and Agent 1 controls the lower body (8 actions). ```python agents= ['agent_0', 'agent_1'] ``` ```python action_spaces={'agent_0': Box(-1, 1, (9,), float32), 'agent_1' : Box(-1, 1, (8,), float32)} ``` -------------------------------- ### Cite Gymnasium Robotics Source: https://github.com/farama-foundation/gymnasium-robotics/blob/main/README.md Use this BibTeX entry when citing the Gymnasium Robotics project in academic research. Ensure the version and year are up-to-date. ```bibtex @software{gymnasium_robotics2023github, author = {Rodrigo de Lazcano and Kallinteris Andreas and Jun Jet Tai and Seungjae Ryan Lee and Jordan Terry}, title = {Gymnasium Robotics}, url = {http://github.com/Farama-Foundation/Gymnasium-Robotics}, version = {1.4.0}, year = {2024}, } ``` -------------------------------- ### Define Custom Agent Factorization for Ant Source: https://github.com/farama-foundation/gymnasium-robotics/blob/main/docs/envs/MaMuJoCo/index.md Creates a custom agent factorization for the 'Ant' environment, specifically for an '8x1' configuration where each agent controls a single joint. This involves partitioning the unpartitioned nodes and packaging them with edges and global nodes. ```python unpartioned_nodes [(hip1, ankle1, hip2, ankle2, hip3, ankle3, hip4, ankle4)] partioned_nodes = [(unpartioned_nodes[0][0],), (unpartioned_nodes[0][1],), (unpartioned_nodes[0][2],), (unpartioned_nodes[0][3],), (unpartioned_nodes[0][4],), (unpartioned_nodes[0][5],), (unpartioned_nodes[0][6],), (unpartioned_nodes[0][7],)] partioned_nodes [(hip1,), (ankle1,), (hip2,), (ankle2,), (hip3,), (ankle3,), (hip4,), (ankle4,)] ``` ```python my_agent_factorization = {"partition": partioned_nodes, "edges": edges, "globals": global_nodes} gym_env = mamujoco_v1('Ant', '8x1', agent_factorization=my_agent_factorization) ``` -------------------------------- ### Humanoid Partitions for Agent Actions Source: https://github.com/farama-foundation/gymnasium-robotics/blob/main/docs/envs/MaMuJoCo/ma_humanoid.md Specifies the joint groupings for the upper and lower body partitions. This defines which joints each agent controls. ```python part_partition=[(abdomen_x, abdomen_y, abdomen_z, right_shoulder1, right_shoulder2, right_elbow, left_shoulder1, left_shoulder2, left_elbow,), (right_hip_x, right_hip_y, right_hip_z, right_knee, left_hip_x, left_hip_y, left_hip_z, left_knee,)] ``` -------------------------------- ### map_local_actions_to_global_action Source: https://github.com/farama-foundation/gymnasium-robotics/blob/main/docs/envs/MaMuJoCo/index.md Maps multi-agent actions into a single agent action space. This is useful for environments where a central controller needs to interpret actions from multiple agents. ```APIDOC ## map_local_actions_to_global_action ### Description Maps multi agent actions into single agent action space. ### Method `map_local_actions_to_global_action(self, actions: dict[str, ndarray]) -> ndarray` ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body - **actions** (dict[str, ndarray]) - Required - An dict representing the action of each agent ### Request Example ```json { "actions": { "agent_1": [0.1, -0.2], "agent_2": [0.3, 0.4] } } ``` ### Response #### Success Response (200) - **The action of the whole domain** (ndarray) - is what eqivilent single agent action would be #### Response Example ```json { "action": [0.1, -0.2, 0.3, 0.4] } ``` ### Raises - **AssertionError** – If the Agent action factorization is badly defined (if an action is double defined or not defined at all) ``` -------------------------------- ### get_parts_and_edges Source: https://github.com/farama-foundation/gymnasium-robotics/blob/main/docs/envs/MaMuJoCo/index.md Retrieves the MuJoCo graph structure (nodes and edges) for a given task, optionally with a specified partitioning scheme. This is useful for graph-based multi-agent approaches. ```APIDOC ## get_parts_and_edges ### Description Gets the mujoco Graph (nodes & edges) given an optional partitioning. ### Method `get_parts_and_edges(label: str, partitioning: str | None) -> tuple[list[tuple[Node, ...]], list[HyperEdge], list[Node]]` ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body - **label** (str) - Required - the mujoco task to partition - **partitioning** (str | None) - Optional - the partitioning scheme ### Request Example ```json { "label": "humanoid", "partitioning": "agent_based" } ``` ### Response #### Success Response (200) - **the partition of the mujoco graph nodes, the graph edges, and global nodes** (tuple[list[tuple[Node, ...]], list[HyperEdge], list[Node]]) #### Response Example ```json { "graph_data": [ [[{"id": 0, "type": "body"}]], [[{"id": 1, "type": "body"}]], [ {"source": 0, "target": 1, "type": "joint"} ], [ {"id": 0, "type": "global"} ] ] } ``` ```