IanYangChina / pybullet_multigoal_gym

Pybullet version of the multigoal robotics environment from OpenAI Gym
Apache License 2.0
82 stars 17 forks source link

AttributeError: 'KukaBlockStackEnv' object has no attribute 'grip_informed_goal' #4

Closed darshitajain closed 3 years ago

darshitajain commented 3 years ago

While running your code for block_stack task, I am getting this error. How to resolve this? error Thank you for your contribution to open source simulation environments.

IanYangChina commented 3 years ago

Hi, thanks for the report. This is a bug in the multi-step tasks in the previous version. I fixed it before. Please try the v1.1 release. If it doesn't work, please try the master version. Let me know if there are further issues :)

darshitajain commented 3 years ago

Hi, All this while I was using the wrong file to test the multi goal environment. When I used the gym_test.py file present inside the multigoal folder, there was no error when num_block was set to 4 and 5. When I tried for 2 blocks it was giving an error (please see the attached image). I want to create a 2 block-stacking environment for my task. Most of the robotics simulation environment available online are having Mujoco dependency that's why I am referring to your open source code. 1_1 1_2

IanYangChina commented 3 years ago

So I saw the code broke at the line env.set_sub_goal(4). This is because I have used a task decomposition scheme to create some subgoals for each of the tasks. When there are 2 blocks, in the push task (I assume), you don't have as many as 4 subgoals. So it throws an out-of-index bug.

The task decomposition codes are still under further testing (I'm doing it now). You can simply turn it off by setting the task_decomposition=False in the pmg.make_env(...) method. Or, you can play with it by comment out some of the set_sub_goal() function calls in the test script, and simply use the interaction codes only.

import os
import numpy as np
import time
import pybullet_multigoal_gym as pmg

num_episodes = 300
env = pmg.make_env(task='chest_push',
                   gripper='parallel_jaw',
                   num_block=2,
                   render=True,
                   visualize_target=True,
                   binary_reward=True,
                   joint_control=False,
                   task_decomposition=False,
                   abstract_demonstration=True,
                   max_episode_steps=10000,
                   image_observation=False,
                   use_curriculum=False,
                   num_goals_to_generate=num_episodes)

obs = env.reset(test=True)
time_done = False
while not time_done:
    time.sleep(0.1)
    action = env.action_space.sample()
    obs, reward, time_done, info = env.step(action)
    if time_done:
        env.reset(test=False)
        time_done = False
IanYangChina commented 3 years ago

BTW, in case you are interested, the task decomposition codes are in this script

IanYangChina commented 3 years ago

Sorry, I saw that you are using the block stack task. However, as I said before, the multigoal environment is still under further testing, basic functions are fine, but the task decomposition part is not fully confirmed yet. You are also encouraged to use the master repo rather than the previous release, as there have been lota changes since then. :) Thanks for your interests.

darshitajain commented 3 years ago

Thank you that was helpful!