Example #1
0
def test_create_box():
    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.close()
Example #2
0
def test_set_spinning_friction():
    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_spinning_friction("my_box", 0, 0.5)
    pybullet.close()
Example #3
0
def test_get_base_angular_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])
    base_angular_velocity = pybullet.get_base_angular_velocity("my_box")
    pybullet.close()
    assert np.allclose(base_angular_velocity, [0.0, 0.0, 0.0], atol=1e-3)
Example #4
0
def test_get_base_rotation():
    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_rotation = pybullet.get_base_rotation("my_box")
    pybullet.close()
    assert np.allclose(base_rotation, [0.0, 0.0, 0.0], atol=1e-3)
Example #5
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)