fix pybullet gym environments: InvertedDoublePendulumBulletEnv-v0,

InvertedPendulumBulletEnv-v0, InvertedPendulumSwingupBulletEnv-v0

motors were not disabled, extra gains applied etc.
This commit is contained in:
Erwin Coumans
2017-09-15 13:09:05 -07:00
parent c220513757
commit 3d7ee317db
2 changed files with 5 additions and 7 deletions

View File

@@ -53,6 +53,7 @@ class MJCFBasedRobot:
part_name = part_name.decode("utf8")
parts[part_name] = BodyPart(part_name, bodies, i, -1)
for j in range(p.getNumJoints(bodies[i])):
p.setJointMotorControl2(bodies[i],j,p.POSITION_CONTROL,positionGain=0.1,velocityGain=0.1,force=0)
_,joint_name,_,_,_,_,_,_,_,_,_,_,part_name = p.getJointInfo(bodies[i], j)
joint_name = joint_name.decode("utf8")
@@ -209,4 +210,4 @@ class Joint:
self.disable_motor()
def disable_motor(self):
p.setJointMotorControl2(self.bodies[self.bodyIndex],self.jointIndex,controlMode=p.VELOCITY_CONTROL, force=0)
p.setJointMotorControl2(self.bodies[self.bodyIndex],self.jointIndex,controlMode=p.POSITION_CONTROL, targetPosition=0, targetVelocity=0, positionGain=0.1, velocityGain=0.1, force=0)