11from __future__ import annotations
22
3- from proto .import_all_protos import *
3+ import proto .import_all_protos as protos
44import software .python_bindings as tbots_cpp
55import numpy
66import math
@@ -13,7 +13,7 @@ def create_world_state(
1313 ball_velocity : tbots_cpp .Vector ,
1414 blue_robot_orientations : list [tbots_cpp .Angle ] = [],
1515 blue_robot_velocities : list [tbots_cpp .Vector ] = [],
16- ) -> WorldState :
16+ ) -> protos . WorldState :
1717 """Initializes the world from a list of robot locations and ball location/velocity.
1818
1919 NOTE: (index is robot id)
@@ -25,17 +25,17 @@ def create_world_state(
2525 :param blue_robot_orientations: A list of blue robots orientations
2626 :param blue_robot_velocities: A list of blue robots velocities
2727 """
28- world_state = WorldState ()
28+ world_state = protos . WorldState ()
2929
3030 if yellow_robot_locations :
31- yellow_robot_states = RobotStates ()
31+ yellow_robot_states = protos . RobotStates ()
3232 for robot_id , robot_location in enumerate (yellow_robot_locations ):
3333 yellow_robot_states .robot_states [robot_id ].CopyFrom (
34- RobotState (
35- global_position = Point (
34+ protos . RobotState (
35+ global_position = protos . Point (
3636 x_meters = robot_location .x (), y_meters = robot_location .y ()
3737 ),
38- global_orientation = Angle (radians = math .pi ),
38+ global_orientation = protos . Angle (radians = math .pi ),
3939 )
4040 )
4141 world_state .yellow_robots .CopyFrom (yellow_robot_states )
@@ -44,7 +44,7 @@ def create_world_state(
4444 orientation = tbots_cpp .Angle .zero ()
4545 velocity = tbots_cpp .Vector (0 , 0 )
4646
47- blue_robot_states = RobotStates ()
47+ blue_robot_states = protos . RobotStates ()
4848 for robot_id , robot_location in enumerate (blue_robot_locations ):
4949 try :
5050 orientation = blue_robot_orientations [robot_id ]
@@ -57,8 +57,8 @@ def create_world_state(
5757 pass
5858
5959 blue_robot_states .robot_states [robot_id ].CopyFrom (
60- RobotState (
61- global_position = Point (
60+ protos . RobotState (
61+ global_position = protos . Point (
6262 x_meters = robot_location .x (), y_meters = robot_location .y ()
6363 ),
6464 global_orientation = tbots_cpp .createAngleProto (orientation ),
@@ -68,11 +68,11 @@ def create_world_state(
6868 world_state .blue_robots .CopyFrom (blue_robot_states )
6969
7070 world_state .ball_state .CopyFrom (
71- BallState (
72- global_position = Point (
71+ protos . BallState (
72+ global_position = protos . Point (
7373 x_meters = ball_location .x (), y_meters = ball_location .y ()
7474 ),
75- global_velocity = Vector (
75+ global_velocity = protos . Vector (
7676 x_component_meters = ball_velocity .x (),
7777 y_component_meters = ball_velocity .y (),
7878 ),
@@ -82,7 +82,7 @@ def create_world_state(
8282 return world_state
8383
8484
85- def create_default_world_state (num_robots : int ) -> WorldState :
85+ def create_default_world_state (num_robots : int ) -> protos . WorldState :
8686 """Create a WorldState proto with num_robots yellow and blue robots evenly spaced in two parallel lines on the field.
8787
8888 :param num_robots: Number of robots for the yellow and blue teams
0 commit comments