diff --git a/Assets/Prefabs/UI/EphysCopilot/DrivePanel.prefab b/Assets/Prefabs/UI/EphysCopilot/DrivePanel.prefab index 4a7b1e69..5f4fe61a 100644 --- a/Assets/Prefabs/UI/EphysCopilot/DrivePanel.prefab +++ b/Assets/Prefabs/UI/EphysCopilot/DrivePanel.prefab @@ -624,18 +624,18 @@ RectTransform: m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 2086077773253262175} - m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} m_LocalPosition: {x: 0, y: 0, z: 0} m_LocalScale: {x: 1, y: 1, z: 1} m_ConstrainProportionsScale: 0 m_Children: - {fileID: 2362172576444042663} - m_Father: {fileID: 6515295940426836225} + m_Father: {fileID: 6909838764699516010} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 0} m_AnchorMax: {x: 0, y: 0} m_AnchoredPosition: {x: 0, y: 0} - m_SizeDelta: {x: 0, y: 0} + m_SizeDelta: {x: 0, y: 55} m_Pivot: {x: 0.5, y: 0.5} --- !u!222 &1865409351431344203 CanvasRenderer: @@ -1802,7 +1802,7 @@ RectTransform: m_Children: - {fileID: 2753155116253475791} - {fileID: 6242800431103368463} - - {fileID: 3524217788664126087} + - {fileID: 6909838764699516010} m_Father: {fileID: 8263761920505935184} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 0} @@ -2713,6 +2713,70 @@ MonoBehaviour: m_FlexibleWidth: 1000 m_FlexibleHeight: -1 m_LayoutPriority: 1 +--- !u!1 &6282100964008414570 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 6909838764699516010} + - component: {fileID: 6289762302632402239} + m_Layer: 5 + m_Name: InOutGroup + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &6909838764699516010 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 6282100964008414570} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: + - {fileID: 3524217788664126087} + - {fileID: 4572890062272026645} + m_Father: {fileID: 6515295940426836225} + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 0, y: 0} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 0, y: 0} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!114 &6289762302632402239 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 6282100964008414570} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 30649d3a9faa99c48a7b1166b86bf2a0, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Padding: + m_Left: 0 + m_Right: 0 + m_Top: 0 + m_Bottom: 0 + m_ChildAlignment: 0 + m_Spacing: 5 + m_ChildForceExpandWidth: 1 + m_ChildForceExpandHeight: 1 + m_ChildControlWidth: 1 + m_ChildControlHeight: 0 + m_ChildScaleWidth: 0 + m_ChildScaleHeight: 0 + m_ReverseArrangement: 0 --- !u!1 &6315168989377721155 GameObject: m_ObjectHideFlags: 0 @@ -2746,11 +2810,11 @@ RectTransform: m_ConstrainProportionsScale: 0 m_Children: - {fileID: 7417060807589589629} - m_Father: {fileID: 8263761920505935184} + m_Father: {fileID: 6909838764699516010} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 1} m_AnchorMax: {x: 0, y: 1} - m_AnchoredPosition: {x: 250, y: -205.83333} + m_AnchoredPosition: {x: 250, y: -67.50008} m_SizeDelta: {x: 500, y: 55} m_Pivot: {x: 0.5, y: 0.5} --- !u!222 &5092748061186658588 @@ -3395,7 +3459,6 @@ RectTransform: - {fileID: 6515295940426836225} - {fileID: 1745994379071024274} - {fileID: 4713282267483347500} - - {fileID: 4572890062272026645} - {fileID: 1255181177075355001} - {fileID: 6962289190657615313} m_Father: {fileID: 0} @@ -3781,8 +3844,8 @@ RectTransform: m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 1} m_AnchorMax: {x: 0, y: 1} - m_AnchoredPosition: {x: 250, y: -205.83333} - m_SizeDelta: {x: 500, y: 55} + m_AnchoredPosition: {x: 250, y: -99.56} + m_SizeDelta: {x: 500, y: 77.36} m_Pivot: {x: 0.5, y: 0.5} --- !u!222 &5413243260015565761 CanvasRenderer: diff --git a/Assets/Prefabs/UI/SettingsMenu/Menus/ManipulatorConnection.prefab b/Assets/Prefabs/UI/SettingsMenu/Menus/ManipulatorConnection.prefab index 6f10c4a1..3ab2838b 100644 --- a/Assets/Prefabs/UI/SettingsMenu/Menus/ManipulatorConnection.prefab +++ b/Assets/Prefabs/UI/SettingsMenu/Menus/ManipulatorConnection.prefab @@ -1481,6 +1481,7 @@ RectTransform: m_Children: - {fileID: 5836458058341303149} - {fileID: 4864814776895557404} + - {fileID: 2463268732528750220} - {fileID: 5811476935667676352} m_Father: {fileID: 3524536676843369458} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} @@ -1857,9 +1858,9 @@ MonoBehaviour: _zeroCoordinateDInputField: {fileID: 8872759665276583042} _duraDropDirectionDropdown: {fileID: 2176473196253187661} _brainSurfaceOffsetInputField: {fileID: 3529476872428658600} - _returnToZeroCoordinateButton: {fileID: 899946326353513394} - _returnToZeroCoordinateButtonText: {fileID: 3945481360224806470} _enableManualControlToggle: {fileID: 3897188312319433914} + _returnToZeroCoordinateButtonGameObject: {fileID: 388109859594854322} + _stopReturningToZeroCoordinateButtonGameObject: {fileID: 7263977736302493218} --- !u!114 &7145065099748536085 MonoBehaviour: m_ObjectHideFlags: 0 @@ -2504,10 +2505,6 @@ PrefabInstance: propertyPath: m_Text value: Return to Zero Coordinate objectReference: {fileID: 0} - - target: {fileID: 2315289584108803517, guid: b70534dfc2e4a52489c512aabd5dd59d, type: 3} - propertyPath: m_Interactable - value: 0 - objectReference: {fileID: 0} - target: {fileID: 2315289584108803517, guid: b70534dfc2e4a52489c512aabd5dd59d, type: 3} propertyPath: m_OnClick.m_PersistentCalls.m_Calls.Array.size value: 1 @@ -2552,6 +2549,10 @@ PrefabInstance: propertyPath: m_Name value: ReturnToZeroCoordinateBtn objectReference: {fileID: 0} + - target: {fileID: 2971839373268861373, guid: b70534dfc2e4a52489c512aabd5dd59d, type: 3} + propertyPath: m_IsActive + value: 0 + objectReference: {fileID: 0} - target: {fileID: 8061307773979316499, guid: b70534dfc2e4a52489c512aabd5dd59d, type: 3} propertyPath: m_Pivot.x value: 0.5 @@ -2570,7 +2571,7 @@ PrefabInstance: objectReference: {fileID: 0} - target: {fileID: 8061307773979316499, guid: b70534dfc2e4a52489c512aabd5dd59d, type: 3} propertyPath: m_AnchorMax.y - value: 0 + value: 1 objectReference: {fileID: 0} - target: {fileID: 8061307773979316499, guid: b70534dfc2e4a52489c512aabd5dd59d, type: 3} propertyPath: m_AnchorMin.x @@ -2578,15 +2579,15 @@ PrefabInstance: objectReference: {fileID: 0} - target: {fileID: 8061307773979316499, guid: b70534dfc2e4a52489c512aabd5dd59d, type: 3} propertyPath: m_AnchorMin.y - value: 0 + value: 1 objectReference: {fileID: 0} - target: {fileID: 8061307773979316499, guid: b70534dfc2e4a52489c512aabd5dd59d, type: 3} propertyPath: m_SizeDelta.x - value: 0 + value: 401.17395 objectReference: {fileID: 0} - target: {fileID: 8061307773979316499, guid: b70534dfc2e4a52489c512aabd5dd59d, type: 3} propertyPath: m_SizeDelta.y - value: 0 + value: 60 objectReference: {fileID: 0} - target: {fileID: 8061307773979316499, guid: b70534dfc2e4a52489c512aabd5dd59d, type: 3} propertyPath: m_LocalPosition.x @@ -2618,11 +2619,11 @@ PrefabInstance: objectReference: {fileID: 0} - target: {fileID: 8061307773979316499, guid: b70534dfc2e4a52489c512aabd5dd59d, type: 3} propertyPath: m_AnchoredPosition.x - value: 0 + value: 595.03455 objectReference: {fileID: 0} - target: {fileID: 8061307773979316499, guid: b70534dfc2e4a52489c512aabd5dd59d, type: 3} propertyPath: m_AnchoredPosition.y - value: 0 + value: -30 objectReference: {fileID: 0} - target: {fileID: 8061307773979316499, guid: b70534dfc2e4a52489c512aabd5dd59d, type: 3} propertyPath: m_LocalEulerAnglesHint.x @@ -2669,28 +2670,6 @@ MonoBehaviour: m_FlexibleWidth: -1 m_FlexibleHeight: -1 m_LayoutPriority: 1 ---- !u!114 &899946326353513394 stripped -MonoBehaviour: - m_CorrespondingSourceObject: {fileID: 2315289584108803517, guid: b70534dfc2e4a52489c512aabd5dd59d, type: 3} - m_PrefabInstance: {fileID: 3196658493005209103} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 388109859594854322} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: 4e29b1a8efbd4b44bb3f3716e73f07ff, type: 3} - m_Name: - m_EditorClassIdentifier: ---- !u!114 &3945481360224806470 stripped -MonoBehaviour: - m_CorrespondingSourceObject: {fileID: 1917941435178448969, guid: b70534dfc2e4a52489c512aabd5dd59d, type: 3} - m_PrefabInstance: {fileID: 3196658493005209103} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 0} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: 5f7201a12d95ffc409449d95f23cf332, type: 3} - m_Name: - m_EditorClassIdentifier: --- !u!224 &4864814776895557404 stripped RectTransform: m_CorrespondingSourceObject: {fileID: 8061307773979316499, guid: b70534dfc2e4a52489c512aabd5dd59d, type: 3} @@ -3918,6 +3897,190 @@ MonoBehaviour: m_FlexibleWidth: 5000 m_FlexibleHeight: -1 m_LayoutPriority: 1 +--- !u!1001 &5616214589568073631 +PrefabInstance: + m_ObjectHideFlags: 0 + serializedVersion: 2 + m_Modification: + serializedVersion: 3 + m_TransformParent: {fileID: 3625585140806200970} + m_Modifications: + - target: {fileID: 1917941435178448969, guid: b70534dfc2e4a52489c512aabd5dd59d, type: 3} + propertyPath: m_Text + value: 'Stop + +' + objectReference: {fileID: 0} + - target: {fileID: 2315289584108803517, guid: b70534dfc2e4a52489c512aabd5dd59d, type: 3} + propertyPath: m_OnClick.m_PersistentCalls.m_Calls.Array.size + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 2315289584108803517, guid: b70534dfc2e4a52489c512aabd5dd59d, type: 3} + propertyPath: m_OnClick.m_PersistentCalls.m_Calls.Array.data[0].m_Mode + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 2315289584108803517, guid: b70534dfc2e4a52489c512aabd5dd59d, type: 3} + propertyPath: m_OnClick.m_PersistentCalls.m_Calls.Array.data[0].m_Target + value: + objectReference: {fileID: 8989497614435274778} + - target: {fileID: 2315289584108803517, guid: b70534dfc2e4a52489c512aabd5dd59d, type: 3} + propertyPath: m_OnClick.m_PersistentCalls.m_Calls.Array.data[0].m_CallState + value: 2 + objectReference: {fileID: 0} + - target: {fileID: 2315289584108803517, guid: b70534dfc2e4a52489c512aabd5dd59d, type: 3} + propertyPath: m_OnClick.m_PersistentCalls.m_Calls.Array.data[0].m_MethodName + value: StopReturningToZeroCoordinate + objectReference: {fileID: 0} + - target: {fileID: 2315289584108803517, guid: b70534dfc2e4a52489c512aabd5dd59d, type: 3} + propertyPath: m_OnClick.m_PersistentCalls.m_Calls.Array.data[0].m_TargetAssemblyTypeName + value: Pinpoint.UI.EphysLinkSettings.ManipulatorConnectionPanel, trajectoryplanner.ui.ephyslinksettings + objectReference: {fileID: 0} + - target: {fileID: 2315289584108803517, guid: b70534dfc2e4a52489c512aabd5dd59d, type: 3} + propertyPath: m_OnClick.m_PersistentCalls.m_Calls.Array.data[0].m_Arguments.m_ObjectArgumentAssemblyTypeName + value: UnityEngine.Object, UnityEngine + objectReference: {fileID: 0} + - target: {fileID: 2423235387983150861, guid: b70534dfc2e4a52489c512aabd5dd59d, type: 3} + propertyPath: m_Color.b + value: 0.22352941 + objectReference: {fileID: 0} + - target: {fileID: 2423235387983150861, guid: b70534dfc2e4a52489c512aabd5dd59d, type: 3} + propertyPath: m_Color.g + value: 0.22352941 + objectReference: {fileID: 0} + - target: {fileID: 2423235387983150861, guid: b70534dfc2e4a52489c512aabd5dd59d, type: 3} + propertyPath: m_Color.r + value: 0.7019608 + objectReference: {fileID: 0} + - target: {fileID: 2971839373268861373, guid: b70534dfc2e4a52489c512aabd5dd59d, type: 3} + propertyPath: m_Name + value: StopReturningToZeroCoordinateBtn + objectReference: {fileID: 0} + - target: {fileID: 2971839373268861373, guid: b70534dfc2e4a52489c512aabd5dd59d, type: 3} + propertyPath: m_IsActive + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 8061307773979316499, guid: b70534dfc2e4a52489c512aabd5dd59d, type: 3} + propertyPath: m_Pivot.x + value: 0.5 + objectReference: {fileID: 0} + - target: {fileID: 8061307773979316499, guid: b70534dfc2e4a52489c512aabd5dd59d, type: 3} + propertyPath: m_Pivot.y + value: 0.5 + objectReference: {fileID: 0} + - target: {fileID: 8061307773979316499, guid: b70534dfc2e4a52489c512aabd5dd59d, type: 3} + propertyPath: m_RootOrder + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 8061307773979316499, guid: b70534dfc2e4a52489c512aabd5dd59d, type: 3} + propertyPath: m_AnchorMax.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 8061307773979316499, guid: b70534dfc2e4a52489c512aabd5dd59d, type: 3} + propertyPath: m_AnchorMax.y + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 8061307773979316499, guid: b70534dfc2e4a52489c512aabd5dd59d, type: 3} + propertyPath: m_AnchorMin.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 8061307773979316499, guid: b70534dfc2e4a52489c512aabd5dd59d, type: 3} + propertyPath: m_AnchorMin.y + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 8061307773979316499, guid: b70534dfc2e4a52489c512aabd5dd59d, type: 3} + propertyPath: m_SizeDelta.x + value: 400.71664 + objectReference: {fileID: 0} + - target: {fileID: 8061307773979316499, guid: b70534dfc2e4a52489c512aabd5dd59d, type: 3} + propertyPath: m_SizeDelta.y + value: 60 + objectReference: {fileID: 0} + - target: {fileID: 8061307773979316499, guid: b70534dfc2e4a52489c512aabd5dd59d, type: 3} + propertyPath: m_LocalPosition.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 8061307773979316499, guid: b70534dfc2e4a52489c512aabd5dd59d, type: 3} + propertyPath: m_LocalPosition.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 8061307773979316499, guid: b70534dfc2e4a52489c512aabd5dd59d, type: 3} + propertyPath: m_LocalPosition.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 8061307773979316499, guid: b70534dfc2e4a52489c512aabd5dd59d, type: 3} + propertyPath: m_LocalRotation.w + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 8061307773979316499, guid: b70534dfc2e4a52489c512aabd5dd59d, type: 3} + propertyPath: m_LocalRotation.x + value: -0 + objectReference: {fileID: 0} + - target: {fileID: 8061307773979316499, guid: b70534dfc2e4a52489c512aabd5dd59d, type: 3} + propertyPath: m_LocalRotation.y + value: -0 + objectReference: {fileID: 0} + - target: {fileID: 8061307773979316499, guid: b70534dfc2e4a52489c512aabd5dd59d, type: 3} + propertyPath: m_LocalRotation.z + value: -0 + objectReference: {fileID: 0} + - target: {fileID: 8061307773979316499, guid: b70534dfc2e4a52489c512aabd5dd59d, type: 3} + propertyPath: m_AnchoredPosition.x + value: 869.6556 + objectReference: {fileID: 0} + - target: {fileID: 8061307773979316499, guid: b70534dfc2e4a52489c512aabd5dd59d, type: 3} + propertyPath: m_AnchoredPosition.y + value: -30 + objectReference: {fileID: 0} + - target: {fileID: 8061307773979316499, guid: b70534dfc2e4a52489c512aabd5dd59d, type: 3} + propertyPath: m_LocalEulerAnglesHint.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 8061307773979316499, guid: b70534dfc2e4a52489c512aabd5dd59d, type: 3} + propertyPath: m_LocalEulerAnglesHint.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 8061307773979316499, guid: b70534dfc2e4a52489c512aabd5dd59d, type: 3} + propertyPath: m_LocalEulerAnglesHint.z + value: 0 + objectReference: {fileID: 0} + m_RemovedComponents: [] + m_RemovedGameObjects: [] + m_AddedGameObjects: [] + m_AddedComponents: + - targetCorrespondingSourceObject: {fileID: 2971839373268861373, guid: b70534dfc2e4a52489c512aabd5dd59d, type: 3} + insertIndex: -1 + addedObject: {fileID: 755893876697453984} + m_SourcePrefab: {fileID: 100100000, guid: b70534dfc2e4a52489c512aabd5dd59d, type: 3} +--- !u!224 &2463268732528750220 stripped +RectTransform: + m_CorrespondingSourceObject: {fileID: 8061307773979316499, guid: b70534dfc2e4a52489c512aabd5dd59d, type: 3} + m_PrefabInstance: {fileID: 5616214589568073631} + m_PrefabAsset: {fileID: 0} +--- !u!1 &7263977736302493218 stripped +GameObject: + m_CorrespondingSourceObject: {fileID: 2971839373268861373, guid: b70534dfc2e4a52489c512aabd5dd59d, type: 3} + m_PrefabInstance: {fileID: 5616214589568073631} + m_PrefabAsset: {fileID: 0} +--- !u!114 &755893876697453984 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 7263977736302493218} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 306cc8c2b49d7114eaa3623786fc2126, type: 3} + m_Name: + m_EditorClassIdentifier: + m_IgnoreLayout: 0 + m_MinWidth: 400 + m_MinHeight: -1 + m_PreferredWidth: -1 + m_PreferredHeight: -1 + m_FlexibleWidth: -1 + m_FlexibleHeight: -1 + m_LayoutPriority: 1 --- !u!1001 &6934655636967719807 PrefabInstance: m_ObjectHideFlags: 0 diff --git a/Assets/Scripts/Pinpoint/UI/EphysCopilot/DrivePanelHandler.cs b/Assets/Scripts/Pinpoint/UI/EphysCopilot/DrivePanelHandler.cs index b5b12a2b..3fc151fd 100644 --- a/Assets/Scripts/Pinpoint/UI/EphysCopilot/DrivePanelHandler.cs +++ b/Assets/Scripts/Pinpoint/UI/EphysCopilot/DrivePanelHandler.cs @@ -35,6 +35,7 @@ private enum DriveState // Base speeds (in mm/s) private const float DEPTH_DRIVE_BASE_SPEED_TEST = 0.5f; + // private const float DEPTH_DRIVE_BASE_SPEED = DEPTH_DRIVE_BASE_SPEED_TEST; private const float DEPTH_DRIVE_BASE_SPEED = 0.005f; @@ -89,16 +90,19 @@ public void DriveIncrement() State = DriveState.ReturningToTarget; break; + // Driving in progress: maintain state + case DriveState.DrivingToNearTarget: + case DriveState.DriveToPastTarget: + case DriveState.ReturningToTarget: + break; + // Error cases: Cannot drive down from these states case DriveState.Outside: case DriveState.ExitingToOutside: case DriveState.AtExitMargin: case DriveState.ExitingToMargin: case DriveState.ExitingToDura: - case DriveState.DrivingToNearTarget: case DriveState.ExitingToNearTarget: - case DriveState.DriveToPastTarget: - case DriveState.ReturningToTarget: case DriveState.AtTarget: default: Debug.LogError("Cannot drive down from state: " + State); @@ -134,12 +138,15 @@ public void ExitIncrement() State = DriveState.ExitingToNearTarget; break; - // Error cases: Cannot exit from these states - case DriveState.Outside: + // Exit in progress: maintain state case DriveState.ExitingToMargin: case DriveState.ExitingToDura: case DriveState.ExitingToNearTarget: case DriveState.ExitingToOutside: + break; + + // Error cases: Cannot exit from these states + case DriveState.Outside: default: Debug.LogError("Cannot exit from state: " + State); break; @@ -312,7 +319,7 @@ public void ResetDriveStateToDura() { // Reset state _driveStateManager.ResetToDura(); - + // Reset UI _driveButton.interactable = true; _statusText.text = "Ready to Drive"; @@ -460,6 +467,8 @@ public void Drive() _stopButton.SetActive(false); // Enable return to surface button + _driveGroup.SetActive(true); + _driveButton.interactable = false; _exitButton.SetActive(true); }); }, Debug.LogError); @@ -475,7 +484,7 @@ public void Drive() case DriveState.AtPastTarget: case DriveState.AtTarget: default: - Debug.LogError("Invalid Drive state for driving."); + Debug.LogError("Invalid Drive state for driving: "+_driveStateManager.State); return; } }, Debug.LogError); @@ -514,7 +523,7 @@ public void Exit() _statusText.text = "Returning to surface..."; // Replace drive buttons with stop - _exitButton.SetActive(false); + _driveGroup.SetActive(false); _stopButton.SetActive(true); // Drive to near target depth @@ -530,7 +539,7 @@ public void Exit() _statusText.text = "Returning to surface..."; // Replace drive buttons with stop - _exitButton.SetActive(false); + _driveGroup.SetActive(false); _stopButton.SetActive(true); // Drive to dura depth (set speed based on dura depth and near target depth) @@ -547,7 +556,7 @@ public void Exit() _statusText.text = "Exiting Dura..."; // Replace drive buttons with stop - _exitButton.SetActive(false); + _driveGroup.SetActive(false); _stopButton.SetActive(true); // Drive to dura margin depth @@ -564,9 +573,9 @@ public void Exit() _statusText.text = "Exiting Dura..."; // Replace drive buttons with stop - _exitButton.SetActive(false); + _driveGroup.SetActive(false); _stopButton.SetActive(true); - + // Reset dura offset ProbeManager.ManipulatorBehaviorController.BrainSurfaceOffset = 0; @@ -619,6 +628,7 @@ void CompleteOutside() _driveButton.interactable = false; _statusText.text = "Move to Dura to Drive"; _stopButton.SetActive(false); + _exitButton.SetActive(false); _driveGroup.SetActive(true); }, Debug.LogError); } @@ -630,31 +640,34 @@ public void Stop() { if (!b) return; - // Reset UI based on state + // Show drive group and hide stop button. + _statusText.text = "Stopped"; + _driveGroup.SetActive(true); + _exitButton.SetActive(true); _stopButton.SetActive(false); + + // Disable drive button if exiting or at Dura and above, otherwise enable. switch (_driveStateManager.State) { - case DriveState.AtExitMargin: case DriveState.AtDura: - case DriveState.AtNearTarget: - case DriveState.AtTarget: - case DriveState.AtPastTarget: - case DriveState.DriveToPastTarget: - case DriveState.ReturningToTarget: - case DriveState.DrivingToNearTarget: - _exitButton.SetActive(true); - _statusText.text = "Stopped"; - break; - case DriveState.Outside: - case DriveState.ExitingToOutside: case DriveState.ExitingToMargin: + case DriveState.AtExitMargin: + case DriveState.ExitingToOutside: case DriveState.ExitingToDura: case DriveState.ExitingToNearTarget: - _driveGroup.SetActive(true); - _statusText.text = "Drive when outside"; + case DriveState.Outside: + _driveButton.interactable = false; + break; + case DriveState.DrivingToNearTarget: + case DriveState.AtNearTarget: + case DriveState.DriveToPastTarget: + case DriveState.AtPastTarget: + case DriveState.ReturningToTarget: + case DriveState.AtTarget: + _driveButton.interactable = true; break; default: - Debug.LogError("Unknown state for stopping: " + _driveStateManager.State); + Debug.LogError("Unexpected stop state: " + _driveStateManager.State); break; } }); diff --git a/Assets/Scripts/Pinpoint/UI/EphysCopilot/InsertionSelectionPanelHandler.cs b/Assets/Scripts/Pinpoint/UI/EphysCopilot/InsertionSelectionPanelHandler.cs index 219e9d35..a17906ee 100644 --- a/Assets/Scripts/Pinpoint/UI/EphysCopilot/InsertionSelectionPanelHandler.cs +++ b/Assets/Scripts/Pinpoint/UI/EphysCopilot/InsertionSelectionPanelHandler.cs @@ -137,7 +137,7 @@ public void OnTargetInsertionDropdownValueChanged(int value) _lineGameObjects.ap.SetActive(false); _lineGameObjects.ml.SetActive(false); _lineGameObjects.dv.SetActive(false); - + // Reset dropdown color. var colorBlockCopy = _targetInsertionDropdown.colors; colorBlockCopy.normalColor = new Color(1, 1, 1); @@ -408,14 +408,32 @@ private void MoveToTargetInsertion() _lineGameObjects.dv.SetActive(false); // Complete movement - _isMoving = false; - _moveButtonText.text = MOVE_TO_TARGET_INSERTION_STR; + EndMovement(); _moveButton.interactable = false; }, Debug.LogError); - }, Debug.LogError); - }, Debug.LogError); - }, Debug.LogError); + }, error => + { + Debug.LogError(error); + EndMovement(); + }); + }, error => + { + Debug.LogError(error); + EndMovement(); + }); + }, error => + { + Debug.LogError(error); + EndMovement(); + }); }, Debug.LogError); + return; + + void EndMovement() + { + _isMoving = false; + _moveButtonText.text = MOVE_TO_TARGET_INSERTION_STR; + } } private void UpdateMoveButtonInteractable() diff --git a/Assets/Scripts/Pinpoint/UI/EphysLinkSettings/ManipulatorConnectionPanel.cs b/Assets/Scripts/Pinpoint/UI/EphysLinkSettings/ManipulatorConnectionPanel.cs index d2ba4297..d768e33a 100644 --- a/Assets/Scripts/Pinpoint/UI/EphysLinkSettings/ManipulatorConnectionPanel.cs +++ b/Assets/Scripts/Pinpoint/UI/EphysLinkSettings/ManipulatorConnectionPanel.cs @@ -28,9 +28,9 @@ public class ManipulatorConnectionPanel : MonoBehaviour [SerializeField] private InputField _zeroCoordinateDInputField; [SerializeField] private Dropdown _duraDropDirectionDropdown; [SerializeField] private InputField _brainSurfaceOffsetInputField; - [SerializeField] private Button _returnToZeroCoordinateButton; - [SerializeField] private Text _returnToZeroCoordinateButtonText; [SerializeField] private Toggle _enableManualControlToggle; + [SerializeField] private GameObject _returnToZeroCoordinateButtonGameObject; + [SerializeField] private GameObject _stopReturningToZeroCoordinateButtonGameObject; private ProbeManager _attachedProbe; @@ -42,8 +42,6 @@ public class ManipulatorConnectionPanel : MonoBehaviour private string _manipulatorId; private int _numAxes; - private bool _returningToZeroCoordinate; - #endregion #region Constructor @@ -78,7 +76,7 @@ public void Initialize(EphysLinkSettings settingsMenu, string manipulatorID, var probeType = shankCount == 4 ? ProbeProperties.ProbeType.Neuropixels24 : ProbeProperties.ProbeType.Neuropixels1; - + CreatePathfinderProbe(probeType); return; @@ -310,7 +308,7 @@ public void UpdateManualControlState(bool state) _attachedProbe.ProbeController.ManipulatorManualControl = state; // Enable/disable return to zero coordinate button - _returnToZeroCoordinateButton.interactable = state; + _returnToZeroCoordinateButtonGameObject.SetActive(state); } /// @@ -318,46 +316,49 @@ public void UpdateManualControlState(bool state) /// public void ReturnToZeroCoordinate() { - if (_returningToZeroCoordinate) - { - // Return in progress, should stop - _returnToZeroCoordinateButtonText.text = "Stopping..."; - - CommunicationManager.Instance.Stop(stopState => + // Disable keyboard control + _attachedProbe.ProbeController.ManipulatorManualControl = false; + + // Hide move button and show stop button + _returnToZeroCoordinateButtonGameObject.SetActive(false); + _stopReturningToZeroCoordinateButtonGameObject.SetActive(true); + + // Move manipulator back to zero coordinate + _attachedProbe.ManipulatorBehaviorController.MoveBackToZeroCoordinate(_ => { - // Update text - _returnToZeroCoordinateButtonText.text = - stopState ? "Return to Zero Coordinate" : "Failed to Stop, Try Again"; - - // Re-enable keyboard control if stop was successful - _attachedProbe.ProbeController.ManipulatorManualControl = stopState; + PostMoveAction(); + + // Reset dura drop direction on successful return + _attachedProbe.ManipulatorBehaviorController.BrainSurfaceOffset = 0; + }, + _ => PostMoveAction()); + return; - // Update flag - _returningToZeroCoordinate = !stopState; - }); - } - else + void PostMoveAction() { - // Disable keyboard control - _attachedProbe.ProbeController.ManipulatorManualControl = false; - - // Set button text and update flag - _returnToZeroCoordinateButtonText.text = "Stop"; - _returningToZeroCoordinate = true; - - // Move manipulator back to zero coordinate - _attachedProbe.ManipulatorBehaviorController.MoveBackToZeroCoordinate(_ => PostMoveAction(), - _ => PostMoveAction()); + // Show move button and hide stop button + _returnToZeroCoordinateButtonGameObject.SetActive(true); + _stopReturningToZeroCoordinateButtonGameObject.SetActive(false); - void PostMoveAction() - { - _returnToZeroCoordinateButtonText.text = "Return to Zero Coordinate"; - _attachedProbe.ProbeController.ManipulatorManualControl = true; - _returningToZeroCoordinate = false; - } + // Re-enable keyboard control + _attachedProbe.ProbeController.ManipulatorManualControl = true; } } + public void StopReturningToZeroCoordinate() + { + CommunicationManager.Instance.Stop(stopState => + { + if (!stopState) return; + // Hide stop button and show move button + _returnToZeroCoordinateButtonGameObject.SetActive(true); + _stopReturningToZeroCoordinateButtonGameObject.SetActive(false); + + // Re-enable keyboard control + _attachedProbe.ProbeController.ManipulatorManualControl = true; + }); + } + #endregion #region Helper Functions diff --git a/Assets/Unisave.meta b/Assets/Unisave.meta new file mode 100644 index 00000000..d02b2747 --- /dev/null +++ b/Assets/Unisave.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: d89dc69443a642b4bb3d4582c2bad767 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Unisave/Resources.meta b/Assets/Unisave/Resources.meta new file mode 100644 index 00000000..081743be --- /dev/null +++ b/Assets/Unisave/Resources.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 4aadc3ce0e20445beb6f0354f9388081 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: