Skip to content

Better defence, goalie and supporter positions#925

Open
ayin21 wants to merge 68 commits into
mainfrom
feature/better_assignment
Open

Better defence, goalie and supporter positions#925
ayin21 wants to merge 68 commits into
mainfrom
feature/better_assignment

Conversation

@ayin21

@ayin21 ayin21 commented Jun 19, 2026

Copy link
Copy Markdown
Contributor

TBD, small proof of concept:

image

Checklist

  • Run pixi run build
  • Write documentation
  • Test on your machine
  • Test on the robot
  • Create issues for future work
  • Triage this PR and label it

@github-project-automation github-project-automation Bot moved this to 🆕 New in Software Jun 19, 2026
@ayin21 ayin21 marked this pull request as draft June 19, 2026 21:32
@ayin21 ayin21 moved this from 🆕 New to 🏗 In progress in Software Jun 19, 2026
@ayin21 ayin21 added enhancement New feature or request behavior labels Jun 19, 2026
@jaagut

jaagut commented Jun 20, 2026

Copy link
Copy Markdown
Member

How did you get this image?

@Flova

Flova commented Jun 20, 2026

Copy link
Copy Markdown
Member

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.

@cleWu03 cleWu03 requested a review from Flova June 23, 2026 07:19
width=parameters["field.size.y"],
goal_width=parameters["field.goal.width"],
)
self._params = Params()

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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")

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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()

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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:

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think this selection is necessary anymore. Everyone should just go to their placement position and stand there if it was reached.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Only the striker should search the ball. The others should go to the role position.

FIRST --> #StrikerRole
SECOND --> #SupporterRole
THIRD --> #DefensePositioning
YES --> $RankToBallWithGoalie

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The striker role needs to be reworked to position itself using the new striker placement.

@Flova

Flova commented Jun 23, 2026

Copy link
Copy Markdown
Member

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).

Flova and others added 11 commits June 29, 2026 16:18
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>
Flova and others added 26 commits July 3, 2026 18:16
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>
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>
…logic

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>
…better_assignment

Signed-off-by: Florian Vahl <florian@flova.de>
@Flova Flova marked this pull request as ready for review July 4, 2026 16:29
Signed-off-by: Florian Vahl <florian@flova.de>
@Flova Flova requested a review from MegaIng July 4, 2026 16:39
@Flova Flova moved this from 🏗 In progress to 👀 In review in Software Jul 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

behavior enhancement New feature or request

Projects

Status: 👀 In review

Development

Successfully merging this pull request may close these issues.

4 participants