# venv가 activate된 상태에서
$ cd SpotMicroJetson/Simulation/pybullet_tutorial
$ pip install pybullet
$ python pybullet_simplecar.py
car = p.loadURDF('simplecar.urdf', [0, 0, 0.1])
number_of_joints = p.getNumJoints(car)
for joint_number in range(number_of_joints):
# This prints out all the information returned by getJointInfo().
# Try it out
info = p.getJointInfo(car, joint_number)
print(info[0], ": ", info[1])
plane = p.loadURDF('plane.urdf')
wheel_indices = [1, 3, 4, 5]
hinge_indices = [0, 2]
while True:
user_angle = p.readUserDebugParameter(angle)
user_throttle = p.readUserDebugParameter(throttle)
for joint_index in wheel_indices:
# This allows us to change the velocity, position,
# or apply a torque to a joint.
# This is the main method used to control robots.
# It takes both a robot ID and a joint ID
p.setJointMotorControl2(car, joint_index,
p.VELOCITY_CONTROL,
targetVelocity=user_throttle)
for joint_index in hinge_indices:
p.setJointMotorControl2(car, joint_index,
p.POSITION_CONTROL,
targetPosition=user_angle)
p.stepSimulation()
p.disconnect(physicsClient)
p.readUserDebugParameter
을 통해 시뮬레이션 실행 도중 손쉽게 매개변수를 바꿀 수 있다.How to create new environments for Gym