【问题标题】:Applying torque control in PyByllet makes object fly away from the secene在 PyBullet 中应用扭矩控制使物体飞离场景
【发布时间】:2020-05-24 23:09:42
【问题描述】:

所以我从https://github.com/bulletphysics/pybullet_robots 获取了最新代码 我将 laikago.py 示例修改为以下内容,我只使用扭矩控制一个关节。 奇怪的是,可怜的机器人从现场飞走了:) 有两种方法可以修复它:减少仿真时间步长(第 10 行)或将扭矩值更改为 60(第 33 行)。

任何想法我做错了什么?

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)

【问题讨论】:

    标签: bulletphysics bullet


    【解决方案1】:

    我参加聚会有点晚了,但也许你还在寻找答案。原因在这里给出:https://pybullet.org/Bullet/phpBB3/viewtopic.php?t=12644 并添加了注释:https://docs.google.com/document/d/10sXEhzFRSnvFcl3XxNGhnD4N2SedqwdAvK3dsihxVUA/edit#heading=h.jxof6bt5vhut

    原因:“您需要先解锁/禁用默认速度/位置电机。[...] 否则,您的力/扭矩必须超过默认电机。” (见第一个链接)。

    修复做(相同的链接):

    pybullet.setJointMotorControl2(objUid, linkIndex, p.VELOCITY_CONTROL, force=0)
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-11-14
      相关资源
      最近更新 更多