Applying torque control makes object fly away from the secene

Post Reply
m_kramar
Posts: 1
Joined: Sat May 23, 2020 1:08 am

Applying torque control makes object fly away from the secene

Post by m_kramar »

So I grabbed latest code from https://github.com/bulletphysics/pybullet_robots
I modified laikago.py example to the following, I'm only controlling one joint using torque
Strangely enough poor robot flies away from the scene!
There are two ways to fix it: either decrease simulation time step (line 10) or change torque value to 60 (line 33).
Any ideas what am I doing wrong?

Image

Code: Select all

import pybullet as p
import time
import os

os.chdir(os.path.dirname(os.path.abspath(__file__)))

p.connect(p.GUI)
plane = p.loadURDF("data/plane.urdf")
p.setGravity(0,0,-9.8)
timeStep = 1./300 # HERE!!! changing it to 1./400 fixes the problem
p.setTimeStep(timeStep)
urdfFlags = p.URDF_USE_SELF_COLLISION
quadruped = p.loadURDF("laikago/laikago_toes.urdf",[0,0,.5],[0,0.5,0.5,0], flags = urdfFlags,useFixedBase=False)

#enable collision between lower legs (2,5,8 and 11)
lower_legs = [2,5,8,11]
for l0 in lower_legs:
	for l1 in lower_legs:
		if (l1>l0):
			p.setCollisionFilterPair(quadruped, quadruped, l0, l1, 1)

#set damping

for j in range (p.getNumJoints(quadruped)):
		p.changeDynamics(quadruped, j, linearDamping=0, angularDamping=100)
		p.setJointMotorControl2(quadruped, j, p.VELOCITY_CONTROL, force=0)
		
#run the simulation

p.setRealTimeSimulation(0)

for i in range (1000):	
	p.setJointMotorControl2(quadruped, 13, p.TORQUE_CONTROL, force=62) # HERE!!! changing it to force=60 fixes the problem
	p.stepSimulation()
	time.sleep(timeStep)

orange_juice
Posts: 2
Joined: Mon May 30, 2022 2:28 pm

Re: Applying torque control makes object fly away from the secene

Post by orange_juice »

Hi, I met the same problem. But changing time steps didn't help. Did you solved this problem?
Post Reply