add yapf style and apply yapf to format all Python files
This recreates pull request #2192
This commit is contained in:
@@ -10,7 +10,6 @@ p0.setAdditionalSearchPath(pybullet_data.getDataPath())
|
||||
p1 = bc.BulletClient(connection_mode=pybullet.DIRECT)
|
||||
p1.setAdditionalSearchPath(pybullet_data.getDataPath())
|
||||
|
||||
|
||||
#can also connect using different modes, GUI, SHARED_MEMORY, TCP, UDP, SHARED_MEMORY_SERVER, GUI_SERVER
|
||||
|
||||
husky = p1.loadURDF("husky/husky.urdf", flags=p0.URDF_USE_IMPLICIT_CYLINDER)
|
||||
@@ -22,36 +21,34 @@ ed1 = ed.UrdfEditor()
|
||||
ed1.initializeFromBulletBody(kuka, p0._client)
|
||||
#ed1.saveUrdf("combined.urdf")
|
||||
|
||||
|
||||
parentLinkIndex = 0
|
||||
|
||||
jointPivotXYZInParent = [0,0,0]
|
||||
jointPivotRPYInParent = [0,0,0]
|
||||
jointPivotXYZInParent = [0, 0, 0]
|
||||
jointPivotRPYInParent = [0, 0, 0]
|
||||
|
||||
jointPivotXYZInChild = [0, 0, 0]
|
||||
jointPivotRPYInChild = [0, 0, 0]
|
||||
|
||||
jointPivotXYZInChild = [0,0,0]
|
||||
jointPivotRPYInChild = [0,0,0]
|
||||
|
||||
newjoint = ed0.joinUrdf(ed1, parentLinkIndex , jointPivotXYZInParent, jointPivotRPYInParent, jointPivotXYZInChild, jointPivotRPYInChild, p0._client, p1._client)
|
||||
newjoint = ed0.joinUrdf(ed1, parentLinkIndex, jointPivotXYZInParent, jointPivotRPYInParent,
|
||||
jointPivotXYZInChild, jointPivotRPYInChild, p0._client, p1._client)
|
||||
newjoint.joint_type = p0.JOINT_FIXED
|
||||
|
||||
ed0.saveUrdf("combined.urdf")
|
||||
|
||||
print(p0._client)
|
||||
print(p1._client)
|
||||
print("p0.getNumBodies()=",p0.getNumBodies())
|
||||
print("p1.getNumBodies()=",p1.getNumBodies())
|
||||
print("p0.getNumBodies()=", p0.getNumBodies())
|
||||
print("p1.getNumBodies()=", p1.getNumBodies())
|
||||
|
||||
pgui = bc.BulletClient(connection_mode=pybullet.GUI)
|
||||
pgui.configureDebugVisualizer(pgui.COV_ENABLE_RENDERING, 0)
|
||||
|
||||
orn=[0,0,0,1]
|
||||
ed0.createMultiBody([0,0,0],orn, pgui._client)
|
||||
orn = [0, 0, 0, 1]
|
||||
ed0.createMultiBody([0, 0, 0], orn, pgui._client)
|
||||
pgui.setRealTimeSimulation(1)
|
||||
|
||||
pgui.configureDebugVisualizer(pgui.COV_ENABLE_RENDERING, 1)
|
||||
|
||||
|
||||
while (pgui.isConnected()):
|
||||
pgui.getCameraImage(320,200, renderer=pgui.ER_BULLET_HARDWARE_OPENGL)
|
||||
time.sleep(1./240.)
|
||||
pgui.getCameraImage(320, 200, renderer=pgui.ER_BULLET_HARDWARE_OPENGL)
|
||||
time.sleep(1. / 240.)
|
||||
|
||||
@@ -2,12 +2,10 @@ import pybullet as p
|
||||
p.connect(p.GUI)
|
||||
p.loadURDF("combined.urdf", useFixedBase=True)
|
||||
|
||||
|
||||
|
||||
#for j in range (p.getNumJoints(0)):
|
||||
# p.setJointMotorControl2(0,j,p.VELOCITY_CONTROL,targetVelocity=0.1)
|
||||
p.setRealTimeSimulation(1)
|
||||
while (p.isConnected()):
|
||||
p.getCameraImage(320,200)
|
||||
import time
|
||||
time.sleep(1./240.)
|
||||
p.getCameraImage(320, 200)
|
||||
import time
|
||||
time.sleep(1. / 240.)
|
||||
|
||||
@@ -6,7 +6,9 @@ import pybullet_data as pd
|
||||
import pybullet_utils.urdfEditor as ed
|
||||
import argparse
|
||||
parser = argparse.ArgumentParser(formatter_class=argparse.ArgumentDefaultsHelpFormatter)
|
||||
parser.add_argument('--mjcf', help='MuJoCo xml file to be converted to URDF', default='mjcf/humanoid.xml')
|
||||
parser.add_argument('--mjcf',
|
||||
help='MuJoCo xml file to be converted to URDF',
|
||||
default='mjcf/humanoid.xml')
|
||||
args = parser.parse_args()
|
||||
|
||||
p = bc.BulletClient()
|
||||
@@ -14,15 +16,15 @@ p.setAdditionalSearchPath(pd.getDataPath())
|
||||
objs = p.loadMJCF(args.mjcf, flags=p.URDF_USE_IMPLICIT_CYLINDER)
|
||||
|
||||
for o in objs:
|
||||
#print("o=",o, p.getBodyInfo(o), p.getNumJoints(o))
|
||||
humanoid = objs[o]
|
||||
ed0 = ed.UrdfEditor()
|
||||
ed0.initializeFromBulletBody(humanoid, p._client)
|
||||
robotName = str(p.getBodyInfo(o)[1],'utf-8')
|
||||
partName = str(p.getBodyInfo(o)[0], 'utf-8')
|
||||
|
||||
print("robotName=",robotName)
|
||||
print("partName=",partName)
|
||||
|
||||
saveVisuals=False
|
||||
ed0.saveUrdf(robotName+"_"+partName+".urdf", saveVisuals)
|
||||
#print("o=",o, p.getBodyInfo(o), p.getNumJoints(o))
|
||||
humanoid = objs[o]
|
||||
ed0 = ed.UrdfEditor()
|
||||
ed0.initializeFromBulletBody(humanoid, p._client)
|
||||
robotName = str(p.getBodyInfo(o)[1], 'utf-8')
|
||||
partName = str(p.getBodyInfo(o)[0], 'utf-8')
|
||||
|
||||
print("robotName=", robotName)
|
||||
print("partName=", partName)
|
||||
|
||||
saveVisuals = False
|
||||
ed0.saveUrdf(robotName + "_" + partName + ".urdf", saveVisuals)
|
||||
|
||||
@@ -15,6 +15,5 @@ p0.loadURDF("r2d2.urdf")
|
||||
p1.loadSDF("stadium.sdf")
|
||||
print(p0._client)
|
||||
print(p1._client)
|
||||
print("p0.getNumBodies()=",p0.getNumBodies())
|
||||
print("p1.getNumBodies()=",p1.getNumBodies())
|
||||
|
||||
print("p0.getNumBodies()=", p0.getNumBodies())
|
||||
print("p1.getNumBodies()=", p1.getNumBodies())
|
||||
|
||||
@@ -1,26 +1,28 @@
|
||||
import pybullet_data
|
||||
from pybullet_utils.arg_parser import ArgParser
|
||||
from pybullet_utils.logger import Logger
|
||||
from pybullet_utils.arg_parser import ArgParser
|
||||
from pybullet_utils.logger import Logger
|
||||
import sys
|
||||
|
||||
def build_arg_parser(args):
|
||||
arg_parser = ArgParser()
|
||||
arg_parser.load_args(args)
|
||||
|
||||
arg_file = arg_parser.parse_string('arg_file', '')
|
||||
if (arg_file != ''):
|
||||
path = pybullet_data.getDataPath()+"/args/"+arg_file
|
||||
succ = arg_parser.load_file(path)
|
||||
Logger.print2(arg_file)
|
||||
assert succ, Logger.print2('Failed to load args from: ' + arg_file)
|
||||
def build_arg_parser(args):
|
||||
arg_parser = ArgParser()
|
||||
arg_parser.load_args(args)
|
||||
|
||||
arg_file = arg_parser.parse_string('arg_file', '')
|
||||
if (arg_file != ''):
|
||||
path = pybullet_data.getDataPath() + "/args/" + arg_file
|
||||
succ = arg_parser.load_file(path)
|
||||
Logger.print2(arg_file)
|
||||
assert succ, Logger.print2('Failed to load args from: ' + arg_file)
|
||||
|
||||
return arg_parser
|
||||
|
||||
return arg_parser
|
||||
|
||||
args = sys.argv[1:]
|
||||
arg_parser = build_arg_parser(args)
|
||||
motion_file = arg_parser.parse_string("motion_file")
|
||||
print("motion_file=",motion_file)
|
||||
motion_file = arg_parser.parse_string("motion_file")
|
||||
print("motion_file=", motion_file)
|
||||
bodies = arg_parser.parse_ints("fall_contact_bodies")
|
||||
print("bodies=",bodies)
|
||||
print("bodies=", bodies)
|
||||
int_output_path = arg_parser.parse_string("int_output_path")
|
||||
print("int_output_path=",int_output_path)
|
||||
print("int_output_path=", int_output_path)
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
from pybullet_utils.logger import Logger
|
||||
logger = Logger()
|
||||
logger.configure_output_file("e:/mylog.txt")
|
||||
for i in range (10):
|
||||
logger.log_tabular("Iteration", 1)
|
||||
for i in range(10):
|
||||
logger.log_tabular("Iteration", 1)
|
||||
Logger.print2("hello world")
|
||||
|
||||
logger.print_tabular()
|
||||
logger.dump_tabular()
|
||||
logger.dump_tabular()
|
||||
|
||||
Reference in New Issue
Block a user