Exemplo n.º 1
0
 def _put_in_world_referential(orientation: float, cmd: Pose) -> Pose:
     if config['GAME']['on_negative_side']:
         cmd.position = rotate(cmd.position, -np.pi - orientation)
         cmd.x *= -1
         cmd.orientation *= -1
     else:
         cmd.position = rotate(cmd.position, orientation)
     return cmd
Exemplo n.º 2
0
 def _put_in_robots_referential(robot: Robot, cmd: Pose) -> Pose:
     if config['GAME']['on_negative_side']:
         cmd.x *= -1
         cmd.orientation *= -1
         cmd.position = rotate(cmd.position, np.pi + robot.orientation)
     else:
         cmd.position = rotate(cmd.position, -robot.orientation)
     return cmd
Exemplo n.º 3
0
def test_rotate_identity():
    assert rotate(A_POS, A_POS_ANGLE) is not A_POS
Exemplo n.º 4
0
def test_rotate_by_negative_angle():
    assert rotate(A_POS, A_NEG_ANGLE) == A_POS_ROTATED_BY_A_NEG_ANGLE
Exemplo n.º 5
0
def test_rotate_return_type():
    assert isinstance(rotate(A_POS, A_POS_ANGLE), Position)
Exemplo n.º 6
0
def test_rotate_by_positive_angle():
    assert rotate(A_POS, A_POS_ANGLE) == A_POS_ROTATED_BY_A_POS_ANGLE
Exemplo n.º 7
0
def test_rotate_identity():
    assert rotate(A_POS, A_POS_ANGLE) is not A_POS
Exemplo n.º 8
0
def test_rotate_return_type():
    assert isinstance(rotate(A_POS, A_POS_ANGLE), Position)
Exemplo n.º 9
0
def test_rotate_by_negative_angle():
    assert rotate(A_POS, A_NEG_ANGLE) == A_POS_ROTATED_BY_A_NEG_ANGLE
Exemplo n.º 10
0
def test_rotate_by_positive_angle():
    assert rotate(A_POS, A_POS_ANGLE) == A_POS_ROTATED_BY_A_POS_ANGLE