@@ -56,6 +56,7 @@ def __init__(self, blackboard, dsd, parameters):
5656 """Go to an absolute position on the field"""
5757 super ().__init__ (blackboard , dsd , parameters )
5858 self .point = float (parameters .get ("x" , 0 )), float (parameters .get ("y" , 0 )), float (parameters .get ("t" , 0 ))
59+ self .blocking = parameters .get ("blocking" , True )
5960
6061 def perform (self , reevaluate = False ):
6162 pose_msg = PoseStamped ()
@@ -64,11 +65,26 @@ def perform(self, reevaluate=False):
6465
6566 pose_msg .pose .position .x = self .point [0 ]
6667 pose_msg .pose .position .y = self .point [1 ]
67- pose_msg .pose .position .z = 0
68+ pose_msg .pose .position .z = 0.0
6869 pose_msg .pose .orientation = quat_from_yaw (math .radians (self .point [2 ]))
6970
7071 self .blackboard .pathfinding .publish (pose_msg )
7172
73+ if not self .blocking :
74+ self .pop ()
75+
76+
77+ class GoToAbsolutePositionFieldFraction (GoToAbsolutePosition ):
78+ def __init__ (self , blackboard , dsd , parameters ):
79+ """Go to an absolute position of the field, specified by the fraction of the field size"""
80+ super ().__init__ (blackboard , dsd , parameters )
81+ point = float (parameters .get ("x" , 0 )), float (parameters .get ("y" , 0 )), float (parameters .get ("t" , 0 ))
82+ self .point = (
83+ point [0 ] * self .blackboard .world_model .field_length / 2 ,
84+ point [1 ] * self .blackboard .world_model .field_width / 2 ,
85+ self .point [2 ],
86+ )
87+
7288
7389class GoToOwnGoal (GoToAbsolutePosition ):
7490 def __init__ (self , blackboard , dsd , parameters ):
@@ -77,7 +93,7 @@ def __init__(self, blackboard, dsd, parameters):
7793 self .point = (
7894 self .blackboard .world_model .get_map_based_own_goal_center_xy ()[0 ],
7995 self .blackboard .world_model .get_map_based_own_goal_center_xy ()[1 ],
80- parameters ,
96+ self . point [ 2 ] ,
8197 )
8298
8399
@@ -88,12 +104,12 @@ def __init__(self, blackboard, dsd, parameters):
88104 self .point = (
89105 self .blackboard .world_model .get_map_based_opp_goal_center_xy ()[0 ],
90106 self .blackboard .world_model .get_map_based_opp_goal_center_xy ()[1 ],
91- parameters ,
107+ self . point [ 2 ] ,
92108 )
93109
94110
95111class GoToCenterpoint (GoToAbsolutePosition ):
96112 def __init__ (self , blackboard , dsd , parameters ):
97113 """Go to the center of the field and look towards the enemy goal"""
98114 super ().__init__ (blackboard , dsd , parameters )
99- self .point = 0 , 0 , 0
115+ self .point = 0.0 , 0.0 , 0. 0
0 commit comments