Skip to content

Commit 8788ae5

Browse files
committed
Only draw pose detection overlay in Standby
1 parent a315503 commit 8788ae5

File tree

1 file changed

+17
-3
lines changed

1 file changed

+17
-3
lines changed

tools/twix/src/panels/image/overlays/pose_detection.rs

+17-3
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,12 @@ use color_eyre::Result;
44
use coordinate_systems::Pixel;
55
use eframe::egui::{Align2, Color32, FontId, Stroke};
66
use linear_algebra::point;
7-
use types::pose_detection::{
8-
HumanPose, Keypoint, OVERALL_KEYPOINT_INDEX_MASK, VISUAL_REFEREE_KEYPOINT_INDEX_MASK,
7+
use types::{
8+
filtered_game_controller_state::FilteredGameControllerState,
9+
filtered_game_state::FilteredGameState,
10+
pose_detection::{
11+
HumanPose, Keypoint, OVERALL_KEYPOINT_INDEX_MASK, VISUAL_REFEREE_KEYPOINT_INDEX_MASK,
12+
},
913
};
1014

1115
use crate::{
@@ -41,6 +45,7 @@ const DETECTION_IMAGE_START_X: f32 = (IMAGE_WIDTH - DETECTION_IMAGE_WIDTH) / 2.0
4145
pub struct PoseDetection {
4246
accepted_human_poses: BufferHandle<Vec<HumanPose>>,
4347
rejected_human_poses: BufferHandle<Vec<HumanPose>>,
48+
filtered_game_controller_state: BufferHandle<Option<FilteredGameControllerState>>,
4449
}
4550

4651
impl Overlay for PoseDetection {
@@ -55,9 +60,12 @@ impl Overlay for PoseDetection {
5560
nao.subscribe_value(format!("{cycler}.main_outputs.accepted_human_poses"));
5661
let rejected_human_poses =
5762
nao.subscribe_value(format!("{cycler}.main_outputs.rejected_human_poses"));
63+
let filtered_game_controller_state =
64+
nao.subscribe_value("Control.main_outputs.filtered_game_controller_state".to_string());
5865
Self {
5966
accepted_human_poses,
6067
rejected_human_poses,
68+
filtered_game_controller_state,
6169
}
6270
}
6371

@@ -84,7 +92,13 @@ impl Overlay for PoseDetection {
8492
Color32::from_rgb(100, 100, 255),
8593
)?;
8694

87-
paint_detection_dead_zone(painter);
95+
if let Some(Some(FilteredGameControllerState {
96+
game_state: FilteredGameState::Standby,
97+
..
98+
})) = self.filtered_game_controller_state.get_last_value()?
99+
{
100+
paint_detection_dead_zone(painter);
101+
};
88102

89103
Ok(())
90104
}

0 commit comments

Comments
 (0)