ARISE-Initiative / robosuite

robosuite: A Modular Simulation Framework and Benchmark for Robot Learning
https://robosuite.ai
Other
1.24k stars 397 forks source link

How to choose gripper_type? #215

Closed kaixindelele closed 3 years ago

kaixindelele commented 3 years ago

In demo_control.py, we just can choose env task, robot, control type, but the gripper type is defaulted according to robot.

I tried several ways to pass the args as following without success:

import robosuite as suite
from robosuite.wrappers import GymWrapper

if __name__ == "__main__":

    # Notice how the environment is wrapped by the wrapper
    controller_name = 'JOINT_POSITION'
    controller_configs = suite.load_controller_config(default_controller=controller_name)
    options = {}
    options['controller_configs'] = controller_configs
    options["env_name"] = "Lift"
    options["robots"] = "Sawyer"
    options["gripper_type"] = "RethinkGripper" 

    env = GymWrapper(
        suite.make(            
            **options,
            # gripper_type="Robotiq85Gripper", # here is also failed!
            use_camera_obs=False,           # do not use pixel observations
            has_offscreen_renderer=False,   # not needed since not using pixel obs
            has_renderer=True,              # make sure we can render to the screen
            reward_shaping=True,            # use dense rewards
            control_freq=20,                # control should happen fast enough so that simulation looks smooth
            # gripper_types='Robotiq85Gripper', # here is success!
        )
    )

    for i_episode in range(20):
        observation = env.reset()
        for t in range(500):
            env.render()
            action = env.action_space.sample()
            observation, reward, done, info = env.step(action)
            if done:
                print("Episode finished after {} timesteps".format(t + 1))
                break
"""
return REGISTERED_ENVS[env_name](*args, **kwargs)
TypeError: __init__() got an unexpected keyword argument 'gripper_type'
"""

During my debug, I found that these parameters are passed into the env_name function by base.py as a dict 'kwargs', so why does it report an error?

Is it possible to add a stable selection of gripper to demo_control.py

cremebrule commented 3 years ago

Hi @kaixindelele ,

You need to specify gripper_types, plural, as the keyword arg. Your first case failed because you have gripper_type