stp.rc
This module contains data structures that are robocup specific, ie. Robot, Ball, WorldState
Module Contents
Classes
State of a robot. Pose: [x, y, theta]. Twist: [dx, dy, dtheta]. Properties are |
|
State of the ball. Properties are used to enforce that instances of this class |
|
Game period. |
|
State of the game. |
|
What kind of restart. |
|
Information about the field. |
|
State of the soccer game. Corresponds to a combination of the C++-side PlayState and MatchState |
|
Current state of the world. |
Attributes
- stp.rc.RobotId
- class stp.rc.Robot(robot_id: RobotId, is_ours: bool, pose: numpy.ndarray, twist: numpy.ndarray, visible: bool, has_ball_sense: bool, kicker_charged: bool, kicker_healthy: bool, lethal_fault: bool)
State of a robot. Pose: [x, y, theta]. Twist: [dx, dy, dtheta]. Properties are to enforce that instances of this class should not be mutated.
- __slots__ = ['__id', '__is_ours', '__pose', '__twist', '__visible', '__has_ball_sense', '__kicker_charged',...
- __id :RobotId
- __is_ours :bool
- __pose :numpy.ndarray
- __twist :numpy.ndarray
- __visible :bool
- __has_ball_sense :bool
- __kicker_charged :bool
- __kicker_healthy :bool
- __lethal_fault :bool
- __repr__(self) str
Return repr(self).
- __eq__(self, other) bool
Return self==value.
- __hash__(self) int
Return hash(self).
- property id(self) RobotId
- Returns
Id of the robot.
- property is_ours(self) bool
- Returns
True if the robot is our robot.
- property pose(self) numpy.ndarray
- Returns
Pose of the robot. [x, y, theta].
- property twist(self) numpy.ndarray
- Returns
Twist of the robot. [dx, dy, dtheta].
- property visible(self) bool
- Returns
True if the robot is visible
- property has_ball_sense(self) bool
- Returns
True if this robot has functioning ball sensors
- property kicker_charged(self) bool
- Returns
True if the kicker capacitors are charged
- property kicker_healthy(self) bool
- Returns
True if the kicker is healthy
- property lethal_fault(self) bool
- Returns
True if the robot has encounted a fault that will prevent further play, such as an FPGA or motor fault.
- class stp.rc.Ball(pos: numpy.ndarray, vel: numpy.ndarray, visible: bool)
State of the ball. Properties are used to enforce that instances of this class should not be mutated.
- __slots__ = ['__pos', '__vel', '__visible']
- __pos :numpy.ndarray
- __vel :numpy.ndarray
- __visible :bool
- __repr__(self) str
Return repr(self).
- property pos(self) numpy.ndarray
- Returns
Position of the ball. [x, y].
- property vel(self) numpy.ndarray
- Returns
Velocity of the ball. [dx, dy].
- property visible(self) bool
- Returns
True if the ball can currently be seen by the global vision system.
Note that with filtering or additional sensors like whiskers we may still know where the ball is located
- class stp.rc.GamePeriod
Bases:
enum.Enum
Game period.
- FIRST_HALF = 0
- HALF_TIME = 1
- SECOND_HALF = 2
- OVERTIME1 = 3
- OVERTIME2 = 4
- PENALTY_SHOOTOUT = 5
- class stp.rc.GameState
Bases:
enum.Enum
State of the game.
- HALT = 0
- STOP = 1
- SETUP = 2
- READY = 3
- PLAYING = 4
- PENALTY_PLAYING = 5
- class stp.rc.GameRestart
Bases:
enum.Enum
What kind of restart.
- NONE = 0
- KICKOFF = 1
- DIRECT = 2
- INDIRECT = 3
- PENALTY = 4
- PLACEMENT = 5
- class stp.rc.Field(length_m: float, width_m: float, border_m: float, line_width_m: float, goal_width_m: float, goal_depth_m: float, goal_height_m: float, def_area_short_dist_m: float, def_area_long_dist_m: float, center_radius_m: float, center_diameter_m: float, goal_flat_m: float, floor_length_m: float, floor_width_m: float)
Information about the field.
- __slots__ = ['__length_m', '__width_m', '__border_m', '__line_width_m', '__goal_width_m', '__goal_depth_m',...
- __length_m :float
- __width_m :float
- __border_m :float
- __line_width_m :float
- __goal_width_m :float
- __goal_depth_m :float
- __goal_height_m :float
- __def_area_short_dist_m :float
- __def_area_long_dist_m :float
- __center_radius_m :float
- __center_diameter_m :float
- __goal_flat_m :float
- __floor_length_m :float
- __floor_width_m :float
- __def_area_x_right_coord :float
- __def_area_x_left_coord :float
- __field_x_right_coord :float
- __field_x_left_coord :float
- property our_goal_loc(self) numpy.ndarray
Convenience function for getting our goal location :return: the location of our goal - its always (0,0)
- property center_field_loc(self) numpy.ndarray
Convenience function for getting the center field location :return: the location of the center of the field
- property their_goal_loc(self) numpy.ndarray
Convenience function for getting the opponents field location :return: the location of the opponents goal
- property our_defense_area_coordinates(self) List
Convenience function for getting our defense area locations :return: the list of points for our defense area locations
- property opp_defense_area_coordinates(self) List
Convenience function for getting oppenent defense area locations Note: each coordinate starts from top left and continues normal order :return: the list of points for opponent defense area locations
- property our_goal_post_coordinates(self) List
Convenience function for getting our goal post coordinates :return: the list of points for our goal post locations
- property their_goal_post_coordinates(self) List
Convenience function for getting their goal post coordinates :return: the list of points for their goal post locations
- property our_left_corner(self) numpy.ndarray
- Returns
the coords of the left corner of our side of the field
- property our_right_corner(self) numpy.ndarray
- Returns
the coords of the right corner of our side of the field
- property their_left_corner(self) numpy.ndarray
- Returns
the coords of the left corner of their side of the field
- property their_right_corner(self) numpy.ndarray
- Returns
the coords of the right corner of their side of the field
- property floor_width_m(self) float
- Returns
width of full field (including borders)
- property def_area_x_left_coord(self) float
- Returns
left x coordinate of the defense area
- property def_area_x_right_coord(self) float
- Returns
right x coordinate of the defense area
- property floor_length_m(self) float
- Returns
length of full field (including borders)
- property goal_flat_m(self) float
- Returns
check on this one
- property center_diameter_m(self) float
- Returns
returns the diameter of the center of the field
- property center_radius_m(self) float
- Returns
returns the radius of the center of the field
- property def_area_long_dist_m(self) float
- Returns
double check on this one
- property def_area_short_dist_m(self) float
- Returns
double check on this one
- property border_m(self) float
- Returns
The size of the border of the field
- property line_width_m(self) float
- Returns
The width of the lines of the field
- property length_m(self) float
- Returns
The length of the field in meters
- property width_m(self) float
- Returns
the width of the field in meters
- property goal_width_m(self) float
- Returns
the width of the goals in meters
- property goal_depth_m(self) float
- Returns
the depth of the goals in meters
- property goal_height_m(self) float
- Returns
the height of the goals in meters
- class stp.rc.GameInfo(period: GamePeriod, state: GameState, restart: GameRestart, our_restart: bool, ball_placement: numpy.array)
State of the soccer game. Corresponds to a combination of the C++-side PlayState and MatchState
- __slots__ = ['__period', '__state', '__restart', '__our_restart', '__ball_placement']
- __period :GamePeriod
- __state :GameState
- __restart :GameRestart
- __our_restart :bool
- __ball_placement :numpy.array
- property period(self) GamePeriod
- Returns
The game period
- property restart(self) GameRestart
- Returns
The game restart state
- property our_restart(self) bool
- Returns
True if it is our restart
- property their_restart(self) bool
- Returns
True if it is their restart
- is_stopped(self) bool
- Returns
True if play is stopped.
- is_ready(self) bool
- Returns
True if the field is waiting on a team to kick the ball in a restart.
- is_setup(self) bool
- Returns
True if the field is setting up for a penalty kick or kickoff.
- is_restart(self) bool
- Returns
True if there is a restart.
- is_kickoff(self) bool
- Returns
True if the restart is a kickoff.
- is_penalty(self) bool
- Returns
True if the restart is a penalty.
- is_direct(self) bool
- Returns
True if the restart is a direct kick.
- is_indirect(self) bool
- Returns
True if the restart is an indirect kick.
- is_free_placement(self) bool
- Returns
True if the restart is free placement.
- ball_placement(self) Optional[numpy.ndarray]
- Returns
True if the restart is free placement.
- class stp.rc.WorldState(our_robots: List[Robot], their_robots: List[Robot], ball: Ball, game_info: GameInfo, field: Field, goalie_id: int)
Current state of the world.
- __slots__ = ['__our_robots', '__their_robots', '__ball', '__game_info', '__field', '__goalie_id']
- __our_robots :List[Robot]
- __their_robots :List[Robot]
- __ball :Ball
- __game_info :GameInfo
- __field :Field
- __goalie_id :int
- property robots(self) List[Robot]
- Returns
A list of all robots (created by merging our_robots with their_robots)
- property goalie_id(self) int
- Returns
The goalie id (int)