Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Controller Config Registration Error #581

Open
myunusseker opened this issue Nov 25, 2024 · 4 comments
Open

Controller Config Registration Error #581

myunusseker opened this issue Nov 25, 2024 · 4 comments
Assignees

Comments

@myunusseker
Copy link

System Info

Robosuite 1.5.0
Python 3.10

Information

Hi, I just started using RoboSuite, but I am having this problem even though I try to follow the starter codes.

import robosuite as suite
import numpy as np
from robosuite.controllers import load_part_controller_config

# load default controller parameters for Operational Space Control (OSC)
controller_config = load_part_controller_config(default_controller="OSC_POSE")

env = suite.make(
    "Lift",
    robots=["UR5e"],             # load a Sawyer robot and a Panda robot
    gripper_types="RethinkGripper",       # use default grippers per robot arm
    controller_configs=controller_config,  # each arm is controlled using OSC
    env_configuration="opposed",            # (two-arm envs only) arms face each other
    has_renderer=True,                      # on-screen rendering
    render_camera="frontview",              # visualize the "frontview" camera
)

# 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
Traceback (most recent call last):
  File "/home/user/robosuite/robosuite/scripts/trial.py", line 8, in <module>
    env = suite.make(
  File "/home/user/robosuite/robosuite/environments/base.py", line 41, in make
    return REGISTERED_ENVS[env_name](*args, **kwargs)
  File "/home/user/robosuite/robosuite/environments/manipulation/lift.py", line 187, in __init__
    super().__init__(
  File "/home/user/robosuite/robosuite/environments/manipulation/manipulation_env.py", line 171, in __init__
    super().__init__(
  File "/home/user/robosuite/robosuite/environments/robot_env.py", line 221, in __init__
    super().__init__(
  File "/home/user/robosuite/robosuite/environments/base.py", line 158, in __init__
    self._reset_internal()
  File "/home/user/robosuite/robosuite/environments/manipulation/lift.py", line 394, in _reset_internal
    super()._reset_internal()
  File "/home/user/robosuite/robosuite/environments/robot_env.py", line 526, in _reset_internal
    robot.reset(deterministic=self.deterministic_reset)
  File "/home/user/robosuite/robosuite/robots/fixed_base_robot.py", line 78, in reset
    super().reset(deterministic)
  File "/home/user/robosuite/robosuite/robots/robot.py", line 269, in reset
    self._load_controller()
  File "/home/user/robosuite/robosuite/robots/fixed_base_robot.py", line 46, in _load_controller
    self.composite_controller = composite_controller_factory(
  File "/home/user/robosuite/robosuite/controllers/composite/__init__.py", line 8, in composite_controller_factory
    assert type in REGISTERED_COMPOSITE_CONTROLLERS_DICT, f"{type} controller is specified, but not imported or loaded"
AssertionError: OSC_POSE controller is specified, but not imported or loaded

I tried installing from source and pip as well. Any help is appreciated.

Reproduction

Install RoboSuite 1.5.0
Run above code

Expected behavior

Simulation would start using the OSC_POSE controller

@kevin-thankyou-lin
Copy link
Contributor

@Abhiram824 could you please take a look?

@Abhiram824
Copy link
Member

Hello, we recently changed how controllers are used in the codebase to use composite controllers, which are controllers that are composed of multiple sub-controllers controllers for each part of the robot. (for more information please visit https://robosuite.ai/docs/simulation/controller.html) We are updating our documentation to reflect these changes currently.

If you would like to control the arms of the robot using OSC_POSE, you can load the BASIC composite controller. Please let me know if the following code works for you.

import robosuite as suite
import numpy as np
from robosuite.controllers import load_composite_controller_config

# BASIC controller: arms controlled using OSC, mobile base (if present) using JOINT_VELOCITY, other parts controlled using JOINT_POSITION 
controller_config = load_composite_controller_config(controller="BASIC")

env = suite.make(
    "Lift",
    robots=["UR5e"],             # load a Sawyer robot and a Panda robot
    gripper_types="RethinkGripper",       # use default grippers per robot arm
    controller_configs=controller_config,   # arms controlled via OSC, other parts via JOINT_POSITION/JOINT_VELOCITY
    env_configuration="opposed",            # (two-arm envs only) arms face each other
    has_renderer=True,                      # on-screen rendering
    render_camera="frontview",              # visualize the "frontview" camera
)

# 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

@kevin-thankyou-lin
Copy link
Contributor

@xieleo5

@kevin-thankyou-lin
Copy link
Contributor

@Abhiram824 looks like @myunusseker is probably referencing https://github.com/ARISE-Initiative/robosuite/blob/master/docs/modules/controllers.ipynb, would you be able to update the docs (first convert it back to a .md and then update the script to use from robosuite.controllers import load_composite_controller_config?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants