softbankrobotics-research / qibullet

Bullet simulation for SoftBank Robotics robots
Apache License 2.0
141 stars 38 forks source link

Spawning objects in the world #36

Closed wagenaartje closed 4 years ago

wagenaartje commented 4 years ago

First of all, thank you for the great work. This is exactly what I needed for a long time.

I would like to spawn objects (e.g. a table and a cube as in your example) into the world, but I could not find how to do this in the documentation. Could you point me to some documentation that explains how to do this?

issue-label-bot[bot] commented 4 years ago

Issue-Label Bot is automatically applying the label question to this issue, with a confidence of 0.75. Please mark this comment with :thumbsup: or :thumbsdown: to give our bot feedback!

Links: app homepage, dashboard and code for this bot.

wagenaartje commented 4 years ago

I managed to figure it out using one of the examples provided: Pepper_lasers.py. For example, to spawn a table:

pybullet.setAdditionalSearchPath(pybullet_data.getDataPath())
tableId = pybullet.loadURDF("table/table.urdf",basePosition=[1, 0, 0], globalScaling = 1.0,physicsClientId=client)

Makes sure to have imported the necessary libraries:

import pybullet
import pybullet_data
mbusy commented 4 years ago

You're welcome! You figured it out, currently you have to call the pyBullet API to spawn extra objects in the simulation (you can also use the loadSDF and loadMJCF methods, see the pyBullet documentation). You can find another example in the robot_ros_test example