HorizonRobotics/SocialRobot

Unable to insert Model steadily

Closed this issue · 2 comments

Hi developers,

Thanks a lot for your efforts!

I am now using your code to implement my own environments, but I found that the function 'world.insertModelFromSdfString(string)' is not very stable. I ran the exactly same code several times and it succeeded sometimes while failed more often.

May I ask how you guys deal with this? Thanks a lot!

Best,
Wenhua

Jialn commented

You can try sleeping for a while waiting for gazebo server to complete the inserting operation. Or it may throw a 'px!=0' error when you are trying to interact with the model.

world.insertModelFile('model://coke_can')
world.step(10)
time.sleep(0.1)

Thanks a lot! It works perfectly.