Skip to content

add agressive and defensive ready positions depending on robot availability - #2942

Open
JackyBloxx wants to merge 2 commits into
HULKs:mainfrom
JackyBloxx:better_ready_poses
Open

JackyBloxx wants to merge 2 commits into
HULKs:mainfrom
JackyBloxx:better_ready_poses

Conversation

@JackyBloxx

Copy link
Copy Markdown
Contributor

Why? What?

Currently every Robot number has fixed ready pose the problem: if there is no player with the number 3 there is no Robot to take the kickoff.
Whith this pr we now have a agressive and devensive player positioning and they replace each other if for example number 1,2 and 3 are on the field and 3 i penalized then in the next ready phase 2 would walk up to the kickoff position

Ideas for Next Iterations (Not This PR)

idea for the next iteration is that we have different ready poses for different number of player and not only a list where they fille each other spot up from top to bottom

How to Test

Test with 3 players how they walk in in ready if we have kickoff and not and with only player 1 and 2
player 2 should walk up to the kickoff position

@JackyBloxx JackyBloxx changed the title add agressive and devensive ready positions depending on robot avalability add agressive and defensive ready positions depending on robot availability Oct 4, 2026
@JackyBloxx
JackyBloxx enabled auto-merge October 4, 2026 11:50
},
goalkeeper_pose: { position: [-4.2, 0.0], rotation: 0.0 },
striker_pose: { position: [-0.6, 0.0], rotation: 0.0 },
// Remaining players fill these support slots in descending player-number order.

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.

Why are these comments different from the ones in the code?

Comment on lines -109 to +156
While playing, behavior periodically creates a State message. It contains the
player number, the robot pose, and the observed ball position and age when a
ball is available. A message is sent only when the robot has a field pose, the
send interval has elapsed, and the remaining game message budget is high
enough.
During Playing, behavior periodically creates a State message. It
contains the player number, the robot pose, and the observed ball position and
age when a ball is available. A message is sent only when the robot has a field
pose, the send interval has elapsed, and the remaining game message budget is
high enough.

The interval is configured by `network.hsl_playing_state_message_send_interval`
(300 ms by default). Received teammate states expire after
`player_states_receiver.playing_maximum_age` (one second).

Ready formation assignment uses the GameController lineup and sends no team
State messages. GameController return messages are sent independently during
Ready and the other states.

Received teammate states provide the poses used for closest-to-ball selection
and supporter positioning. Team communication can be absent or delayed, so the
tree retains branches for simple operation, the last active robot, and missing
ball information.
and supporter positioning during Playing. Team communication can be absent or
delayed, so the tree retains branches for simple operation, the last active
robot, and missing ball information.

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.

One sentence per line please.

Comment on lines -109 to +143
While playing, behavior periodically creates a State message. It contains the
player number, the robot pose, and the observed ball position and age when a
ball is available. A message is sent only when the robot has a field pose, the
send interval has elapsed, and the remaining game message budget is high
enough.
During Playing, behavior periodically creates a State message. It
contains the player number, the robot pose, and the observed ball position and
age when a ball is available. A message is sent only when the robot has a field
pose, the send interval has elapsed, and the remaining game message budget is
high enough.

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.

Why this change?

## Ready Formations

Ready uses static poses from `behavior_node.kickoff`, expressed in field
coordinates (meters, with the own goal at negative x) and rotations in radians.

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.

Specifying these units and coordinate frames here is redundant. We use these everywhere.

- On opponent or unknown kickoff, all field players fill `defensive_positions`
in the same order.

The GameController's unpenalized lineup determines the active players.

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 GameController's lineup"?
what?

Comment on lines +216 to +218
let Some(ground_to_field) = blackboard.world_state.robot.ground_to_field else {
return Status::Failure;
};

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.

Suggested change
let Some(ground_to_field) = blackboard.world_state.robot.ground_to_field else {
return Status::Failure;
};
let ground_to_field = blackboard.world_state.robot.ground_to_field.ok_or(Status::Failure)?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

the function returns a Status and not a option of a status that is because i wrote it like that

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.

But why? Try exists for a reason.

Comment on lines +219 to +225
let Some(kickoff_pose) = select_kickoff_pose(
&blackboard.world_state,
blackboard.parameters.goalkeeper.player_number,
&blackboard.parameters.kickoff,
) else {
return Status::Failure;
};

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.

Suggested change
let Some(kickoff_pose) = select_kickoff_pose(
&blackboard.world_state,
blackboard.parameters.goalkeeper.player_number,
&blackboard.parameters.kickoff,
) else {
return Status::Failure;
};
let kickoff_pose = select_kickoff_pose(
&blackboard.world_state,
blackboard.parameters.goalkeeper.player_number,
&blackboard.parameters.kickoff,
)?;

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

the function returns a Status and not a option of a status that is because i wrote it like that

let kickoff_pose_in_field =
Pose2::from_parts(target_position, Orientation2::new(standard_pose.rotation));
fn select_kickoff_pose(
world_state: &WorldState,

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.

This is only used to short-circuit if we are penalized. Do that in the outer function pleasel.
Then you can drop the Option in the return type.

Comment thread crates/nodes/behavior_node/src/walk.rs
kickoff_pose.position,
Orientation2::new(kickoff_pose.rotation),
);
let walk_and_stand = blackboard.parameters.walking.walk_and_stand;

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 are already in a "walk and stand" context. Calling this variable "walk and stand" is not useful.
Please call it something with "parameters".

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Status: Review

Development

Successfully merging this pull request may close these issues.

2 participants