From 4548d01e6003a2b3fdd60333dd599d5972993517 Mon Sep 17 00:00:00 2001 From: phillip kammradt Date: Thu, 18 Jul 2024 19:10:35 +0200 Subject: [PATCH] reset detection time --- crates/control/src/referee_pose_detection_filter.rs | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/crates/control/src/referee_pose_detection_filter.rs b/crates/control/src/referee_pose_detection_filter.rs index 9d2027725d..8566fd7047 100644 --- a/crates/control/src/referee_pose_detection_filter.rs +++ b/crates/control/src/referee_pose_detection_filter.rs @@ -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, @@ -41,7 +42,7 @@ pub struct CycleContext { network_message: PerceptionInput, "SplNetwork", "filtered_message?">, cycle_time: Input, - + game_controller_state: Input, "game_controller_state?">, initial_message_grace_period: Parameter, minimum_above_head_arms_detections: @@ -85,6 +86,14 @@ 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.unwrap().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,