rj_gameplay.gameplay_node
ROS entry point into Python-side gameplay library. Alternatively, where gameplay cedes control to cpp motion control/planning.
Contains TestPlaySelector, GameplayNode, and main() which spins GameplayNode and allows the PlaySelector to be changed between Test and other forms.
Module Contents
Classes
A node which subscribes to the world_state, game state, robot status, and |
Functions
|
Attributes
- rj_gameplay.gameplay_node.NUM_ROBOTS = 16
- class rj_gameplay.gameplay_node.GameplayNode(play_selector: stp.situation.IPlaySelector, world_state: stp.rc.WorldState | None = None)
Bases:
rclpy.node.Node
A node which subscribes to the world_state, game state, robot status, and field topics and converts the messages to python types.
- set_play_state(play_state: rj_msgs.msg.PlayState)
- set_match_state(match_state: rj_msgs.msg.MatchState)
- debug_callback()
Publishes the string that shows up in the behavior tree in the Soccer UI.
- create_partial_world_state(msg: GameplayNode.create_partial_world_state.msg) None
Creates a partial world state from a world state message
- create_partial_robots(msg: GameplayNode.create_partial_robots.msg) None
Creates the robot status which makes up part of the whole Robot class
- build_game_info() stp.rc.GameInfo | None
Create game info object from Game State message
- create_field(msg: GameplayNode.create_field.msg) None
Creates field object from Field Dimensions message
- create_goalie_id(msg: GameplayNode.create_goalie_id.msg) None
Set game_info’s goalie_id based on goalie msg
- update_world_state() None
returns: an updated world state
- gameplay_tick() None
Get situation, play from self.play_selector and update the currently running play if needed. Then, add field and game_info to world_state, and push global obstacles to motion planning.
- add_def_areas_to_obs(def_area_obstacles, game_info) None
Creates and publishes rectangles for the defense area in front of both goals.
The defense area, per the rules, is the box in front of each goal where only that team’s goalie can be in and touch the ball.
(Formerly referred to as “goal_zone_obstacles”.)
- add_goals_to_global_obs(global_obstacles, game_info)
Adds the physical walls that form each goal to global_obstacles.
- add_ball_to_global_obs(global_obstacles, game_info)
Adds circular no-fly zone around ball during stops or restarts, to comply with rulebook.
- tick_override_actions(world_state) None
- clear_override_actions() None
- update_test_play(parameter_list) rcl_interfaces.msg.SetParametersResult
Checks all gameplay node parameters to see if they are valid. Right now test_play is the only one. It should be a string in the plays set. If we use the local param server later, move this logic there.
- set_test_play_callback(test_play_msg: std_msgs.msg.String)
- shutdown() None
destroys node
- rj_gameplay.gameplay_node.main()