ARISE-Initiative / robosuite

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

position of object does not change when I follow 'How to build a custom environment' #36

Closed yjc765 closed 4 years ago

yjc765 commented 5 years ago

Hello, thank you very much for the repo. When I followed the steps of 'How to build a custom environment', I found a problem. In the 'adding the object' part, the example code is

from robosuite.models.objects import BoxObject
from robosuite.utils.mjcf_utils import new_joint

object_mjcf = BoxObject()
world.merge_asset(object_mjcf)

obj = object_mjcf.get_collision(name="box_object", site=True)
obj.append(new_joint(name="box_object", type="free"))
obj.set("pos", [0, 0, 0.5])
world.worldbody.append(obj)

At this part I tried to change the position of the object, i.e change obj.set("pos", [0, 0, 0.5]) into other numbers, but the rendering result shows the position of the object remains unchanged (at the bottom of the table, shown in the picture attached). Has anybody also faced this problem and could you please give me some advice? Thank you very much! image

yjc765 commented 5 years ago

OK, I found the solution. It should be like this obj.set("pos", '0 0 0.5') Am I right?

yukezhu commented 4 years ago

@yjc765 yes, you should set the string values for mjcf