-
Notifications
You must be signed in to change notification settings - Fork 56
Kick in kicking team detection #1646
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
02fbf70
to
f24baba
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
review not yet complete
crates/bevyhavior_simulator/src/bin/visual_referee_free_kick_behavior.rs
Outdated
Show resolved
Hide resolved
crates/spl_network_messages/src/game_controller_state_message.rs
Outdated
Show resolved
Hide resolved
3eb1e77
to
8788ae5
Compare
6fbfb8d
to
a165dd4
Compare
crates/control/src/behavior/node.rs
Outdated
.filtered_game_controller_state | ||
.clone() | ||
.is_some_and(|filtered_game_controller_state| { | ||
is_free_kick(filtered_game_controller_state, world_state.clone()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no clone please
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
global_field_side: if message.hulks_team_is_home_after_coin_toss { | ||
GlobalFieldSide::Home | ||
} else { | ||
GlobalFieldSide::Away | ||
}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TODO: check correctness of hulks_team_is_home_after_coin_toss (second half)
.truncate(*context.referee_pose_queue_length); | ||
|
||
let (own_detected_kicking_team, number_of_detections) = | ||
most_detections(self.detected_free_kick_detections_queue.clone().into()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
use references here
.iter() | ||
.cloned() | ||
.filter(|kicking_team| *kicking_team == Team::Hulks) | ||
.collect(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
use .count()
instead of .collect().len()
.collect(); | ||
let own_detections_opponent: Vec<Team> = detections | ||
.iter() | ||
.cloned() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
prefer copied
here
match (global_field_side, free_kick_signal_pose) { | ||
( | ||
GlobalFieldSide::Home, | ||
Some(PoseKind::FreeKick { | ||
global_field_side: GlobalFieldSide::Away, | ||
}), | ||
) => Some(Team::Hulks), | ||
( | ||
GlobalFieldSide::Home, | ||
Some(PoseKind::FreeKick { | ||
global_field_side: GlobalFieldSide::Home, | ||
}), | ||
) => Some(Team::Opponent), | ||
( | ||
GlobalFieldSide::Away, | ||
Some(PoseKind::FreeKick { | ||
global_field_side: GlobalFieldSide::Away, | ||
}), | ||
) => Some(Team::Opponent), | ||
( | ||
GlobalFieldSide::Away, | ||
Some(PoseKind::FreeKick { | ||
global_field_side: GlobalFieldSide::Home, | ||
}), | ||
) => Some(Team::Hulks), | ||
_ => None, | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
match (global_field_side, free_kick_signal_pose) { | |
( | |
GlobalFieldSide::Home, | |
Some(PoseKind::FreeKick { | |
global_field_side: GlobalFieldSide::Away, | |
}), | |
) => Some(Team::Hulks), | |
( | |
GlobalFieldSide::Home, | |
Some(PoseKind::FreeKick { | |
global_field_side: GlobalFieldSide::Home, | |
}), | |
) => Some(Team::Opponent), | |
( | |
GlobalFieldSide::Away, | |
Some(PoseKind::FreeKick { | |
global_field_side: GlobalFieldSide::Away, | |
}), | |
) => Some(Team::Opponent), | |
( | |
GlobalFieldSide::Away, | |
Some(PoseKind::FreeKick { | |
global_field_side: GlobalFieldSide::Home, | |
}), | |
) => Some(Team::Hulks), | |
_ => None, | |
} | |
free_kick_signal_pose.and_then(|a| if a.global_field_side == global_field_side { Team::Opponent } else { Team::Hulks }) |
05ec27b
to
82beb18
Compare
8d077e2
to
accc70a
Compare
74339cf
to
57c816e
Compare
`LookAtReferee` during free kicks Detect `FreeKickPose` `PoseKind` Filter detected `FreeKickPose` Led status feedback for visual referee free kick detections Fix parameter import in `FreeKickSignalFilter` Make clippy happy Add fallback `Action` after `Action` `LookAtReferee` Co-authored-by: MaikRe <[email protected]> Always produce `MotionCommand` in `LookAtReferee` Co-authored-by: MaikRe <[email protected]> Fix `MotionCommand` matching Co-authored-by: MaikRe <[email protected]> Add scenario for visual referee free kick behavior Co-authored-by: MaikRe <[email protected]> Only add `Option<Team>` where necessary Reset `ReadySignalDetectionFilter` outside of `Standby` Reset `FreeKickSignalFilter` outside of `KickIn` and `PushingFreeKick` Freeze role assignment during free kick detection Add full image pose detection Let two searcher look at referee during free kicks Lower `ImageRegion::Bottom` y pixel target Address review comments Fix scenario to updated behavior and renaming Better free kick pose interpretation Only draw pose detection dead zone overlay in `Standby` Formatting Remove `target` from `HeadMotion::LookAtReferee` Refactor `initial.rs` Address review comments II Only keep role for relevant roles during free kicks Throw error in path deserialize `Option<T>` if its `None` Produce correct `head_yaw` for `LookAtReferee` Change `hulks_team_is_home_after_coin_toss` to `GlobalFieldSide` Change default `expected_referee_position` to center circle Dequadruplicate free kick behavior Dont copy world state Address review comments III
57c816e
to
831eaa7
Compare
Why? What?
The rule update for the 2025 season introduces a change to the set play of free kicks. Instead of sending the kicking team in the game controller message during all free kicks, now, during
CornerKick
,GoalKick
,KickIn
,PenaltyKick
andPushingFreeKick
no kicking team will be sent in the game controller message. Instead, the head referee will give a visual signal to indicate the direction of play for the kicking team. This means a signal in the direction of the goal of the HULKs indicates that the Opponent is the kicking team. This signal can be seen below:This expands our current visual referee implementation to now also detect this free kick visual referee signal.
We only try to detect the visual referee signal in
KickIn
since thekicking_team
duringCornerKick
,GoalKick
, andPenaltyKick
can be deduced from the current ball position and the teamsGlobalFieldSide
, i.e. whether their are home or away andPushingFreeKick
can be deduced by looking at the changed penalties. DuringKickIn
whenHome
theDefenderRight
andMidfielderRight
should look at the referee and do the detection. WhenAway
, this is done byDefenderLeft
andMidfielderLeft
. On both sides the first two non-penalized Searchers that are not the keeper also look at the referee, for the case, that both the currently detecting roles areSearcher
.Depends on #1782
Fixes #1476
ToDo / Known Issues
Ideas for Next Iterations (Not This PR)
How to Test
KickIn