I'm a beginner with Bullet and I'm trying to use it to detect collisions in an environment using industrial robots.
Everything seems to be working fine in small scale but if I try to scale up to the real size (the size of the models given by the robots constructor) I have problems with the forces to move the robots.
I'm receiving joint position updates from the simulation and for each update I'm using setJointMotorControl2() with the new position and then call stepSimulation() to move to it.
I tried to replicate the problem with a simple example. It moves one joint to a direction twice and then once in the opposite direction:
In this example everything is working fine but if I scale up the robot, let's say with globalScaling=5, the joint can't reach the target position anymore in a single stepSimulation(). I'm guessing that the force needs to be scaled up as well and if I do it it works... until the point where upping the force doesn't compensate the scaling anymore (the models I have for the robots are about 1000 times bigger than the Kuka model).
Code: Select all
import pybullet as p import time import pybullet_data p.connect(p.GUI) p.setAdditionalSearchPath(pybullet_data.getDataPath()) txId = p.loadURDF("kuka_iiwa/model.urdf", [0, 0, 0], globalScaling=1, useFixedBase=True) numJoints = p.getNumJoints(txId) p.setGravity(0, 0, -10) for i in range(numJoints): p.resetJointState(txId, i, 0) startTime = time.time() increment = 0.2 position = 0.0 direction = [1, 1, -1] max = len(direction) count = 0 while 1: currentTime = time.time() t = currentTime - startTime if t > 1.0: startTime = currentTime position += increment * direction[count % max] count += 1 for i in range(numJoints): p.setJointMotorControl2(bodyIndex=txId, jointIndex=i, controlMode=p.POSITION_CONTROL, targetPosition=position if i == 1 else 0, targetVelocity=0, force=500000, positionGain=1, velocityGain=1) p.stepSimulation() time.sleep(1/240) p.disconnect()
What is the best way to scale up ? Actually I'm doing 2 stepSimulation() for every movement but it hardly seems like a good solution. I have thought about scaling everything down but I have a lot of objects in my simulation and I would prefer to avoid it.