Example #1
0
def test_get_base_position():
    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])
    base_position = pybullet.get_base_position("my_box")
    pybullet.close()
    assert np.allclose(base_position, np.zeros(3), atol=1e-7)
Example #2
0
def test_set_base_pose():
    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.set_base_pose("my_box", [1.0, 1.0, 1.0],
                           [0.707, -0.02, 0.02, 0.707])
    base_position = pybullet.get_base_position("my_box")
    base_orientation = pybullet.get_base_orientation("my_box")
    pybullet.close()
    assert np.allclose(base_position, [1.0, 1.0, 1.0], atol=1e-3)
    assert np.allclose(base_orientation, [0.707, -0.02, 0.02, 0.707],
                       atol=1e-3)