Skip to content
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

Reset detection time in referee_pose_detection_filter #1333

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 14 additions & 2 deletions crates/control/src/referee_pose_detection_filter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,10 @@ use serde::{Deserialize, Serialize};
use context_attribute::context;
use framework::{AdditionalOutput, MainOutput, PerceptionInput};
use hardware::NetworkInterface;
use spl_network_messages::{HulkMessage, PlayerNumber, VisualRefereeMessage};
use spl_network_messages::{GameState, HulkMessage, PlayerNumber, VisualRefereeMessage};
use types::{
cycle_time::CycleTime,
game_controller_state::GameControllerState,
messages::{IncomingMessage, OutgoingMessage},
players::Players,
pose_detection::VisualRefereeState,
Expand Down Expand Up @@ -41,7 +42,7 @@ pub struct CycleContext {
network_message: PerceptionInput<Option<IncomingMessage>, "SplNetwork", "filtered_message?">,

cycle_time: Input<CycleTime, "cycle_time">,

game_controller_state: Input<Option<GameControllerState>, "game_controller_state?">,
initial_message_grace_period:
Parameter<Duration, "referee_pose_detection_filter.initial_message_grace_period">,
minimum_above_head_arms_detections:
Expand Down Expand Up @@ -85,6 +86,17 @@ impl RefereePoseDetectionFilter {
let (is_referee_ready_pose_detected, did_detect_any_referee_this_cycle) =
self.update(&context)?;

let is_standby = matches!(
context.game_controller_state,
Some(GameControllerState {
game_state: GameState::Standby,
..
})
);
if !is_standby {
self.detection_times = Default::default();
}

let majority_vote_is_referee_ready_pose_detected = decide(
self.detection_times,
cycle_start_time,
Expand Down