Better defence, goalie and supporter positions#925
Conversation
|
How did you get this image? |
|
I vibe coded a simple GUI to interactively test the function that generates the placement. This is the script I added in this pr. It is not ready yet. |
…ngle robot that plays as striker)
| width=parameters["field.size.y"], | ||
| goal_width=parameters["field.goal.width"], | ||
| ) | ||
| self._params = Params() |
There was a problem hiding this comment.
Ideally we want to load theses parameters from the behavior config file (or a separate one, as the current one is pretty large as it is).
|
|
||
| roles = [] | ||
| if n >= 1: | ||
| roles.append("striker") |
There was a problem hiding this comment.
We might want to use a proper enum instead of strings
|
|
||
| @cached_capsule_function | ||
| def get_formation_assignment(self) -> dict: | ||
| ballPose = self._blackboard.world_model.get_best_ball_point_stamped() |
There was a problem hiding this comment.
Maybe we should have separate functions for the team ball and "own ball" detection. Because we definitely want to use the team ball here.
| poses.append(data.robot_position.pose) | ||
| return poses | ||
|
|
||
| def quaternion_to_yaw(self, q) -> float: |
There was a problem hiding this comment.
Specify the quaternion notation xyzw vs wxyz and maybe move/check but it's utils for these functions.
| FIRST --> @ChangeAction + action:positioning, @LookAtFieldFeatures, @AvoidBallActive, @GoToDefensePosition + mode:freekick_first | ||
| SECOND --> @ChangeAction + action:positioning, @LookAtFieldFeatures, @AvoidBallActive, @GoToDefensePosition + mode:freekick_second | ||
| THIRD --> @ChangeAction + action:positioning, @LookAtFieldFeatures, @AvoidBallActive, @GoToDefensePosition | ||
| YES --> $RankToBallWithGoalie |
There was a problem hiding this comment.
I don't think this selection is necessary anymore. Everyone should just go to their placement position and stand there if it was reached.
There was a problem hiding this comment.
i will take a closer look there once we have discussed how to handle set play situations with the new positioning capsule, got a view ideas there
| @@ -110,16 +107,12 @@ $BallSeen | |||
There was a problem hiding this comment.
Only the striker should search the ball. The others should go to the role position.
| FIRST --> #StrikerRole | ||
| SECOND --> #SupporterRole | ||
| THIRD --> #DefensePositioning | ||
| YES --> $RankToBallWithGoalie |
There was a problem hiding this comment.
I think the only really useful destinction here is striker, supporter, defender, goalie (maybe). We can probably do the same placement strategy for the goalie and and defenders and we are not limited in the number of defenders that way.
There was a problem hiding this comment.
The striker needs special handling because it wants to kick if it reached its goal position. The supporter wants to track the ball if the striker is kicking and needs special handling for that and the others just go to their positions to stand in the way.
| SECOND --> #SupporterRole | ||
| THIRD --> #DefensePositioning | ||
| YES --> $RankToBallWithGoalie | ||
| STRIKER --> #StrikerRole |
There was a problem hiding this comment.
The striker role needs to be reworked to position itself using the new striker placement.
|
Also adapt the capsule/ gui so we can do headless tests of the placement function without the software stack. Currently the function is duplicated. Also probably some denouncing/hysteresis is needed. I would add it to the capsule as this needs to be global state. Just store if we have changed our role in the last x seconds and if did we want to stick with it. This prevents flickering behavior. The x can be randomly selected from a configurable range (0-1 sec for example). |
Signed-off-by: Florian Vahl <florian@flova.de>
Signed-off-by: Florian Vahl <florian@flova.de>
Signed-off-by: Florian Vahl <florian@flova.de>
Signed-off-by: Florian Vahl <florian@flova.de>
Signed-off-by: Florian Vahl <florian@flova.de>
Signed-off-by: Florian Vahl <florian@flova.de>
| poses.append(data.robot_position.pose) | ||
| return poses | ||
|
|
||
| def get_index_of_passive_player(self) -> int: |
There was a problem hiding this comment.
There can be multiple players that send a passive msg (either by accident or intentionally) and we need to handle it. Because we designed passive to be relatively independent of the specific behavior I could imagine situations with multiple passive robots and I would expect it to still work if I set two robots to passive. On addition to that we might need explicit handling for our own robots passive flag. I don't know if it is included here.
There was a problem hiding this comment.
Also the robots habe IDs. Index might be confusing and lead to people expecting it being continuous.
| SUPPORTER --> @ChangeAction + action:positioning, @LookAtFieldFeatures, @AvoidBallActive, @GoToDefensePosition | ||
| GOALIE --> @GoToGoaliePosition | ||
| ELSE --> @ChangeAction + action:positioning, @LookAtFieldFeatures, @AvoidBallActive, @GoToFormationPosition | ||
| DONE --> $ReachedAndAlignedToPathPlanningGoalPosition + threshold:0.2 + latch:true |
There was a problem hiding this comment.
We need to send at least one goal with a do once before we can check this. To simiplify things we could also modify goToFormationPostion to send a stop command if we are close enough in position and orientation (controlled by a parameter)
| #NormalBehavior | ||
| $SecondBallTouchAllowed | ||
| NO --> @SetNoSecondBallContactVariable + value:false + r:false, @LookAtFieldFeatures + r:false, @ChangeAction + action:passive + r:false, @AvoidBallActive + r:false, @GoToFormationPosition + blocking:true | ||
| NO --> $ReachedAndAlignedToPathPlanningGoalPosition + threshold:0.2 + latch:true |
| DEFENDER --> @LookAtFieldFeatures, @ChangeAction + action:positioning, @GoToFormationPosition | ||
| SUPPORTER --> #SupporterRole | ||
| ELSE --> @LookAtFieldFeatures, @ChangeAction + action:positioning, @GoToFormationPosition | ||
| ELSE --> $ReachedAndAlignedToPathPlanningGoalPosition + threshold:0.2 + latch:true |
| <geom name="head_pitch_link_collision0" class="collision" pos="0.026 0 0.055" type="box" size="0.05 0.055 0.0225"/> | ||
| <body name="camera_link" pos="0.048925 0.0053519 0.058472"> | ||
| <inertial pos="0.00963743 0.00075253 0.00058537" quat="0.70738 0.706786 0.00245222 0.00788061" mass="0.0584" diaginertia="7.26043e-05 7.249e-05 5.51563e-06"/> | ||
| <camera name="head_camera" focalpixel="362.6533508300781 362.6533508300781" resolution="672 376" sensorsize="672 376" pos="0.03 0.024 0.0" xyaxes="0.0 -1.0 0.0 0.5 0.0 0.866"/> |
Signed-off-by: Florian Vahl <florian@flova.de>
Signed-off-by: Florian Vahl <florian@flova.de>
Signed-off-by: Florian Vahl <florian@flova.de>
Signed-off-by: Florian Vahl <florian@flova.de>
Signed-off-by: Florian Vahl <florian@flova.de>
…ts_main into feature/better_assignment
Signed-off-by: Florian Vahl <florian@flova.de>
Signed-off-by: Florian Vahl <florian@flova.de>
Signed-off-by: Florian Vahl <florian@flova.de>
TBD, small proof of concept:
Checklist
pixi run build