def test_get_base_velocity(): from panda_gym.pybullet import PyBullet pybullet = PyBullet() pybullet.create_box("my_box", [0.5, 0.5, 0.5], 1.0, [0.0, 0.0, 0.0], [1.0, 0.0, 0.0, 1.0]) pybullet.step() base_velocity = pybullet.get_base_velocity("my_box") pybullet.close() assert np.allclose(base_velocity, [0.0, 0.0, -0.392], atol=1e-3)
def test_control_joints(): from panda_gym.pybullet import PyBullet pybullet = PyBullet() pybullet.loadURDF( body_name="panda", fileName="franka_panda/panda.urdf", basePosition=[0.0, 0.0, 0.0], useFixedBase=True, ) pybullet.control_joints("panda", [5], [0.3], [5.0]) pybullet.step()
def test_get_joint_angle(): from panda_gym.pybullet import PyBullet pybullet = PyBullet() pybullet.loadURDF( body_name="panda", fileName="franka_panda/panda.urdf", basePosition=[0.0, 0.0, 0.0], useFixedBase=True, ) pybullet.control_joints("panda", [5], [0.3], [5.0]) pybullet.step() joint_angle = pybullet.get_joint_angle("panda", 5) assert np.allclose(joint_angle, 0.063, atol=1e-3) pybullet.close()
def test_get_link_velocity(): from panda_gym.pybullet import PyBullet pybullet = PyBullet() pybullet.loadURDF( body_name="panda", fileName="franka_panda/panda.urdf", basePosition=[0.0, 0.0, 0.0], useFixedBase=True, ) pybullet.control_joints("panda", [5], [0.3], [5.0]) pybullet.step() link_velocity = pybullet.get_link_velocity("panda", 5) assert np.allclose(link_velocity, [-0.0068, 0.0000, 0.1186], atol=1e-3) pybullet.close()
def test_step(): from panda_gym.pybullet import PyBullet pybullet = PyBullet() pybullet.step() pybullet.close()