Jump to content

Connect Leeroopedia MCP: Equip your AI agents to search best practices, build plans, verify code, diagnose failures, and look up hyperparameter defaults.

Implementation:ARISE Initiative Robosuite Robot Create Action Vector

From Leeroopedia

Metadata:

Overview

Concrete method for assembling flat action vectors from structured action dictionaries provided by the robosuite Robot class.

Description

Robot.create_action_vector(action_dict) takes a dictionary mapping part names to action arrays and concatenates them in the order expected by the robot's composite controller. Returns a flat numpy array of size robot.action_dim.

Usage

Called in teleoperation loops after device.input2action(). The returned array is passed directly to env.step().

Code Reference

  • Source: robosuite
  • File: robosuite/robots/robot.py
  • Lines: L992-1013
  • Signature:
def create_action_vector(self, action_dict):
    """A helper function that creates the action vector given a dictionary"""
  • Import: Accessed via env.robots[0].create_action_vector(action_dict) on an existing environment instance.

I/O Contract

  • Inputs:
    • action_dict (Dict, Required) - maps part names to action arrays
  • Outputs:
    • np.ndarray - flat action vector of size robot.action_dim

Usage Examples

Teleoperation loop example:

# Get structured actions from input device
action_dict = device.input2action()

# Convert to flat vector
action = env.robots[0].create_action_vector(action_dict)

# Step the environment
obs, reward, done, info = env.step(action)

Related Pages

Page Connections

Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment