From 831e83e5890a1fab508e2d2eb0c885c9aa5361c3 Mon Sep 17 00:00:00 2001 From: Kenneth Yang Date: Sun, 22 Sep 2024 15:49:49 -0700 Subject: [PATCH] Prevent changing insertion while driving --- .../Scripts/UI/States/AutomationStackState.cs | 25 ++++++++++++++----- Assets/UI/Components/AutomationStack.uxml | 9 ++++--- 2 files changed, 24 insertions(+), 10 deletions(-) diff --git a/Assets/Scripts/UI/States/AutomationStackState.cs b/Assets/Scripts/UI/States/AutomationStackState.cs index fba25dd2..040fa325 100644 --- a/Assets/Scripts/UI/States/AutomationStackState.cs +++ b/Assets/Scripts/UI/States/AutomationStackState.cs @@ -39,12 +39,12 @@ public class AutomationStackState : ResettingScriptableObject private static bool IsPitchValid => ProbeManager.ActiveProbeManager && ProbeManager.ActiveProbeManager.ProbeController.Insertion.Pitch > 30; - + /// /// Visibility of the pitch warning. /// /// Flex when the pitch is invalid, none otherwise. - /// + /// [CreateProperty] public DisplayStyle PitchWarningDisplayStyle => !IsPitchValid ? DisplayStyle.Flex : DisplayStyle.None; @@ -93,7 +93,7 @@ public float ReferenceCoordinateCalibrationX /// /// Automation is not enabled for the active probe manager. [CreateProperty] - public float BregmaCalibrationY + public float ReferenceCoordinateCalibrationY { get => IsEnabled ? ActiveManipulatorBehaviorController.ReferenceCoordinateOffset.y : 0; set @@ -117,7 +117,7 @@ public float BregmaCalibrationY /// /// Automation is not enabled for the active probe manager. [CreateProperty] - public float BregmaCalibrationZ + public float ReferenceCoordinateCalibrationZ { get => IsEnabled ? ActiveManipulatorBehaviorController.ReferenceCoordinateOffset.z : 0; set @@ -141,7 +141,7 @@ public float BregmaCalibrationZ /// /// Automation is not enabled for the active probe manager. [CreateProperty] - public float BregmaCalibrationDepth + public float ReferenceCoordinateCalibrationDepth { get => IsEnabled ? ActiveManipulatorBehaviorController.ReferenceCoordinateOffset.w : 0; set @@ -173,6 +173,18 @@ private readonly Dictionary< ProbeManager > _manipulatorProbeManagerToSelectedTargetInsertionProbeManager = new(); + /// + /// Is the target insertion radio button group enabled. + /// + /// + /// True if the probe is enabled and has not started driving into the brain yet, false otherwise. + /// + [CreateProperty] + public bool IsTargetInsertionRadioButtonGroupEnabled => + IsEnabled + && ActiveProbeAutomationStateManager.ProbeAutomationState + < ProbeAutomationState.DrivingToNearTarget; + /// /// Selected target insertion option index. /// Property accessor for the selected target insertion index. @@ -378,7 +390,8 @@ private static string SurfaceCoordinateToString( /// Is the drive to selected target entry coordinate button enabled.
///
/// - /// Returns true if the active probe manager is Ephys Link controlled, calibrated to reference coordinate, and has a selected target. + /// Returns true if the active probe manager is Ephys Link controlled, calibrated to reference coordinate, and has a + /// selected target. /// [CreateProperty] public bool IsDriveToTargetEntryCoordinateButtonEnabled => diff --git a/Assets/UI/Components/AutomationStack.uxml b/Assets/UI/Components/AutomationStack.uxml index 57692a59..3e41b0ab 100644 --- a/Assets/UI/Components/AutomationStack.uxml +++ b/Assets/UI/Components/AutomationStack.uxml @@ -13,7 +13,7 @@ - + @@ -21,7 +21,7 @@ - + @@ -29,7 +29,7 @@ - + @@ -37,7 +37,7 @@ - + @@ -50,6 +50,7 @@ +