Reputation: 11
I am supposed to create two spheres in PyBullet, one of which would be moved with a haptic feedback device. The device is connected to a computer in the lab and it's coordinates are sent through a topic. So the device is not physically on my PC, but the movement can be tracked real time via Subscribed node. I have the following code with two spheres. One should have no movement (the first one that appears), but the second one needs to move accordingly to the position and angle data acquired from the haptic device. What function may be useful for me here? I suppose there must be some function allowing to move an object through parameters or movements in 3 axes from code, not only with my mouse. Code (tried to be as minimal as possible):
import pybullet as p
import time
import pybullet_data
physicsClient = p.connect(p.GUI)
p.setAdditionalSearchPath(pybullet_data.getDataPath())
p.setGravity(0,0,-10)
planeId = p.loadURDF("plane.urdf")
cubeStartPos1 = [0,0,1]
cubeStartPos2 = [0,0.5,20]
boxId1 = p.loadURDF("sphere2red.urdf",cubeStartPos1)
boxId2 = p.loadURDF("sphere2red.urdf",cubeStartPos2)
for i in range (10000):
p.stepSimulation()
time.sleep(1./240.)
p.disconnect()
Basically they should interact, just to show the collisions happening.
Upvotes: 1
Views: 539