From d6ab0676710bb9e60fb3f1992b4479c7490570c3 Mon Sep 17 00:00:00 2001 From: Kenneth Yang Date: Mon, 11 Sep 2023 13:29:39 -0700 Subject: [PATCH 01/78] Fix probe option highlighting --- .../UI/EphysLinkSettings/ProbeOptionColorHandler.cs | 2 ++ ProjectSettings/ProjectSettings.asset | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/Assets/Scripts/TrajectoryPlanner/UI/EphysLinkSettings/ProbeOptionColorHandler.cs b/Assets/Scripts/TrajectoryPlanner/UI/EphysLinkSettings/ProbeOptionColorHandler.cs index 61aad78b..d5370b03 100644 --- a/Assets/Scripts/TrajectoryPlanner/UI/EphysLinkSettings/ProbeOptionColorHandler.cs +++ b/Assets/Scripts/TrajectoryPlanner/UI/EphysLinkSettings/ProbeOptionColorHandler.cs @@ -21,6 +21,8 @@ private void Start() // Set the toggle color to match the probe color var colorBlockCopy = _toggle.colors; colorBlockCopy.normalColor = matchingManager.Color; + colorBlockCopy.selectedColor = new Color(colorBlockCopy.normalColor.r * 0.9f, + colorBlockCopy.normalColor.g * 0.9f, colorBlockCopy.normalColor.b * 0.9f); _toggle.colors = colorBlockCopy; } } diff --git a/ProjectSettings/ProjectSettings.asset b/ProjectSettings/ProjectSettings.asset index 47022d61..b2eff36c 100644 --- a/ProjectSettings/ProjectSettings.asset +++ b/ProjectSettings/ProjectSettings.asset @@ -134,7 +134,7 @@ PlayerSettings: 16:10: 1 16:9: 1 Others: 1 - bundleVersion: 0.95 + bundleVersion: 0.96 preloadedAssets: [] metroInputSource: 0 wsaTransparentSwapchain: 0 From d83e293de84fd212b1ebebe0e3011d2275994ece Mon Sep 17 00:00:00 2001 From: Kenneth Yang Date: Wed, 13 Sep 2023 10:33:23 -0700 Subject: [PATCH 02/78] Fix default driving speed not being set to 5 --- .../UI/EphysCopilot/DrivePanelHandler.cs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/Assets/Scripts/TrajectoryPlanner/UI/EphysCopilot/DrivePanelHandler.cs b/Assets/Scripts/TrajectoryPlanner/UI/EphysCopilot/DrivePanelHandler.cs index 1c6eec5f..9d5a6fb4 100644 --- a/Assets/Scripts/TrajectoryPlanner/UI/EphysCopilot/DrivePanelHandler.cs +++ b/Assets/Scripts/TrajectoryPlanner/UI/EphysCopilot/DrivePanelHandler.cs @@ -169,7 +169,7 @@ public void OnDrivePastDistanceChanged(string value) public void Drive() { - ComputeAndSetDriveTime(_targetDriveSpeed, () => + ComputeAndSetDriveTime(_depthDriveBaseSpeed, () => { CommunicationManager.Instance.SetCanWrite(ProbeManager.ManipulatorBehaviorController.ManipulatorID, true, 1, canWrite => @@ -318,13 +318,13 @@ public void Stop() #region Helper Functions - private void ComputeAndSetDriveTime(float driveSpeed, Action callback = null) + private void ComputeAndSetDriveTime(float depthDriveBaseSpeed, Action callback = null) { // Compute speed variables based on speed - _depthDriveBaseSpeed = driveSpeed; - _exitDriveSpeed = driveSpeed * RETURN_TO_SURFACE_DRIVE_SPEED_MULTIPLIER; - _outsideDriveSpeed = driveSpeed * OUTSIDE_DRIVE_SPEED_MULTIPLIER; - _per1000Speed = driveSpeed < DEPTH_DRIVE_BASE_SPEED_TEST ? PER_1000_SPEED : PER_1000_SPEED_TEST; + _depthDriveBaseSpeed = depthDriveBaseSpeed; + _exitDriveSpeed = depthDriveBaseSpeed * RETURN_TO_SURFACE_DRIVE_SPEED_MULTIPLIER; + _outsideDriveSpeed = depthDriveBaseSpeed * OUTSIDE_DRIVE_SPEED_MULTIPLIER; + _per1000Speed = depthDriveBaseSpeed < DEPTH_DRIVE_BASE_SPEED_TEST ? PER_1000_SPEED : PER_1000_SPEED_TEST; // Update drive past distance and return to surface button text _returnButtonText.text = "Return to Surface (" + SpeedToString(_exitDriveSpeed) + ")"; From 5188d2721d38e63bcdacea44413d59773af28bc6 Mon Sep 17 00:00:00 2001 From: Kenneth Yang Date: Wed, 13 Sep 2023 11:57:30 -0700 Subject: [PATCH 03/78] Prep to split computation --- .../UI/EphysCopilot/DrivePanelHandler.cs | 27 ++++++++++++------- 1 file changed, 17 insertions(+), 10 deletions(-) diff --git a/Assets/Scripts/TrajectoryPlanner/UI/EphysCopilot/DrivePanelHandler.cs b/Assets/Scripts/TrajectoryPlanner/UI/EphysCopilot/DrivePanelHandler.cs index 9d5a6fb4..b7ceff57 100644 --- a/Assets/Scripts/TrajectoryPlanner/UI/EphysCopilot/DrivePanelHandler.cs +++ b/Assets/Scripts/TrajectoryPlanner/UI/EphysCopilot/DrivePanelHandler.cs @@ -27,7 +27,7 @@ private enum DriveState private const float DEPTH_DRIVE_BASE_SPEED_TEST = 0.5f; private const float NEAR_TARGET_SPEED_MULTIPLIER = 2f / 3f; - private const int RETURN_TO_SURFACE_DRIVE_SPEED_MULTIPLIER = 5; + private const int EXIT_DRIVE_SPEED_MULTIPLIER = 5; private const int OUTSIDE_DRIVE_SPEED_MULTIPLIER = 20; private const float PER_1000_SPEED = 0.001f; @@ -64,14 +64,14 @@ private enum DriveState private float _targetDepth; private float _targetDriveDuration; private float _duraMarginDepth; - private float _duraMarginDriveDuration => DURA_MARGIN_DISTANCE / _exitDriveSpeed; + private float _duraMarginDriveDuration => DURA_MARGIN_DISTANCE / _exitDriveBaseSpeed; private float _exitDepth; private float _exitDriveDuration; private float _targetDriveSpeed; private float _drivePastTargetDistance = DRIVE_PAST_TARGET_DISTANCE; private float _depthDriveBaseSpeed = DEPTH_DRIVE_BASE_SPEED; - private float _exitDriveSpeed; + private float _exitDriveBaseSpeed => _depthDriveBaseSpeed * EXIT_DRIVE_SPEED_MULTIPLIER; private float _exitDuraMarginSpeed; private float _outsideDriveSpeed; private float _per1000Speed; @@ -254,12 +254,12 @@ public void DriveBackToSurface() // Drive back to dura by near target distance (as much as possible) CommunicationManager.Instance.DriveToDepth(ProbeManager.ManipulatorBehaviorController.ManipulatorID, - driveDepth, _exitDriveSpeed * NEAR_TARGET_SPEED_MULTIPLIER, _ => + driveDepth, _exitDriveBaseSpeed * NEAR_TARGET_SPEED_MULTIPLIER, _ => { // Drive back to dura CommunicationManager.Instance.DriveToDepth( ProbeManager.ManipulatorBehaviorController.ManipulatorID, _duraDepth, - _exitDriveSpeed, _ => + _exitDriveBaseSpeed, _ => { // Drive out by dura exit margin // FIXME: Dependent on CoordinateSpace direction. Should be standardized by Ephys Link. @@ -267,7 +267,7 @@ public void DriveBackToSurface() ProbeManager.ManipulatorBehaviorController.ManipulatorID, _duraDepth - ProbeManager.ManipulatorBehaviorController.CoordinateSpace .World2SpaceAxisChange(Vector3.up).z * DURA_MARGIN_DISTANCE, - _exitDriveSpeed, _ => + _exitDriveBaseSpeed, _ => { // Drive the rest of the way to the surface CommunicationManager.Instance.DriveToDepth( @@ -322,12 +322,11 @@ private void ComputeAndSetDriveTime(float depthDriveBaseSpeed, Action callback = { // Compute speed variables based on speed _depthDriveBaseSpeed = depthDriveBaseSpeed; - _exitDriveSpeed = depthDriveBaseSpeed * RETURN_TO_SURFACE_DRIVE_SPEED_MULTIPLIER; _outsideDriveSpeed = depthDriveBaseSpeed * OUTSIDE_DRIVE_SPEED_MULTIPLIER; _per1000Speed = depthDriveBaseSpeed < DEPTH_DRIVE_BASE_SPEED_TEST ? PER_1000_SPEED : PER_1000_SPEED_TEST; // Update drive past distance and return to surface button text - _returnButtonText.text = "Return to Surface (" + SpeedToString(_exitDriveSpeed) + ")"; + _returnButtonText.text = "Return to Surface (" + SpeedToString(_exitDriveBaseSpeed) + ")"; // Compute drive distance and duration CommunicationManager.Instance.GetPos(ProbeManager.ManipulatorBehaviorController.ManipulatorID, position => @@ -420,8 +419,8 @@ private void ComputeAndSetDriveTime(float depthDriveBaseSpeed, Action callback = */ _exitDriveDuration = Mathf.Min(targetDriveDistance, NEAR_TARGET_DISTANCE) / - (_exitDriveSpeed * NEAR_TARGET_SPEED_MULTIPLIER) + - Mathf.Max(0, targetDriveDistance - NEAR_TARGET_DISTANCE) / _exitDriveSpeed + + (_exitDriveBaseSpeed * NEAR_TARGET_SPEED_MULTIPLIER) + + Mathf.Max(0, targetDriveDistance - NEAR_TARGET_DISTANCE) / _exitDriveBaseSpeed + _duraMarginDriveDuration + (surfaceDriveDistance - targetDriveDistance - DURA_MARGIN_DISTANCE) / _outsideDriveSpeed; @@ -434,6 +433,14 @@ private void ComputeAndSetDriveTime(float depthDriveBaseSpeed, Action callback = }); } + private void ComputeAndSetExitDriveTime(Action callback = null) + { + CommunicationManager.Instance.GetPos(ProbeManager.ManipulatorBehaviorController.ManipulatorID, position => + { + + }); + } + private IEnumerator CountDownTimer(float seconds, DriveState driveState) { // Set timer text From 6c2b28e0cdb63d884274778f32239ab2792a72ce Mon Sep 17 00:00:00 2001 From: Kenneth Yang Date: Wed, 13 Sep 2023 12:07:15 -0700 Subject: [PATCH 04/78] Set driving back to target status text --- .../TrajectoryPlanner/UI/EphysCopilot/DrivePanelHandler.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Assets/Scripts/TrajectoryPlanner/UI/EphysCopilot/DrivePanelHandler.cs b/Assets/Scripts/TrajectoryPlanner/UI/EphysCopilot/DrivePanelHandler.cs index b7ceff57..f30b6262 100644 --- a/Assets/Scripts/TrajectoryPlanner/UI/EphysCopilot/DrivePanelHandler.cs +++ b/Assets/Scripts/TrajectoryPlanner/UI/EphysCopilot/DrivePanelHandler.cs @@ -213,6 +213,8 @@ public void Drive() _targetDriveSpeed * NEAR_TARGET_SPEED_MULTIPLIER, _ => { + _statusText.text = "Driving back to target..."; + // Drive back to target CommunicationManager.Instance.DriveToDepth( ProbeManager.ManipulatorBehaviorController.ManipulatorID, From 50776f219d5efc1b4c2a07afeb4944486383ca40 Mon Sep 17 00:00:00 2001 From: Kenneth Yang Date: Wed, 13 Sep 2023 12:07:23 -0700 Subject: [PATCH 05/78] bump version --- ProjectSettings/ProjectSettings.asset | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ProjectSettings/ProjectSettings.asset b/ProjectSettings/ProjectSettings.asset index b2eff36c..83c341f0 100644 --- a/ProjectSettings/ProjectSettings.asset +++ b/ProjectSettings/ProjectSettings.asset @@ -134,7 +134,7 @@ PlayerSettings: 16:10: 1 16:9: 1 Others: 1 - bundleVersion: 0.96 + bundleVersion: 0.961 preloadedAssets: [] metroInputSource: 0 wsaTransparentSwapchain: 0 From 32eed02c20d6ef75f2eae104ebf9db9ea2885cbd Mon Sep 17 00:00:00 2001 From: Kenneth Yang Date: Wed, 13 Sep 2023 16:34:35 -0700 Subject: [PATCH 06/78] WIP fixing drive system --- .../UI/EphysCopilot/DrivePanelHandler.cs | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/Assets/Scripts/TrajectoryPlanner/UI/EphysCopilot/DrivePanelHandler.cs b/Assets/Scripts/TrajectoryPlanner/UI/EphysCopilot/DrivePanelHandler.cs index f30b6262..b449bf82 100644 --- a/Assets/Scripts/TrajectoryPlanner/UI/EphysCopilot/DrivePanelHandler.cs +++ b/Assets/Scripts/TrajectoryPlanner/UI/EphysCopilot/DrivePanelHandler.cs @@ -214,7 +214,7 @@ public void Drive() _ => { _statusText.text = "Driving back to target..."; - + // Drive back to target CommunicationManager.Instance.DriveToDepth( ProbeManager.ManipulatorBehaviorController.ManipulatorID, @@ -420,7 +420,7 @@ private void ComputeAndSetDriveTime(float depthDriveBaseSpeed, Action callback = * 4. Drive out to surface at outside speed */ _exitDriveDuration = - Mathf.Min(targetDriveDistance, NEAR_TARGET_DISTANCE) / + Mathf.Max(0, NEAR_TARGET_DISTANCE - targetDriveDistance) / (_exitDriveBaseSpeed * NEAR_TARGET_SPEED_MULTIPLIER) + Mathf.Max(0, targetDriveDistance - NEAR_TARGET_DISTANCE) / _exitDriveBaseSpeed + _duraMarginDriveDuration + @@ -437,10 +437,8 @@ private void ComputeAndSetDriveTime(float depthDriveBaseSpeed, Action callback = private void ComputeAndSetExitDriveTime(Action callback = null) { - CommunicationManager.Instance.GetPos(ProbeManager.ManipulatorBehaviorController.ManipulatorID, position => - { - - }); + CommunicationManager.Instance.GetPos(ProbeManager.ManipulatorBehaviorController.ManipulatorID, + position => { }); } private IEnumerator CountDownTimer(float seconds, DriveState driveState) From db4c5aadceefb9f9c1113c2022ec679b0e8d90d6 Mon Sep 17 00:00:00 2001 From: Kenneth Yang Date: Thu, 14 Sep 2023 12:42:10 -0700 Subject: [PATCH 07/78] Change namespaces --- Assets/Scripts/Core/CoordinateSystems/SensapexLeftTransform.cs | 3 ++- Assets/Scripts/Core/CoordinateSystems/SensapexSpace.cs | 3 ++- .../TrajectoryPlanner/Probes/ManipulatorBehaviorController.cs | 1 + 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/Assets/Scripts/Core/CoordinateSystems/SensapexLeftTransform.cs b/Assets/Scripts/Core/CoordinateSystems/SensapexLeftTransform.cs index 3904140b..6396a77e 100644 --- a/Assets/Scripts/Core/CoordinateSystems/SensapexLeftTransform.cs +++ b/Assets/Scripts/Core/CoordinateSystems/SensapexLeftTransform.cs @@ -1,6 +1,7 @@ +using CoordinateTransforms; using UnityEngine; -namespace CoordinateTransforms +namespace Core.CoordinateSystems { public sealed class SensapexLeftTransform : AffineTransform { diff --git a/Assets/Scripts/Core/CoordinateSystems/SensapexSpace.cs b/Assets/Scripts/Core/CoordinateSystems/SensapexSpace.cs index db24bf0d..445e4fc6 100644 --- a/Assets/Scripts/Core/CoordinateSystems/SensapexSpace.cs +++ b/Assets/Scripts/Core/CoordinateSystems/SensapexSpace.cs @@ -1,6 +1,7 @@ +using CoordinateSpaces; using UnityEngine; -namespace CoordinateSpaces +namespace Core.CoordinateSystems { public sealed class SensapexSpace : CoordinateSpace { diff --git a/Assets/Scripts/TrajectoryPlanner/Probes/ManipulatorBehaviorController.cs b/Assets/Scripts/TrajectoryPlanner/Probes/ManipulatorBehaviorController.cs index 6780689d..05e7f59f 100644 --- a/Assets/Scripts/TrajectoryPlanner/Probes/ManipulatorBehaviorController.cs +++ b/Assets/Scripts/TrajectoryPlanner/Probes/ManipulatorBehaviorController.cs @@ -3,6 +3,7 @@ using System.Linq; using CoordinateSpaces; using CoordinateTransforms; +using Core.CoordinateSystems; using EphysLink; using UnityEngine; using UnityEngine.Events; From b8a59d00b108829f31e04f5ea0875529025d4e58 Mon Sep 17 00:00:00 2001 From: Kenneth Yang Date: Tue, 26 Sep 2023 17:19:54 -0700 Subject: [PATCH 08/78] Tested out unified space, need to flip some axes --- Assets/Scripts/Core/CoordinateSystems/SensapexSpace.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Assets/Scripts/Core/CoordinateSystems/SensapexSpace.cs b/Assets/Scripts/Core/CoordinateSystems/SensapexSpace.cs index db24bf0d..ffd30353 100644 --- a/Assets/Scripts/Core/CoordinateSystems/SensapexSpace.cs +++ b/Assets/Scripts/Core/CoordinateSystems/SensapexSpace.cs @@ -15,7 +15,7 @@ public sealed class SensapexSpace : CoordinateSpace /// World space coordinates public override Vector3 Space2World(Vector3 coord) { - return new Vector3(coord.y, -coord.z, -coord.x); + return new Vector3(coord.x, coord.y, coord.z); } /// @@ -25,7 +25,7 @@ public override Vector3 Space2World(Vector3 coord) /// Sensapex Space coordinates public override Vector3 World2Space(Vector3 world) { - return new Vector3(-world.z, world.x, -world.y); + return new Vector3(world.x, world.y, world.z); } public override Vector3 Space2WorldAxisChange(Vector3 coord) From f71d443898c33beae31e4f461ac092b909059d38 Mon Sep 17 00:00:00 2001 From: Kenneth Yang Date: Thu, 28 Sep 2023 15:07:14 -0700 Subject: [PATCH 09/78] Created manipulator space, reworked 3-axis transform --- Assets/Scenes/TrajectoryPlanner.unity | 22 ++++++------- .../Core/CoordinateSystems/CoordinateSpace.cs | 13 +++++++- .../CoordinateSystems/ManipulatorSpace.cs | 32 +++++++++++++++++++ .../ManipulatorSpace.cs.meta | 11 +++++++ .../Core/CoordinateSystems/SensapexSpace.cs | 13 ++------ ...Transform.cs => ThreeAxisLeftTransform.cs} | 10 +++--- ...cs.meta => ThreeAxisLeftTransform.cs.meta} | 0 .../Probes/ManipulatorBehaviorController.cs | 4 +-- 8 files changed, 75 insertions(+), 30 deletions(-) create mode 100644 Assets/Scripts/Core/CoordinateSystems/ManipulatorSpace.cs create mode 100644 Assets/Scripts/Core/CoordinateSystems/ManipulatorSpace.cs.meta rename Assets/Scripts/Core/CoordinateSystems/{NewScaleLeftTransform.cs => ThreeAxisLeftTransform.cs} (80%) rename Assets/Scripts/Core/CoordinateSystems/{NewScaleLeftTransform.cs.meta => ThreeAxisLeftTransform.cs.meta} (100%) diff --git a/Assets/Scenes/TrajectoryPlanner.unity b/Assets/Scenes/TrajectoryPlanner.unity index 749989ce..233ec83b 100644 --- a/Assets/Scenes/TrajectoryPlanner.unity +++ b/Assets/Scenes/TrajectoryPlanner.unity @@ -2335,15 +2335,15 @@ PrefabInstance: objectReference: {fileID: 1703646459} - target: {fileID: 341190943836035196, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} propertyPath: m_AnchorMax.y - value: 1 + value: 0 objectReference: {fileID: 0} - target: {fileID: 341190943836035196, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} propertyPath: m_AnchorMin.y - value: 1 + value: 0 objectReference: {fileID: 0} - target: {fileID: 341190943836035196, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} propertyPath: m_AnchoredPosition.x - value: 169.88 + value: 0 objectReference: {fileID: 0} - target: {fileID: 341190943836276264, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} propertyPath: onValueChanged.m_PersistentCalls.m_Calls.Array.data[0].m_Target @@ -2439,19 +2439,19 @@ PrefabInstance: objectReference: {fileID: 1445581475} - target: {fileID: 341190944034978748, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} propertyPath: m_AnchorMax.y - value: 1 + value: 0 objectReference: {fileID: 0} - target: {fileID: 341190944034978748, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} propertyPath: m_AnchorMin.y - value: 1 + value: 0 objectReference: {fileID: 0} - target: {fileID: 341190944034978748, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} propertyPath: m_AnchoredPosition.x - value: 354.84 + value: 0 objectReference: {fileID: 0} - target: {fileID: 341190944034978748, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} propertyPath: m_AnchoredPosition.y - value: -15 + value: 0 objectReference: {fileID: 0} - target: {fileID: 341190944083206642, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} propertyPath: m_Name @@ -2679,19 +2679,19 @@ PrefabInstance: objectReference: {fileID: 0} - target: {fileID: 341190944410943211, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} propertyPath: m_AnchorMax.y - value: 1 + value: 0 objectReference: {fileID: 0} - target: {fileID: 341190944410943211, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} propertyPath: m_AnchorMin.y - value: 1 + value: 0 objectReference: {fileID: 0} - target: {fileID: 341190944410943211, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} propertyPath: m_AnchoredPosition.x - value: 384.91998 + value: 0 objectReference: {fileID: 0} - target: {fileID: 341190944410943211, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} propertyPath: m_AnchoredPosition.y - value: -15 + value: 0 objectReference: {fileID: 0} - target: {fileID: 341190944411999430, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} propertyPath: m_AnchorMax.y diff --git a/Assets/Scripts/Core/CoordinateSystems/CoordinateSpace.cs b/Assets/Scripts/Core/CoordinateSystems/CoordinateSpace.cs index 1fc12f28..c7ae785b 100644 --- a/Assets/Scripts/Core/CoordinateSystems/CoordinateSpace.cs +++ b/Assets/Scripts/Core/CoordinateSystems/CoordinateSpace.cs @@ -13,7 +13,18 @@ public abstract class CoordinateSpace public Vector3 RelativeOffset { get; set; } = Vector3.zero; + /// + /// Convert coordinates from this coordinate space to Unity world space + /// + /// X, Y, Z coordinate in this coordinate space + /// Unity world space coordinates public abstract Vector3 Space2World(Vector3 coord); + + /// + /// Convert coordinates from Unity world space to this coordinate space + /// + /// X, Y, Z coordinates in Unity world space + /// Coordinate space coordinates public abstract Vector3 World2Space(Vector3 world); public abstract Vector3 Space2WorldAxisChange(Vector3 coord); @@ -36,4 +47,4 @@ public override int GetHashCode() return HashCode.Combine(Name); } } -} +} \ No newline at end of file diff --git a/Assets/Scripts/Core/CoordinateSystems/ManipulatorSpace.cs b/Assets/Scripts/Core/CoordinateSystems/ManipulatorSpace.cs new file mode 100644 index 00000000..9aba7f6f --- /dev/null +++ b/Assets/Scripts/Core/CoordinateSystems/ManipulatorSpace.cs @@ -0,0 +1,32 @@ +using System.Collections; +using System.Collections.Generic; +using UnityEngine; + +namespace CoordinateSpaces +{ + public sealed class ManipulatorSpace : CoordinateSpace + { + public override string Name => "Manipulator"; + public override Vector3 Dimensions => new(20, 20, 20); + public override Vector3 Space2World(Vector3 coord) + { + return new Vector3(-coord.x, coord.y, -coord.z); + } + + public override Vector3 World2Space(Vector3 world) + { + return new Vector3(-world.x, world.y, -world.z); + } + + public override Vector3 Space2WorldAxisChange(Vector3 coord) + { + return Space2World(coord); + } + + public override Vector3 World2SpaceAxisChange(Vector3 world) + { + return World2Space(world); + } + } +} + diff --git a/Assets/Scripts/Core/CoordinateSystems/ManipulatorSpace.cs.meta b/Assets/Scripts/Core/CoordinateSystems/ManipulatorSpace.cs.meta new file mode 100644 index 00000000..3616574c --- /dev/null +++ b/Assets/Scripts/Core/CoordinateSystems/ManipulatorSpace.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: b1d844dccffa89d48a5ed2ddd8eaec42 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Core/CoordinateSystems/SensapexSpace.cs b/Assets/Scripts/Core/CoordinateSystems/SensapexSpace.cs index ffd30353..0f0aa74f 100644 --- a/Assets/Scripts/Core/CoordinateSystems/SensapexSpace.cs +++ b/Assets/Scripts/Core/CoordinateSystems/SensapexSpace.cs @@ -8,21 +8,12 @@ public sealed class SensapexSpace : CoordinateSpace public override string Name => "Sensapex"; public override Vector3 Dimensions => new(20, 20, 20); - /// - /// Convert coordinates from Sensapex space to Unity world space - /// - /// X, Y, Z coordinate in Sensapex space - /// World space coordinates + public override Vector3 Space2World(Vector3 coord) { return new Vector3(coord.x, coord.y, coord.z); } - - /// - /// Convert coordinates from world space to Sensapex space - /// - /// X, Y, Z coordinates in World space - /// Sensapex Space coordinates + public override Vector3 World2Space(Vector3 world) { return new Vector3(world.x, world.y, world.z); diff --git a/Assets/Scripts/Core/CoordinateSystems/NewScaleLeftTransform.cs b/Assets/Scripts/Core/CoordinateSystems/ThreeAxisLeftTransform.cs similarity index 80% rename from Assets/Scripts/Core/CoordinateSystems/NewScaleLeftTransform.cs rename to Assets/Scripts/Core/CoordinateSystems/ThreeAxisLeftTransform.cs index 0d3afcf5..7f73e4f2 100644 --- a/Assets/Scripts/Core/CoordinateSystems/NewScaleLeftTransform.cs +++ b/Assets/Scripts/Core/CoordinateSystems/ThreeAxisLeftTransform.cs @@ -2,22 +2,22 @@ namespace CoordinateTransforms { - public class NewScaleLeftTransform : CoordinateTransform + public class ThreeAxisLeftTransform : CoordinateTransform { private readonly Quaternion _inverseRotation; private readonly Quaternion _rotation; - public NewScaleLeftTransform(float yaw, float pitch) + public ThreeAxisLeftTransform(float yaw, float pitch) { - var yawRotation = Quaternion.AngleAxis(yaw, Vector3.forward); + var yawRotation = Quaternion.AngleAxis(yaw, Vector3.down); var pitchRotation = Quaternion.AngleAxis(pitch, yawRotation * Vector3.left); _rotation = yawRotation * pitchRotation; _inverseRotation = Quaternion.Inverse(_rotation); } - public override string Name => "New Scale Left"; - public override string Prefix => "ns-l"; + public override string Name => "Three Axis Left"; + public override string Prefix => "3l"; public override Vector3 Transform2Space(Vector3 coordTransformed) { diff --git a/Assets/Scripts/Core/CoordinateSystems/NewScaleLeftTransform.cs.meta b/Assets/Scripts/Core/CoordinateSystems/ThreeAxisLeftTransform.cs.meta similarity index 100% rename from Assets/Scripts/Core/CoordinateSystems/NewScaleLeftTransform.cs.meta rename to Assets/Scripts/Core/CoordinateSystems/ThreeAxisLeftTransform.cs.meta diff --git a/Assets/Scripts/TrajectoryPlanner/Probes/ManipulatorBehaviorController.cs b/Assets/Scripts/TrajectoryPlanner/Probes/ManipulatorBehaviorController.cs index 6780689d..6bedd120 100644 --- a/Assets/Scripts/TrajectoryPlanner/Probes/ManipulatorBehaviorController.cs +++ b/Assets/Scripts/TrajectoryPlanner/Probes/ManipulatorBehaviorController.cs @@ -280,8 +280,8 @@ public void UpdateSpaceAndTransform() } else { - CoordinateSpace = new NewScaleSpace(); - Transform = new NewScaleLeftTransform(_probeController.Insertion.yaw, + CoordinateSpace = new ManipulatorSpace(); + Transform = new ThreeAxisLeftTransform(_probeController.Insertion.yaw, _probeController.Insertion.pitch); } } From 643e25d8a9b775671b1614b3511aef1378cad70a Mon Sep 17 00:00:00 2001 From: Kenneth Yang Date: Fri, 29 Sep 2023 16:52:28 -0700 Subject: [PATCH 10/78] Depth now working (can remove directional check) --- .../TrajectoryPlanner/Probes/ManipulatorBehaviorController.cs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Assets/Scripts/TrajectoryPlanner/Probes/ManipulatorBehaviorController.cs b/Assets/Scripts/TrajectoryPlanner/Probes/ManipulatorBehaviorController.cs index 6bedd120..48d1ea22 100644 --- a/Assets/Scripts/TrajectoryPlanner/Probes/ManipulatorBehaviorController.cs +++ b/Assets/Scripts/TrajectoryPlanner/Probes/ManipulatorBehaviorController.cs @@ -367,8 +367,7 @@ public void MoveByWorldSpaceDelta(Vector4 worldSpaceDelta, Action onSucces // Convert to manipulator axes (world -> space -> transform) var manipulatorSpaceDelta = CoordinateSpace.World2SpaceAxisChange(worldSpaceDelta); var manipulatorTransformDelta = Transform.Space2Transform(manipulatorSpaceDelta); - var manipulatorSpaceDepth = CoordinateSpace - .World2SpaceAxisChange(Vector3.down).z * worldSpaceDelta.w; + var manipulatorSpaceDepth = worldSpaceDelta.w; // Get manipulator position CommunicationManager.Instance.GetPos(ManipulatorID, pos => From 71ee6c0115ef21fd563a3f97a740ec8bae386ecd Mon Sep 17 00:00:00 2001 From: Kenneth Yang Date: Tue, 3 Oct 2023 10:43:10 -0700 Subject: [PATCH 11/78] 3 axis is incorrectly displaying depth drive --- .../Probes/ManipulatorBehaviorController.cs | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/Assets/Scripts/TrajectoryPlanner/Probes/ManipulatorBehaviorController.cs b/Assets/Scripts/TrajectoryPlanner/Probes/ManipulatorBehaviorController.cs index 48d1ea22..ad161e7e 100644 --- a/Assets/Scripts/TrajectoryPlanner/Probes/ManipulatorBehaviorController.cs +++ b/Assets/Scripts/TrajectoryPlanner/Probes/ManipulatorBehaviorController.cs @@ -49,14 +49,11 @@ private void EchoPosition(Vector4 pos) Transform.Transform2Space(zeroCoordinateAdjustedManipulatorPosition); // Brain surface adjustment - // FIXME: Dependent on CoordinateSpace direction. Should be standardized by Ephys Link. var brainSurfaceAdjustment = float.IsNaN(BrainSurfaceOffset) ? 0 : BrainSurfaceOffset; if (IsSetToDropToSurfaceWithDepth) - zeroCoordinateAdjustedManipulatorPosition.w += - CoordinateSpace.World2SpaceAxisChange(Vector3.down).z * brainSurfaceAdjustment; + zeroCoordinateAdjustedManipulatorPosition.w += brainSurfaceAdjustment; else - manipulatorSpacePosition.z += - CoordinateSpace.World2SpaceAxisChange(Vector3.down).z * brainSurfaceAdjustment; + manipulatorSpacePosition.z -= brainSurfaceAdjustment; // Convert to world space var zeroCoordinateAdjustedWorldPosition = @@ -226,7 +223,6 @@ public bool IsRightHanded public void Initialize(string manipulatorID, bool calibrated) { - // FIXME: Dependent on Manipulator Type. Should be standardized by Ephys Link. CommunicationManager.Instance.GetManipulators((ids, type) => { // Shortcut exit if we have an invalid manipulator ID From c63dc9b91b646ac54860776c9f12f91cff5f90fa Mon Sep 17 00:00:00 2001 From: Kenneth Yang Date: Tue, 3 Oct 2023 13:57:00 -0700 Subject: [PATCH 12/78] Fixed left handed manipulator --- .../CoordinateSystems/FourAxisRightTransform.cs | 15 +++++++++++++++ ...orm.cs.meta => FourAxisRightTransform.cs.meta} | 0 .../LeftHandedManipulatorTransform.cs | 14 ++++++++++++++ ...eta => LeftHandedManipulatorTransform.cs.meta} | 0 .../CoordinateSystems/SensapexLeftTransform.cs | 14 -------------- .../CoordinateSystems/SensapexRightTransform.cs | 15 --------------- .../Probes/ManipulatorBehaviorController.cs | 9 ++++++--- 7 files changed, 35 insertions(+), 32 deletions(-) create mode 100644 Assets/Scripts/Core/CoordinateSystems/FourAxisRightTransform.cs rename Assets/Scripts/Core/CoordinateSystems/{SensapexRightTransform.cs.meta => FourAxisRightTransform.cs.meta} (100%) create mode 100644 Assets/Scripts/Core/CoordinateSystems/LeftHandedManipulatorTransform.cs rename Assets/Scripts/Core/CoordinateSystems/{SensapexLeftTransform.cs.meta => LeftHandedManipulatorTransform.cs.meta} (100%) delete mode 100644 Assets/Scripts/Core/CoordinateSystems/SensapexLeftTransform.cs delete mode 100644 Assets/Scripts/Core/CoordinateSystems/SensapexRightTransform.cs diff --git a/Assets/Scripts/Core/CoordinateSystems/FourAxisRightTransform.cs b/Assets/Scripts/Core/CoordinateSystems/FourAxisRightTransform.cs new file mode 100644 index 00000000..94a03b9d --- /dev/null +++ b/Assets/Scripts/Core/CoordinateSystems/FourAxisRightTransform.cs @@ -0,0 +1,15 @@ +using UnityEngine; + +namespace CoordinateTransforms +{ + public class FourAxisRightTransform : AffineTransform + { + public override string Name => "Four Axis Right"; + public override string Prefix => "4r"; + + public FourAxisRightTransform(float phi) : base(Vector3.one, new Vector3(0, 0, phi)) + { + } + + } +} diff --git a/Assets/Scripts/Core/CoordinateSystems/SensapexRightTransform.cs.meta b/Assets/Scripts/Core/CoordinateSystems/FourAxisRightTransform.cs.meta similarity index 100% rename from Assets/Scripts/Core/CoordinateSystems/SensapexRightTransform.cs.meta rename to Assets/Scripts/Core/CoordinateSystems/FourAxisRightTransform.cs.meta diff --git a/Assets/Scripts/Core/CoordinateSystems/LeftHandedManipulatorTransform.cs b/Assets/Scripts/Core/CoordinateSystems/LeftHandedManipulatorTransform.cs new file mode 100644 index 00000000..e25545a2 --- /dev/null +++ b/Assets/Scripts/Core/CoordinateSystems/LeftHandedManipulatorTransform.cs @@ -0,0 +1,14 @@ +using UnityEngine; + +namespace CoordinateTransforms +{ + public sealed class LeftHandedManipulatorTransform : AffineTransform + { + public LeftHandedManipulatorTransform(float phi) : base(Vector3.one, new Vector3(0, -phi, 0)) + { + } + + public override string Name => "Left Handed Manipulator"; + public override string Prefix => "lhm"; + } +} \ No newline at end of file diff --git a/Assets/Scripts/Core/CoordinateSystems/SensapexLeftTransform.cs.meta b/Assets/Scripts/Core/CoordinateSystems/LeftHandedManipulatorTransform.cs.meta similarity index 100% rename from Assets/Scripts/Core/CoordinateSystems/SensapexLeftTransform.cs.meta rename to Assets/Scripts/Core/CoordinateSystems/LeftHandedManipulatorTransform.cs.meta diff --git a/Assets/Scripts/Core/CoordinateSystems/SensapexLeftTransform.cs b/Assets/Scripts/Core/CoordinateSystems/SensapexLeftTransform.cs deleted file mode 100644 index 3904140b..00000000 --- a/Assets/Scripts/Core/CoordinateSystems/SensapexLeftTransform.cs +++ /dev/null @@ -1,14 +0,0 @@ -using UnityEngine; - -namespace CoordinateTransforms -{ - public sealed class SensapexLeftTransform : AffineTransform - { - public SensapexLeftTransform(float phi) : base(new Vector3(1, -1, 1), new Vector3(0, 0, phi)) - { - } - - public override string Name => "Sensapex Left"; - public override string Prefix => "spx-l"; - } -} \ No newline at end of file diff --git a/Assets/Scripts/Core/CoordinateSystems/SensapexRightTransform.cs b/Assets/Scripts/Core/CoordinateSystems/SensapexRightTransform.cs deleted file mode 100644 index f6f491b3..00000000 --- a/Assets/Scripts/Core/CoordinateSystems/SensapexRightTransform.cs +++ /dev/null @@ -1,15 +0,0 @@ -using UnityEngine; - -namespace CoordinateTransforms -{ - public class SensapexRightTransform : AffineTransform - { - public override string Name => "Sensapex Right"; - public override string Prefix => "spx-r"; - - public SensapexRightTransform(float phi) : base(Vector3.one, new Vector3(0, 0, phi)) - { - } - - } -} diff --git a/Assets/Scripts/TrajectoryPlanner/Probes/ManipulatorBehaviorController.cs b/Assets/Scripts/TrajectoryPlanner/Probes/ManipulatorBehaviorController.cs index ad161e7e..49f86f5c 100644 --- a/Assets/Scripts/TrajectoryPlanner/Probes/ManipulatorBehaviorController.cs +++ b/Assets/Scripts/TrajectoryPlanner/Probes/ManipulatorBehaviorController.cs @@ -59,6 +59,9 @@ private void EchoPosition(Vector4 pos) var zeroCoordinateAdjustedWorldPosition = CoordinateSpace.Space2World(manipulatorSpacePosition); + // print("pos: " + pos + "; manipulator: " + manipulatorSpacePosition + "; world: " + + // zeroCoordinateAdjustedWorldPosition); + // Set probe position (change axes to match probe) var transformedApmldv = _probeController.Insertion.World2TransformedAxisChange(zeroCoordinateAdjustedWorldPosition); @@ -269,10 +272,10 @@ public void UpdateSpaceAndTransform() { if (ManipulatorType == "sensapex") { - CoordinateSpace = new SensapexSpace(); + CoordinateSpace = new ManipulatorSpace(); Transform = IsRightHanded - ? new SensapexRightTransform(_probeController.Insertion.yaw) - : new SensapexLeftTransform(_probeController.Insertion.yaw); + ? new FourAxisRightTransform(_probeController.Insertion.yaw) + : new LeftHandedManipulatorTransform(_probeController.Insertion.yaw); } else { From e2aafb776ed6a4dbbe175b998aecbfa71a94f6fa Mon Sep 17 00:00:00 2001 From: Kenneth Yang Date: Tue, 3 Oct 2023 14:02:26 -0700 Subject: [PATCH 13/78] Right hand manipulator --- .../CoordinateSystems/FourAxisRightTransform.cs | 15 --------------- .../RightHandedManipulatorTransform.cs | 15 +++++++++++++++ ...ta => RightHandedManipulatorTransform.cs.meta} | 0 .../Probes/ManipulatorBehaviorController.cs | 2 +- 4 files changed, 16 insertions(+), 16 deletions(-) delete mode 100644 Assets/Scripts/Core/CoordinateSystems/FourAxisRightTransform.cs create mode 100644 Assets/Scripts/Core/CoordinateSystems/RightHandedManipulatorTransform.cs rename Assets/Scripts/Core/CoordinateSystems/{FourAxisRightTransform.cs.meta => RightHandedManipulatorTransform.cs.meta} (100%) diff --git a/Assets/Scripts/Core/CoordinateSystems/FourAxisRightTransform.cs b/Assets/Scripts/Core/CoordinateSystems/FourAxisRightTransform.cs deleted file mode 100644 index 94a03b9d..00000000 --- a/Assets/Scripts/Core/CoordinateSystems/FourAxisRightTransform.cs +++ /dev/null @@ -1,15 +0,0 @@ -using UnityEngine; - -namespace CoordinateTransforms -{ - public class FourAxisRightTransform : AffineTransform - { - public override string Name => "Four Axis Right"; - public override string Prefix => "4r"; - - public FourAxisRightTransform(float phi) : base(Vector3.one, new Vector3(0, 0, phi)) - { - } - - } -} diff --git a/Assets/Scripts/Core/CoordinateSystems/RightHandedManipulatorTransform.cs b/Assets/Scripts/Core/CoordinateSystems/RightHandedManipulatorTransform.cs new file mode 100644 index 00000000..b625cc91 --- /dev/null +++ b/Assets/Scripts/Core/CoordinateSystems/RightHandedManipulatorTransform.cs @@ -0,0 +1,15 @@ +using UnityEngine; + +namespace CoordinateTransforms +{ + public class RightHandedManipulatorTransform : AffineTransform + { + public override string Name => "Four Axis Right"; + public override string Prefix => "4r"; + + public RightHandedManipulatorTransform(float phi) : base(2 * Vector3.left + Vector3.one, + new Vector3(0, -phi, 0)) + { + } + } +} \ No newline at end of file diff --git a/Assets/Scripts/Core/CoordinateSystems/FourAxisRightTransform.cs.meta b/Assets/Scripts/Core/CoordinateSystems/RightHandedManipulatorTransform.cs.meta similarity index 100% rename from Assets/Scripts/Core/CoordinateSystems/FourAxisRightTransform.cs.meta rename to Assets/Scripts/Core/CoordinateSystems/RightHandedManipulatorTransform.cs.meta diff --git a/Assets/Scripts/TrajectoryPlanner/Probes/ManipulatorBehaviorController.cs b/Assets/Scripts/TrajectoryPlanner/Probes/ManipulatorBehaviorController.cs index 49f86f5c..4d6a6eb5 100644 --- a/Assets/Scripts/TrajectoryPlanner/Probes/ManipulatorBehaviorController.cs +++ b/Assets/Scripts/TrajectoryPlanner/Probes/ManipulatorBehaviorController.cs @@ -274,7 +274,7 @@ public void UpdateSpaceAndTransform() { CoordinateSpace = new ManipulatorSpace(); Transform = IsRightHanded - ? new FourAxisRightTransform(_probeController.Insertion.yaw) + ? new RightHandedManipulatorTransform(_probeController.Insertion.yaw) : new LeftHandedManipulatorTransform(_probeController.Insertion.yaw); } else From eab79b9427dc65020a417a425088af8529857272 Mon Sep 17 00:00:00 2001 From: Kenneth Yang Date: Tue, 3 Oct 2023 14:08:47 -0700 Subject: [PATCH 14/78] Fix file rearrangement --- .../Probes/ManipulatorBehaviorController.cs | 232 +++++++++--------- 1 file changed, 116 insertions(+), 116 deletions(-) diff --git a/Assets/Scripts/TrajectoryPlanner/Probes/ManipulatorBehaviorController.cs b/Assets/Scripts/TrajectoryPlanner/Probes/ManipulatorBehaviorController.cs index 4d6a6eb5..bba24dc6 100644 --- a/Assets/Scripts/TrajectoryPlanner/Probes/ManipulatorBehaviorController.cs +++ b/Assets/Scripts/TrajectoryPlanner/Probes/ManipulatorBehaviorController.cs @@ -18,122 +18,6 @@ public class ManipulatorBehaviorController : MonoBehaviour #endregion - #region Private Methods - - private void EchoPosition(Vector4 pos) - { - if (!enabled && _probeController == null) return; - - // Check for special pathfinder mode (directly set probe position, no calculations needed) - if (ManipulatorType.Contains("pathfinder")) - { - CommunicationManager.Instance.GetAngles(ManipulatorID, angles => - { - _probeController.SetProbeAngles(angles); - _probeController.SetProbePosition(new Vector3(pos.y, pos.x, pos.z)); - }); - } - else - { - // Calculate last used direction for dropping to brain surface (between depth and DV) - var dvDelta = Math.Abs(pos.z - _lastManipulatorPosition.z); - var depthDelta = Math.Abs(pos.w - _lastManipulatorPosition.w); - if (dvDelta > 0.0001 || depthDelta > 0.0001) IsSetToDropToSurfaceWithDepth = depthDelta > dvDelta; - _lastManipulatorPosition = pos; - - // Apply zero coordinate offset - var zeroCoordinateAdjustedManipulatorPosition = pos - ZeroCoordinateOffset; - - // Convert to coordinate space - var manipulatorSpacePosition = - Transform.Transform2Space(zeroCoordinateAdjustedManipulatorPosition); - - // Brain surface adjustment - var brainSurfaceAdjustment = float.IsNaN(BrainSurfaceOffset) ? 0 : BrainSurfaceOffset; - if (IsSetToDropToSurfaceWithDepth) - zeroCoordinateAdjustedManipulatorPosition.w += brainSurfaceAdjustment; - else - manipulatorSpacePosition.z -= brainSurfaceAdjustment; - - // Convert to world space - var zeroCoordinateAdjustedWorldPosition = - CoordinateSpace.Space2World(manipulatorSpacePosition); - - // print("pos: " + pos + "; manipulator: " + manipulatorSpacePosition + "; world: " + - // zeroCoordinateAdjustedWorldPosition); - - // Set probe position (change axes to match probe) - var transformedApmldv = - _probeController.Insertion.World2TransformedAxisChange(zeroCoordinateAdjustedWorldPosition); - - // FIXME: Dependent on Manipulator Type. Should be standardized by Ephys Link. - if (ManipulatorType == "new_scale") - _probeController.SetProbePosition(new Vector4(transformedApmldv.x, transformedApmldv.y, - transformedApmldv.z, 0)); - else - _probeController.SetProbePosition(new Vector4(transformedApmldv.x, transformedApmldv.y, - transformedApmldv.z, zeroCoordinateAdjustedManipulatorPosition.w)); - } - - // Log every 5 hz - if (Time.time - _lastLoggedTime >= 0.2) - { - _lastLoggedTime = Time.time; - var tipPos = _probeController.ProbeTipT.position; - - // ["ephys_link", Real time stamp, Manipulator ID, X, Y, Z, W, Phi, Theta, Spin, TipX, TipY, TipZ] - string[] data = - { - "ephys_link", Time.realtimeSinceStartup.ToString(CultureInfo.InvariantCulture), ManipulatorID, - pos.x.ToString(CultureInfo.InvariantCulture), pos.y.ToString(CultureInfo.InvariantCulture), - pos.z.ToString(CultureInfo.InvariantCulture), pos.w.ToString(CultureInfo.InvariantCulture), - _probeController.Insertion.yaw.ToString(CultureInfo.InvariantCulture), - _probeController.Insertion.pitch.ToString(CultureInfo.InvariantCulture), - _probeController.Insertion.roll.ToString(CultureInfo.InvariantCulture), - tipPos.x.ToString(CultureInfo.InvariantCulture), tipPos.y.ToString(CultureInfo.InvariantCulture), - tipPos.z.ToString(CultureInfo.InvariantCulture) - }; - OutputLog.Log(data); - } - - // Continue echoing position - CommunicationManager.Instance.GetPos(ManipulatorID, EchoPosition); - } - - #endregion - - #region Unity - - /// - /// Setup this instance - /// - private void Awake() - { - // Start off as disabled - enabled = false; - - // Update manipulator inside brain state - // _probeController.MovedThisFrameEvent.AddListener(() => - // { - // if (_isSetToInsideBrain != _probeManager.IsProbeInBrain()) - // CommunicationManager.Instance.SetInsideBrain(ManipulatorID, _probeManager.IsProbeInBrain(), - // insideBrain => - // { - // _isSetToInsideBrain = insideBrain; - // _probeController.UnlockedDir = insideBrain ? new Vector4(0, 0, 0, 1) : Vector4.one; - // }); - // }); - } - - private void OnDisable() - { - ManipulatorID = null; - _zeroCoordinateOffset = Vector4.zero; - _brainSurfaceOffset = 0; - } - - #endregion - #region Components [SerializeField] private ProbeManager _probeManager; @@ -222,6 +106,38 @@ public bool IsRightHanded #endregion + #region Unity + + /// + /// Setup this instance + /// + private void Awake() + { + // Start off as disabled + enabled = false; + + // Update manipulator inside brain state + // _probeController.MovedThisFrameEvent.AddListener(() => + // { + // if (_isSetToInsideBrain != _probeManager.IsProbeInBrain()) + // CommunicationManager.Instance.SetInsideBrain(ManipulatorID, _probeManager.IsProbeInBrain(), + // insideBrain => + // { + // _isSetToInsideBrain = insideBrain; + // _probeController.UnlockedDir = insideBrain ? new Vector4(0, 0, 0, 1) : Vector4.one; + // }); + // }); + } + + private void OnDisable() + { + ManipulatorID = null; + _zeroCoordinateOffset = Vector4.zero; + _brainSurfaceOffset = 0; + } + + #endregion + #region Public Methods public void Initialize(string manipulatorID, bool calibrated) @@ -417,5 +333,89 @@ public void MoveBackToZeroCoordinate(Action onSuccessCallback, Action + { + _probeController.SetProbeAngles(angles); + _probeController.SetProbePosition(new Vector3(pos.y, pos.x, pos.z)); + }); + } + else + { + // Calculate last used direction for dropping to brain surface (between depth and DV) + var dvDelta = Math.Abs(pos.z - _lastManipulatorPosition.z); + var depthDelta = Math.Abs(pos.w - _lastManipulatorPosition.w); + if (dvDelta > 0.0001 || depthDelta > 0.0001) IsSetToDropToSurfaceWithDepth = depthDelta > dvDelta; + _lastManipulatorPosition = pos; + + // Apply zero coordinate offset + var zeroCoordinateAdjustedManipulatorPosition = pos - ZeroCoordinateOffset; + + // Convert to coordinate space + var manipulatorSpacePosition = + Transform.Transform2Space(zeroCoordinateAdjustedManipulatorPosition); + + // Brain surface adjustment + var brainSurfaceAdjustment = float.IsNaN(BrainSurfaceOffset) ? 0 : BrainSurfaceOffset; + if (IsSetToDropToSurfaceWithDepth) + zeroCoordinateAdjustedManipulatorPosition.w += brainSurfaceAdjustment; + else + manipulatorSpacePosition.z -= brainSurfaceAdjustment; + + // Convert to world space + var zeroCoordinateAdjustedWorldPosition = + CoordinateSpace.Space2World(manipulatorSpacePosition); + + // print("pos: " + pos + "; manipulator: " + manipulatorSpacePosition + "; world: " + + // zeroCoordinateAdjustedWorldPosition); + + // Set probe position (change axes to match probe) + var transformedApmldv = + _probeController.Insertion.World2TransformedAxisChange(zeroCoordinateAdjustedWorldPosition); + + // FIXME: Dependent on Manipulator Type. Should be standardized by Ephys Link. + if (ManipulatorType == "new_scale") + _probeController.SetProbePosition(new Vector4(transformedApmldv.x, transformedApmldv.y, + transformedApmldv.z, 0)); + else + _probeController.SetProbePosition(new Vector4(transformedApmldv.x, transformedApmldv.y, + transformedApmldv.z, zeroCoordinateAdjustedManipulatorPosition.w)); + } + + // Log every 5 hz + if (Time.time - _lastLoggedTime >= 0.2) + { + _lastLoggedTime = Time.time; + var tipPos = _probeController.ProbeTipT.position; + + // ["ephys_link", Real time stamp, Manipulator ID, X, Y, Z, W, Phi, Theta, Spin, TipX, TipY, TipZ] + string[] data = + { + "ephys_link", Time.realtimeSinceStartup.ToString(CultureInfo.InvariantCulture), ManipulatorID, + pos.x.ToString(CultureInfo.InvariantCulture), pos.y.ToString(CultureInfo.InvariantCulture), + pos.z.ToString(CultureInfo.InvariantCulture), pos.w.ToString(CultureInfo.InvariantCulture), + _probeController.Insertion.yaw.ToString(CultureInfo.InvariantCulture), + _probeController.Insertion.pitch.ToString(CultureInfo.InvariantCulture), + _probeController.Insertion.roll.ToString(CultureInfo.InvariantCulture), + tipPos.x.ToString(CultureInfo.InvariantCulture), tipPos.y.ToString(CultureInfo.InvariantCulture), + tipPos.z.ToString(CultureInfo.InvariantCulture) + }; + OutputLog.Log(data); + } + + // Continue echoing position + CommunicationManager.Instance.GetPos(ManipulatorID, EchoPosition); + } + + #endregion } } \ No newline at end of file From 7d3cb2a59ccedf883d2d6da9050b3579619729e3 Mon Sep 17 00:00:00 2001 From: Kenneth Yang Date: Tue, 3 Oct 2023 16:58:21 -0700 Subject: [PATCH 15/78] Removed redundant code, debugging 3-axis --- .../Probes/ManipulatorBehaviorController.cs | 181 +++++++++--------- 1 file changed, 89 insertions(+), 92 deletions(-) diff --git a/Assets/Scripts/TrajectoryPlanner/Probes/ManipulatorBehaviorController.cs b/Assets/Scripts/TrajectoryPlanner/Probes/ManipulatorBehaviorController.cs index bba24dc6..a51b4e90 100644 --- a/Assets/Scripts/TrajectoryPlanner/Probes/ManipulatorBehaviorController.cs +++ b/Assets/Scripts/TrajectoryPlanner/Probes/ManipulatorBehaviorController.cs @@ -138,6 +138,89 @@ private void OnDisable() #endregion + #region Private Methods + + private void EchoPosition(Vector4 pos) + { + if (!enabled && _probeController == null) return; + + // Check for special pathfinder mode (directly set probe position, no calculations needed) + if (ManipulatorType.Contains("pathfinder")) + { + CommunicationManager.Instance.GetAngles(ManipulatorID, angles => + { + _probeController.SetProbeAngles(angles); + _probeController.SetProbePosition(new Vector3(pos.y, pos.x, pos.z)); + }); + } + else + { + // Calculate last used direction for dropping to brain surface (between depth and DV) + var dvDelta = Math.Abs(pos.z - _lastManipulatorPosition.z); + var depthDelta = Math.Abs(pos.w - _lastManipulatorPosition.w); + if (dvDelta > 0.0001 || depthDelta > 0.0001) IsSetToDropToSurfaceWithDepth = depthDelta > dvDelta; + _lastManipulatorPosition = pos; + + // Apply zero coordinate offset + var zeroCoordinateAdjustedManipulatorPosition = pos - ZeroCoordinateOffset; + + // Convert to coordinate space + var manipulatorSpacePosition = + Transform.Transform2Space(zeroCoordinateAdjustedManipulatorPosition); + + // Brain surface adjustment + var brainSurfaceAdjustment = float.IsNaN(BrainSurfaceOffset) ? 0 : BrainSurfaceOffset; + if (IsSetToDropToSurfaceWithDepth) + zeroCoordinateAdjustedManipulatorPosition.w += brainSurfaceAdjustment; + else + manipulatorSpacePosition.z -= brainSurfaceAdjustment; + + // Convert to world space + var zeroCoordinateAdjustedWorldPosition = + CoordinateSpace.Space2World(manipulatorSpacePosition); + + print("pos: " + pos + "; manipulator: " + manipulatorSpacePosition + "; world: " + + zeroCoordinateAdjustedWorldPosition); + + // Set probe position (change axes to match probe) + var transformedApmldv = + _probeController.Insertion.World2TransformedAxisChange(zeroCoordinateAdjustedWorldPosition); + + // FIXME: Dependent on Manipulator Type. Should be standardized by Ephys Link. + if (ManipulatorType == "new_scale") + _probeController.SetProbePosition(transformedApmldv); + else + _probeController.SetProbePosition(new Vector4(transformedApmldv.x, transformedApmldv.y, + transformedApmldv.z, zeroCoordinateAdjustedManipulatorPosition.w)); + } + + // Log every 5 hz + if (Time.time - _lastLoggedTime >= 0.2) + { + _lastLoggedTime = Time.time; + var tipPos = _probeController.ProbeTipT.position; + + // ["ephys_link", Real time stamp, Manipulator ID, X, Y, Z, W, Phi, Theta, Spin, TipX, TipY, TipZ] + string[] data = + { + "ephys_link", Time.realtimeSinceStartup.ToString(CultureInfo.InvariantCulture), ManipulatorID, + pos.x.ToString(CultureInfo.InvariantCulture), pos.y.ToString(CultureInfo.InvariantCulture), + pos.z.ToString(CultureInfo.InvariantCulture), pos.w.ToString(CultureInfo.InvariantCulture), + _probeController.Insertion.yaw.ToString(CultureInfo.InvariantCulture), + _probeController.Insertion.pitch.ToString(CultureInfo.InvariantCulture), + _probeController.Insertion.roll.ToString(CultureInfo.InvariantCulture), + tipPos.x.ToString(CultureInfo.InvariantCulture), tipPos.y.ToString(CultureInfo.InvariantCulture), + tipPos.z.ToString(CultureInfo.InvariantCulture) + }; + OutputLog.Log(data); + } + + // Continue echoing position + CommunicationManager.Instance.GetPos(ManipulatorID, EchoPosition); + } + + #endregion + #region Public Methods public void Initialize(string manipulatorID, bool calibrated) @@ -207,22 +290,20 @@ public Vector4 ConvertInsertionToManipulatorPosition(Vector3 insertionAPMLDV) var convertToWorld = _probeManager.ProbeController.Insertion.Transformed2WorldAxisChange(insertionAPMLDV); // Convert to Sensapex space - var posInManipulatorSpace = - _probeManager.ManipulatorBehaviorController.CoordinateSpace.World2Space(convertToWorld); - Vector4 posInManipulatorTransform = - _probeManager.ManipulatorBehaviorController.Transform.Space2Transform(posInManipulatorSpace); + var posInManipulatorSpace = CoordinateSpace.World2Space(convertToWorld); + Vector4 posInManipulatorTransform = Transform.Space2Transform(posInManipulatorSpace); // Apply brain surface offset - var brainSurfaceAdjustment = float.IsNaN(_probeManager.ManipulatorBehaviorController.BrainSurfaceOffset) + var brainSurfaceAdjustment = float.IsNaN(BrainSurfaceOffset) ? 0 - : _probeManager.ManipulatorBehaviorController.BrainSurfaceOffset; + : BrainSurfaceOffset; if (_probeManager.ManipulatorBehaviorController.IsSetToDropToSurfaceWithDepth) posInManipulatorTransform.w -= brainSurfaceAdjustment; else - posInManipulatorTransform.z -= brainSurfaceAdjustment; + posInManipulatorTransform.z += brainSurfaceAdjustment; // Apply coordinate offsets and return result - return posInManipulatorTransform + _probeManager.ManipulatorBehaviorController.ZeroCoordinateOffset; + return posInManipulatorTransform + ZeroCoordinateOffset; } /// @@ -333,89 +414,5 @@ public void MoveBackToZeroCoordinate(Action onSuccessCallback, Action - { - _probeController.SetProbeAngles(angles); - _probeController.SetProbePosition(new Vector3(pos.y, pos.x, pos.z)); - }); - } - else - { - // Calculate last used direction for dropping to brain surface (between depth and DV) - var dvDelta = Math.Abs(pos.z - _lastManipulatorPosition.z); - var depthDelta = Math.Abs(pos.w - _lastManipulatorPosition.w); - if (dvDelta > 0.0001 || depthDelta > 0.0001) IsSetToDropToSurfaceWithDepth = depthDelta > dvDelta; - _lastManipulatorPosition = pos; - - // Apply zero coordinate offset - var zeroCoordinateAdjustedManipulatorPosition = pos - ZeroCoordinateOffset; - - // Convert to coordinate space - var manipulatorSpacePosition = - Transform.Transform2Space(zeroCoordinateAdjustedManipulatorPosition); - - // Brain surface adjustment - var brainSurfaceAdjustment = float.IsNaN(BrainSurfaceOffset) ? 0 : BrainSurfaceOffset; - if (IsSetToDropToSurfaceWithDepth) - zeroCoordinateAdjustedManipulatorPosition.w += brainSurfaceAdjustment; - else - manipulatorSpacePosition.z -= brainSurfaceAdjustment; - - // Convert to world space - var zeroCoordinateAdjustedWorldPosition = - CoordinateSpace.Space2World(manipulatorSpacePosition); - - // print("pos: " + pos + "; manipulator: " + manipulatorSpacePosition + "; world: " + - // zeroCoordinateAdjustedWorldPosition); - - // Set probe position (change axes to match probe) - var transformedApmldv = - _probeController.Insertion.World2TransformedAxisChange(zeroCoordinateAdjustedWorldPosition); - - // FIXME: Dependent on Manipulator Type. Should be standardized by Ephys Link. - if (ManipulatorType == "new_scale") - _probeController.SetProbePosition(new Vector4(transformedApmldv.x, transformedApmldv.y, - transformedApmldv.z, 0)); - else - _probeController.SetProbePosition(new Vector4(transformedApmldv.x, transformedApmldv.y, - transformedApmldv.z, zeroCoordinateAdjustedManipulatorPosition.w)); - } - - // Log every 5 hz - if (Time.time - _lastLoggedTime >= 0.2) - { - _lastLoggedTime = Time.time; - var tipPos = _probeController.ProbeTipT.position; - - // ["ephys_link", Real time stamp, Manipulator ID, X, Y, Z, W, Phi, Theta, Spin, TipX, TipY, TipZ] - string[] data = - { - "ephys_link", Time.realtimeSinceStartup.ToString(CultureInfo.InvariantCulture), ManipulatorID, - pos.x.ToString(CultureInfo.InvariantCulture), pos.y.ToString(CultureInfo.InvariantCulture), - pos.z.ToString(CultureInfo.InvariantCulture), pos.w.ToString(CultureInfo.InvariantCulture), - _probeController.Insertion.yaw.ToString(CultureInfo.InvariantCulture), - _probeController.Insertion.pitch.ToString(CultureInfo.InvariantCulture), - _probeController.Insertion.roll.ToString(CultureInfo.InvariantCulture), - tipPos.x.ToString(CultureInfo.InvariantCulture), tipPos.y.ToString(CultureInfo.InvariantCulture), - tipPos.z.ToString(CultureInfo.InvariantCulture) - }; - OutputLog.Log(data); - } - - // Continue echoing position - CommunicationManager.Instance.GetPos(ManipulatorID, EchoPosition); - } - - #endregion } } \ No newline at end of file From 1d7fd49e309851218ece23c7c8327069e26e121f Mon Sep 17 00:00:00 2001 From: Kenneth Yang Date: Thu, 5 Oct 2023 17:40:35 -0700 Subject: [PATCH 16/78] WIP trying to fix 3-axis rotations --- .../CoordinateSystems/ThreeAxisLeftTransform.cs | 13 +++++++++---- .../Probes/ManipulatorBehaviorController.cs | 10 +++++++--- 2 files changed, 16 insertions(+), 7 deletions(-) diff --git a/Assets/Scripts/Core/CoordinateSystems/ThreeAxisLeftTransform.cs b/Assets/Scripts/Core/CoordinateSystems/ThreeAxisLeftTransform.cs index 7f73e4f2..a39c8006 100644 --- a/Assets/Scripts/Core/CoordinateSystems/ThreeAxisLeftTransform.cs +++ b/Assets/Scripts/Core/CoordinateSystems/ThreeAxisLeftTransform.cs @@ -9,11 +9,16 @@ public class ThreeAxisLeftTransform : CoordinateTransform public ThreeAxisLeftTransform(float yaw, float pitch) { - var yawRotation = Quaternion.AngleAxis(yaw, Vector3.down); - var pitchRotation = Quaternion.AngleAxis(pitch, yawRotation * Vector3.left); - - _rotation = yawRotation * pitchRotation; + // var yawRotation = Quaternion.AngleAxis(-yaw, Vector3.up); + // var pitchRotation = Quaternion.AngleAxis(pitch, Vector3.right); + // + // _rotation = yawRotation * pitchRotation; + _rotation = Quaternion.Euler(pitch, -yaw, 0); _inverseRotation = Quaternion.Inverse(_rotation); + + Debug.DrawRay(Vector3.zero, _rotation * Vector3.back, Color.cyan, 1000); + Debug.DrawRay(Vector3.zero, _rotation * Vector3.up, Color.green, 1000); + Debug.DrawRay(Vector3.zero, _rotation * Vector3.left, Color.red, 1000); } public override string Name => "Three Axis Left"; diff --git a/Assets/Scripts/TrajectoryPlanner/Probes/ManipulatorBehaviorController.cs b/Assets/Scripts/TrajectoryPlanner/Probes/ManipulatorBehaviorController.cs index a51b4e90..910c8f89 100644 --- a/Assets/Scripts/TrajectoryPlanner/Probes/ManipulatorBehaviorController.cs +++ b/Assets/Scripts/TrajectoryPlanner/Probes/ManipulatorBehaviorController.cs @@ -179,13 +179,13 @@ private void EchoPosition(Vector4 pos) var zeroCoordinateAdjustedWorldPosition = CoordinateSpace.Space2World(manipulatorSpacePosition); - print("pos: " + pos + "; manipulator: " + manipulatorSpacePosition + "; world: " + - zeroCoordinateAdjustedWorldPosition); - // Set probe position (change axes to match probe) var transformedApmldv = _probeController.Insertion.World2TransformedAxisChange(zeroCoordinateAdjustedWorldPosition); + print("pos: " + pos + "; manipulator: " + manipulatorSpacePosition + "; world: " + + zeroCoordinateAdjustedWorldPosition+"; transformed: "+transformedApmldv); + // FIXME: Dependent on Manipulator Type. Should be standardized by Ephys Link. if (ManipulatorType == "new_scale") _probeController.SetProbePosition(transformedApmldv); @@ -365,6 +365,10 @@ public void MoveByWorldSpaceDelta(Vector4 worldSpaceDelta, Action onSucces var manipulatorTransformDelta = Transform.Space2Transform(manipulatorSpaceDelta); var manipulatorSpaceDepth = worldSpaceDelta.w; + // print("World space delta: " + worldSpaceDelta + "; Manipulator space delta: " + manipulatorSpaceDelta + + // "; Manipulator transform delta: " + manipulatorTransformDelta + "; Manipulator space depth: " + + // manipulatorSpaceDepth); + // Get manipulator position CommunicationManager.Instance.GetPos(ManipulatorID, pos => { From 40efc2aed19ed2dee64f543ca0f127b17cffe7d0 Mon Sep 17 00:00:00 2001 From: Kenneth Yang Date: Fri, 6 Oct 2023 20:26:49 -0700 Subject: [PATCH 17/78] WIP drew axes of transform and "fixed" rotations --- .../ThreeAxisLeftTransform.cs | 13 ++++-------- .../Probes/ManipulatorBehaviorController.cs | 20 +++++++++++++------ 2 files changed, 18 insertions(+), 15 deletions(-) diff --git a/Assets/Scripts/Core/CoordinateSystems/ThreeAxisLeftTransform.cs b/Assets/Scripts/Core/CoordinateSystems/ThreeAxisLeftTransform.cs index a39c8006..63ad3cfd 100644 --- a/Assets/Scripts/Core/CoordinateSystems/ThreeAxisLeftTransform.cs +++ b/Assets/Scripts/Core/CoordinateSystems/ThreeAxisLeftTransform.cs @@ -9,16 +9,11 @@ public class ThreeAxisLeftTransform : CoordinateTransform public ThreeAxisLeftTransform(float yaw, float pitch) { - // var yawRotation = Quaternion.AngleAxis(-yaw, Vector3.up); - // var pitchRotation = Quaternion.AngleAxis(pitch, Vector3.right); - // - // _rotation = yawRotation * pitchRotation; - _rotation = Quaternion.Euler(pitch, -yaw, 0); + var yawRotation = Quaternion.AngleAxis(yaw, Vector3.up); + var pitchRotation = Quaternion.AngleAxis(pitch, Vector3.right); + + _rotation = yawRotation * pitchRotation; _inverseRotation = Quaternion.Inverse(_rotation); - - Debug.DrawRay(Vector3.zero, _rotation * Vector3.back, Color.cyan, 1000); - Debug.DrawRay(Vector3.zero, _rotation * Vector3.up, Color.green, 1000); - Debug.DrawRay(Vector3.zero, _rotation * Vector3.left, Color.red, 1000); } public override string Name => "Three Axis Left"; diff --git a/Assets/Scripts/TrajectoryPlanner/Probes/ManipulatorBehaviorController.cs b/Assets/Scripts/TrajectoryPlanner/Probes/ManipulatorBehaviorController.cs index 910c8f89..178ead2e 100644 --- a/Assets/Scripts/TrajectoryPlanner/Probes/ManipulatorBehaviorController.cs +++ b/Assets/Scripts/TrajectoryPlanner/Probes/ManipulatorBehaviorController.cs @@ -183,9 +183,17 @@ private void EchoPosition(Vector4 pos) var transformedApmldv = _probeController.Insertion.World2TransformedAxisChange(zeroCoordinateAdjustedWorldPosition); - print("pos: " + pos + "; manipulator: " + manipulatorSpacePosition + "; world: " + - zeroCoordinateAdjustedWorldPosition+"; transformed: "+transformedApmldv); - + // print("pos: " + pos + "; manipulator: " + manipulatorSpacePosition + "; world: " + + // zeroCoordinateAdjustedWorldPosition + "; transformed: " + transformedApmldv); + + Debug.DrawRay(_probeController.ProbeTipT.position, + Transform.Space2Transform(CoordinateSpace.World2SpaceAxisChange(Vector3.forward)), Color.cyan, + 0.5f); + Debug.DrawRay(_probeController.ProbeTipT.position, + Transform.Space2Transform(CoordinateSpace.World2SpaceAxisChange(Vector3.up)), Color.green, 0.5f); + Debug.DrawRay(_probeController.ProbeTipT.position, + Transform.Space2Transform(CoordinateSpace.World2SpaceAxisChange(Vector3.right)), Color.red, 0.5f); + // FIXME: Dependent on Manipulator Type. Should be standardized by Ephys Link. if (ManipulatorType == "new_scale") _probeController.SetProbePosition(transformedApmldv); @@ -365,9 +373,9 @@ public void MoveByWorldSpaceDelta(Vector4 worldSpaceDelta, Action onSucces var manipulatorTransformDelta = Transform.Space2Transform(manipulatorSpaceDelta); var manipulatorSpaceDepth = worldSpaceDelta.w; - // print("World space delta: " + worldSpaceDelta + "; Manipulator space delta: " + manipulatorSpaceDelta + - // "; Manipulator transform delta: " + manipulatorTransformDelta + "; Manipulator space depth: " + - // manipulatorSpaceDepth); + print("World space delta: " + worldSpaceDelta + "; Manipulator space delta: " + manipulatorSpaceDelta + + "; Manipulator transform delta: " + manipulatorTransformDelta + "; Manipulator space depth: " + + manipulatorSpaceDepth); // Get manipulator position CommunicationManager.Instance.GetPos(ManipulatorID, pos => From 3faed20960e1bac7375068d09263441352c54bfa Mon Sep 17 00:00:00 2001 From: Kenneth Yang Date: Mon, 9 Oct 2023 17:31:01 -0700 Subject: [PATCH 18/78] Fix transform operations again --- .../Core/CoordinateSystems/ThreeAxisLeftTransform.cs | 4 ++-- .../Probes/ManipulatorBehaviorController.cs | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Assets/Scripts/Core/CoordinateSystems/ThreeAxisLeftTransform.cs b/Assets/Scripts/Core/CoordinateSystems/ThreeAxisLeftTransform.cs index 63ad3cfd..8df524be 100644 --- a/Assets/Scripts/Core/CoordinateSystems/ThreeAxisLeftTransform.cs +++ b/Assets/Scripts/Core/CoordinateSystems/ThreeAxisLeftTransform.cs @@ -9,10 +9,10 @@ public class ThreeAxisLeftTransform : CoordinateTransform public ThreeAxisLeftTransform(float yaw, float pitch) { - var yawRotation = Quaternion.AngleAxis(yaw, Vector3.up); + var yawRotation = Quaternion.AngleAxis(-yaw, Vector3.up); var pitchRotation = Quaternion.AngleAxis(pitch, Vector3.right); - _rotation = yawRotation * pitchRotation; + _rotation = pitchRotation * yawRotation; _inverseRotation = Quaternion.Inverse(_rotation); } diff --git a/Assets/Scripts/TrajectoryPlanner/Probes/ManipulatorBehaviorController.cs b/Assets/Scripts/TrajectoryPlanner/Probes/ManipulatorBehaviorController.cs index 178ead2e..3db92477 100644 --- a/Assets/Scripts/TrajectoryPlanner/Probes/ManipulatorBehaviorController.cs +++ b/Assets/Scripts/TrajectoryPlanner/Probes/ManipulatorBehaviorController.cs @@ -187,12 +187,12 @@ private void EchoPosition(Vector4 pos) // zeroCoordinateAdjustedWorldPosition + "; transformed: " + transformedApmldv); Debug.DrawRay(_probeController.ProbeTipT.position, - Transform.Space2Transform(CoordinateSpace.World2SpaceAxisChange(Vector3.forward)), Color.cyan, + CoordinateSpace.Space2WorldAxisChange(Transform.Transform2Space(Vector3.forward)), Color.cyan, 0.5f); Debug.DrawRay(_probeController.ProbeTipT.position, - Transform.Space2Transform(CoordinateSpace.World2SpaceAxisChange(Vector3.up)), Color.green, 0.5f); + CoordinateSpace.Space2WorldAxisChange(Transform.Transform2Space(Vector3.up)), Color.green, 0.5f); Debug.DrawRay(_probeController.ProbeTipT.position, - Transform.Space2Transform(CoordinateSpace.World2SpaceAxisChange(Vector3.right)), Color.red, 0.5f); + CoordinateSpace.Space2WorldAxisChange(Transform.Transform2Space(Vector3.right)), Color.red, 0.5f); // FIXME: Dependent on Manipulator Type. Should be standardized by Ephys Link. if (ManipulatorType == "new_scale") From 97130ed969a119cba80b54c4ed76431e8cf00a94 Mon Sep 17 00:00:00 2001 From: Kenneth Yang Date: Tue, 10 Oct 2023 11:07:57 -0700 Subject: [PATCH 19/78] Renamed transforms --- .../FourAxisLeftHandedManipulatorTransform.cs | 14 ++++++++++++++ ...ourAxisLeftHandedManipulatorTransform.cs.meta} | 0 .../FourAxisRightHandedManipulatorTransform.cs | 15 +++++++++++++++ ...urAxisRightHandedManipulatorTransform.cs.meta} | 0 .../LeftHandedManipulatorTransform.cs | 14 -------------- .../RightHandedManipulatorTransform.cs | 15 --------------- ...ansform.cs => ThreeAxisLeftHandedTransform.cs} | 8 ++++---- ....meta => ThreeAxisLeftHandedTransform.cs.meta} | 0 .../Probes/ManipulatorBehaviorController.cs | 13 ++++--------- 9 files changed, 37 insertions(+), 42 deletions(-) create mode 100644 Assets/Scripts/Core/CoordinateSystems/FourAxisLeftHandedManipulatorTransform.cs rename Assets/Scripts/Core/CoordinateSystems/{LeftHandedManipulatorTransform.cs.meta => FourAxisLeftHandedManipulatorTransform.cs.meta} (100%) create mode 100644 Assets/Scripts/Core/CoordinateSystems/FourAxisRightHandedManipulatorTransform.cs rename Assets/Scripts/Core/CoordinateSystems/{RightHandedManipulatorTransform.cs.meta => FourAxisRightHandedManipulatorTransform.cs.meta} (100%) delete mode 100644 Assets/Scripts/Core/CoordinateSystems/LeftHandedManipulatorTransform.cs delete mode 100644 Assets/Scripts/Core/CoordinateSystems/RightHandedManipulatorTransform.cs rename Assets/Scripts/Core/CoordinateSystems/{ThreeAxisLeftTransform.cs => ThreeAxisLeftHandedTransform.cs} (79%) rename Assets/Scripts/Core/CoordinateSystems/{ThreeAxisLeftTransform.cs.meta => ThreeAxisLeftHandedTransform.cs.meta} (100%) diff --git a/Assets/Scripts/Core/CoordinateSystems/FourAxisLeftHandedManipulatorTransform.cs b/Assets/Scripts/Core/CoordinateSystems/FourAxisLeftHandedManipulatorTransform.cs new file mode 100644 index 00000000..a0e4af9c --- /dev/null +++ b/Assets/Scripts/Core/CoordinateSystems/FourAxisLeftHandedManipulatorTransform.cs @@ -0,0 +1,14 @@ +using UnityEngine; + +namespace CoordinateTransforms +{ + public sealed class FourAxisLeftHandedManipulatorTransform : AffineTransform + { + public FourAxisLeftHandedManipulatorTransform(float phi) : base(Vector3.one, new Vector3(0, -phi, 0)) + { + } + + public override string Name => "Four Axis Left Handed Manipulator"; + public override string Prefix => "4lhm"; + } +} \ No newline at end of file diff --git a/Assets/Scripts/Core/CoordinateSystems/LeftHandedManipulatorTransform.cs.meta b/Assets/Scripts/Core/CoordinateSystems/FourAxisLeftHandedManipulatorTransform.cs.meta similarity index 100% rename from Assets/Scripts/Core/CoordinateSystems/LeftHandedManipulatorTransform.cs.meta rename to Assets/Scripts/Core/CoordinateSystems/FourAxisLeftHandedManipulatorTransform.cs.meta diff --git a/Assets/Scripts/Core/CoordinateSystems/FourAxisRightHandedManipulatorTransform.cs b/Assets/Scripts/Core/CoordinateSystems/FourAxisRightHandedManipulatorTransform.cs new file mode 100644 index 00000000..0a3c6b93 --- /dev/null +++ b/Assets/Scripts/Core/CoordinateSystems/FourAxisRightHandedManipulatorTransform.cs @@ -0,0 +1,15 @@ +using UnityEngine; + +namespace CoordinateTransforms +{ + public class FourAxisRightHandedManipulatorTransform : AffineTransform + { + public override string Name => "Four Axis Right Handed Manipulator"; + public override string Prefix => "4rhm"; + + public FourAxisRightHandedManipulatorTransform(float phi) : base(2 * Vector3.left + Vector3.one, + new Vector3(0, -phi, 0)) + { + } + } +} \ No newline at end of file diff --git a/Assets/Scripts/Core/CoordinateSystems/RightHandedManipulatorTransform.cs.meta b/Assets/Scripts/Core/CoordinateSystems/FourAxisRightHandedManipulatorTransform.cs.meta similarity index 100% rename from Assets/Scripts/Core/CoordinateSystems/RightHandedManipulatorTransform.cs.meta rename to Assets/Scripts/Core/CoordinateSystems/FourAxisRightHandedManipulatorTransform.cs.meta diff --git a/Assets/Scripts/Core/CoordinateSystems/LeftHandedManipulatorTransform.cs b/Assets/Scripts/Core/CoordinateSystems/LeftHandedManipulatorTransform.cs deleted file mode 100644 index e25545a2..00000000 --- a/Assets/Scripts/Core/CoordinateSystems/LeftHandedManipulatorTransform.cs +++ /dev/null @@ -1,14 +0,0 @@ -using UnityEngine; - -namespace CoordinateTransforms -{ - public sealed class LeftHandedManipulatorTransform : AffineTransform - { - public LeftHandedManipulatorTransform(float phi) : base(Vector3.one, new Vector3(0, -phi, 0)) - { - } - - public override string Name => "Left Handed Manipulator"; - public override string Prefix => "lhm"; - } -} \ No newline at end of file diff --git a/Assets/Scripts/Core/CoordinateSystems/RightHandedManipulatorTransform.cs b/Assets/Scripts/Core/CoordinateSystems/RightHandedManipulatorTransform.cs deleted file mode 100644 index b625cc91..00000000 --- a/Assets/Scripts/Core/CoordinateSystems/RightHandedManipulatorTransform.cs +++ /dev/null @@ -1,15 +0,0 @@ -using UnityEngine; - -namespace CoordinateTransforms -{ - public class RightHandedManipulatorTransform : AffineTransform - { - public override string Name => "Four Axis Right"; - public override string Prefix => "4r"; - - public RightHandedManipulatorTransform(float phi) : base(2 * Vector3.left + Vector3.one, - new Vector3(0, -phi, 0)) - { - } - } -} \ No newline at end of file diff --git a/Assets/Scripts/Core/CoordinateSystems/ThreeAxisLeftTransform.cs b/Assets/Scripts/Core/CoordinateSystems/ThreeAxisLeftHandedTransform.cs similarity index 79% rename from Assets/Scripts/Core/CoordinateSystems/ThreeAxisLeftTransform.cs rename to Assets/Scripts/Core/CoordinateSystems/ThreeAxisLeftHandedTransform.cs index 8df524be..ce89b53b 100644 --- a/Assets/Scripts/Core/CoordinateSystems/ThreeAxisLeftTransform.cs +++ b/Assets/Scripts/Core/CoordinateSystems/ThreeAxisLeftHandedTransform.cs @@ -2,12 +2,12 @@ namespace CoordinateTransforms { - public class ThreeAxisLeftTransform : CoordinateTransform + public class ThreeAxisLeftHandedTransform : CoordinateTransform { private readonly Quaternion _inverseRotation; private readonly Quaternion _rotation; - public ThreeAxisLeftTransform(float yaw, float pitch) + public ThreeAxisLeftHandedTransform(float yaw, float pitch) { var yawRotation = Quaternion.AngleAxis(-yaw, Vector3.up); var pitchRotation = Quaternion.AngleAxis(pitch, Vector3.right); @@ -16,8 +16,8 @@ public ThreeAxisLeftTransform(float yaw, float pitch) _inverseRotation = Quaternion.Inverse(_rotation); } - public override string Name => "Three Axis Left"; - public override string Prefix => "3l"; + public override string Name => "Three Axis Left Handed Manipulator"; + public override string Prefix => "3lhm"; public override Vector3 Transform2Space(Vector3 coordTransformed) { diff --git a/Assets/Scripts/Core/CoordinateSystems/ThreeAxisLeftTransform.cs.meta b/Assets/Scripts/Core/CoordinateSystems/ThreeAxisLeftHandedTransform.cs.meta similarity index 100% rename from Assets/Scripts/Core/CoordinateSystems/ThreeAxisLeftTransform.cs.meta rename to Assets/Scripts/Core/CoordinateSystems/ThreeAxisLeftHandedTransform.cs.meta diff --git a/Assets/Scripts/TrajectoryPlanner/Probes/ManipulatorBehaviorController.cs b/Assets/Scripts/TrajectoryPlanner/Probes/ManipulatorBehaviorController.cs index 3db92477..4a061f3f 100644 --- a/Assets/Scripts/TrajectoryPlanner/Probes/ManipulatorBehaviorController.cs +++ b/Assets/Scripts/TrajectoryPlanner/Probes/ManipulatorBehaviorController.cs @@ -277,19 +277,14 @@ void StartEchoing() public void UpdateSpaceAndTransform() { + CoordinateSpace = new ManipulatorSpace(); if (ManipulatorType == "sensapex") - { - CoordinateSpace = new ManipulatorSpace(); Transform = IsRightHanded - ? new RightHandedManipulatorTransform(_probeController.Insertion.yaw) - : new LeftHandedManipulatorTransform(_probeController.Insertion.yaw); - } + ? new FourAxisRightHandedManipulatorTransform(_probeController.Insertion.yaw) + : new FourAxisLeftHandedManipulatorTransform(_probeController.Insertion.yaw); else - { - CoordinateSpace = new ManipulatorSpace(); - Transform = new ThreeAxisLeftTransform(_probeController.Insertion.yaw, + Transform = new ThreeAxisLeftHandedTransform(_probeController.Insertion.yaw, _probeController.Insertion.pitch); - } } public Vector4 ConvertInsertionToManipulatorPosition(Vector3 insertionAPMLDV) From 5ef525fee3a95bd30638ffa71e42e43d6ecb1d3a Mon Sep 17 00:00:00 2001 From: Kenneth Yang Date: Tue, 10 Oct 2023 11:24:26 -0700 Subject: [PATCH 20/78] Add dimension setter --- .../Core/CoordinateSystems/CoordinateSpace.cs | 2 +- .../Core/CoordinateSystems/ManipulatorSpace.cs | 10 +++++----- .../Probes/ManipulatorBehaviorController.cs | 15 ++------------- 3 files changed, 8 insertions(+), 19 deletions(-) diff --git a/Assets/Scripts/Core/CoordinateSystems/CoordinateSpace.cs b/Assets/Scripts/Core/CoordinateSystems/CoordinateSpace.cs index c7ae785b..8a31ad0a 100644 --- a/Assets/Scripts/Core/CoordinateSystems/CoordinateSpace.cs +++ b/Assets/Scripts/Core/CoordinateSystems/CoordinateSpace.cs @@ -9,7 +9,7 @@ public abstract class CoordinateSpace { public abstract string Name { get; } - public abstract Vector3 Dimensions { get; } + public abstract Vector3 Dimensions { get; set; } public Vector3 RelativeOffset { get; set; } = Vector3.zero; diff --git a/Assets/Scripts/Core/CoordinateSystems/ManipulatorSpace.cs b/Assets/Scripts/Core/CoordinateSystems/ManipulatorSpace.cs index 9aba7f6f..d73aaa69 100644 --- a/Assets/Scripts/Core/CoordinateSystems/ManipulatorSpace.cs +++ b/Assets/Scripts/Core/CoordinateSystems/ManipulatorSpace.cs @@ -1,5 +1,3 @@ -using System.Collections; -using System.Collections.Generic; using UnityEngine; namespace CoordinateSpaces @@ -7,7 +5,10 @@ namespace CoordinateSpaces public sealed class ManipulatorSpace : CoordinateSpace { public override string Name => "Manipulator"; - public override Vector3 Dimensions => new(20, 20, 20); + + // Default to Sensapex dimensions, but can be edited + public override Vector3 Dimensions { get; set; } = Vector3.one * 20; + public override Vector3 Space2World(Vector3 coord) { return new Vector3(-coord.x, coord.y, -coord.z); @@ -28,5 +29,4 @@ public override Vector3 World2SpaceAxisChange(Vector3 world) return World2Space(world); } } -} - +} \ No newline at end of file diff --git a/Assets/Scripts/TrajectoryPlanner/Probes/ManipulatorBehaviorController.cs b/Assets/Scripts/TrajectoryPlanner/Probes/ManipulatorBehaviorController.cs index 4a061f3f..9bcdcb2c 100644 --- a/Assets/Scripts/TrajectoryPlanner/Probes/ManipulatorBehaviorController.cs +++ b/Assets/Scripts/TrajectoryPlanner/Probes/ManipulatorBehaviorController.cs @@ -183,19 +183,8 @@ private void EchoPosition(Vector4 pos) var transformedApmldv = _probeController.Insertion.World2TransformedAxisChange(zeroCoordinateAdjustedWorldPosition); - // print("pos: " + pos + "; manipulator: " + manipulatorSpacePosition + "; world: " + - // zeroCoordinateAdjustedWorldPosition + "; transformed: " + transformedApmldv); - - Debug.DrawRay(_probeController.ProbeTipT.position, - CoordinateSpace.Space2WorldAxisChange(Transform.Transform2Space(Vector3.forward)), Color.cyan, - 0.5f); - Debug.DrawRay(_probeController.ProbeTipT.position, - CoordinateSpace.Space2WorldAxisChange(Transform.Transform2Space(Vector3.up)), Color.green, 0.5f); - Debug.DrawRay(_probeController.ProbeTipT.position, - CoordinateSpace.Space2WorldAxisChange(Transform.Transform2Space(Vector3.right)), Color.red, 0.5f); - - // FIXME: Dependent on Manipulator Type. Should be standardized by Ephys Link. - if (ManipulatorType == "new_scale") + // Split between 3 and 4 axis assignments + if (Transform.Prefix == "3lhm") _probeController.SetProbePosition(transformedApmldv); else _probeController.SetProbePosition(new Vector4(transformedApmldv.x, transformedApmldv.y, From aa84c8a6bbecc378bb751540198747b8c8a8395a Mon Sep 17 00:00:00 2001 From: Kenneth Yang Date: Tue, 10 Oct 2023 11:53:34 -0700 Subject: [PATCH 21/78] Removed old spaces --- .../Core/CoordinateSystems/CCFSpace.cs | 9 +--- .../Core/CoordinateSystems/CCFSpace25.cs | 9 ++-- .../Core/CoordinateSystems/NewScaleSpace.cs | 41 ------------------- .../CoordinateSystems/NewScaleSpace.cs.meta | 11 ----- .../Core/CoordinateSystems/SensapexSpace.cs | 32 --------------- .../CoordinateSystems/SensapexSpace.cs.meta | 11 ----- 6 files changed, 5 insertions(+), 108 deletions(-) delete mode 100644 Assets/Scripts/Core/CoordinateSystems/NewScaleSpace.cs delete mode 100644 Assets/Scripts/Core/CoordinateSystems/NewScaleSpace.cs.meta delete mode 100644 Assets/Scripts/Core/CoordinateSystems/SensapexSpace.cs delete mode 100644 Assets/Scripts/Core/CoordinateSystems/SensapexSpace.cs.meta diff --git a/Assets/Scripts/Core/CoordinateSystems/CCFSpace.cs b/Assets/Scripts/Core/CoordinateSystems/CCFSpace.cs index 963a4994..fe23fa59 100644 --- a/Assets/Scripts/Core/CoordinateSystems/CCFSpace.cs +++ b/Assets/Scripts/Core/CoordinateSystems/CCFSpace.cs @@ -8,16 +8,9 @@ namespace CoordinateSpaces public sealed class CCFSpace : CoordinateSpace { private string _name = "CCF"; - private Vector3 _dimensions = new Vector3(13.2f, 11.4f, 8f); private Vector3 _zeroOffset = new Vector3(-5.7f, -4.0f, +6.6f); // note: zero offset is in *world* coordinates! - public override Vector3 Dimensions - { - get - { - return _dimensions; - } - } + public override Vector3 Dimensions { get; set; } = new(13.2f, 11.4f, 8f); public override string Name { get => _name; } diff --git a/Assets/Scripts/Core/CoordinateSystems/CCFSpace25.cs b/Assets/Scripts/Core/CoordinateSystems/CCFSpace25.cs index 94330831..02775fa3 100644 --- a/Assets/Scripts/Core/CoordinateSystems/CCFSpace25.cs +++ b/Assets/Scripts/Core/CoordinateSystems/CCFSpace25.cs @@ -10,17 +10,16 @@ namespace CoordinateSpaces public sealed class CCFSpace25 : CoordinateSpace { private static string _name = "CCF_25um"; - private static Vector3 _dimensions = new Vector3(528, 456, 320); + private static Vector3 _dimensions = new(528, 456, 320); private static Vector3 _zeroOffset = new Vector3(-5.7f, -4.0f, +6.6f); public override Vector3 Dimensions { - get - { - return _dimensions; - } + get => _dimensions; + set => _dimensions = value; } + public override string Name { get => _name; } public override Vector3 Space2World(Vector3 coord) diff --git a/Assets/Scripts/Core/CoordinateSystems/NewScaleSpace.cs b/Assets/Scripts/Core/CoordinateSystems/NewScaleSpace.cs deleted file mode 100644 index bfb9f88b..00000000 --- a/Assets/Scripts/Core/CoordinateSystems/NewScaleSpace.cs +++ /dev/null @@ -1,41 +0,0 @@ -using UnityEngine; - -namespace CoordinateSpaces -{ - public class NewScaleSpace : CoordinateSpace - { - public override string Name => "NewScale"; - public override Vector3 Dimensions => new(15, 15, 15); - - /// - /// Convert coordinates from New Scale space to Unity world space - /// - /// X, Y, Z coordinate in Sensapex space - /// World space coordinates - public override Vector3 Space2World(Vector3 coord) - { - return new Vector3(coord.x, coord.z, -coord.y); - } - - /// - /// Convert coordinates from world space to New Scale space - /// - /// X, Y, Z coordinates in World space - /// New Scale Space coordinates - public override Vector3 World2Space(Vector3 world) - { - return new Vector3(world.x, -world.z, world.y); - } - - public override Vector3 Space2WorldAxisChange(Vector3 coord) - { - return Space2World(coord); - } - - public override Vector3 World2SpaceAxisChange(Vector3 world) - { - return World2Space(world); - } - } -} - diff --git a/Assets/Scripts/Core/CoordinateSystems/NewScaleSpace.cs.meta b/Assets/Scripts/Core/CoordinateSystems/NewScaleSpace.cs.meta deleted file mode 100644 index d3b22d34..00000000 --- a/Assets/Scripts/Core/CoordinateSystems/NewScaleSpace.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 685e165f598819540b72972d72033688 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Core/CoordinateSystems/SensapexSpace.cs b/Assets/Scripts/Core/CoordinateSystems/SensapexSpace.cs deleted file mode 100644 index 0f0aa74f..00000000 --- a/Assets/Scripts/Core/CoordinateSystems/SensapexSpace.cs +++ /dev/null @@ -1,32 +0,0 @@ -using UnityEngine; - -namespace CoordinateSpaces -{ - public sealed class SensapexSpace : CoordinateSpace - { - - public override string Name => "Sensapex"; - public override Vector3 Dimensions => new(20, 20, 20); - - - public override Vector3 Space2World(Vector3 coord) - { - return new Vector3(coord.x, coord.y, coord.z); - } - - public override Vector3 World2Space(Vector3 world) - { - return new Vector3(world.x, world.y, world.z); - } - - public override Vector3 Space2WorldAxisChange(Vector3 coord) - { - return Space2World(coord); - } - - public override Vector3 World2SpaceAxisChange(Vector3 world) - { - return World2Space(world); - } - } -} diff --git a/Assets/Scripts/Core/CoordinateSystems/SensapexSpace.cs.meta b/Assets/Scripts/Core/CoordinateSystems/SensapexSpace.cs.meta deleted file mode 100644 index 5cd8c394..00000000 --- a/Assets/Scripts/Core/CoordinateSystems/SensapexSpace.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: fd030cdccfe2da64581af5009611214f -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: From f6f7cac892561f1234a3d6b7470db7ce44a9448b Mon Sep 17 00:00:00 2001 From: Kenneth Yang Date: Tue, 10 Oct 2023 12:02:36 -0700 Subject: [PATCH 22/78] Added NumAxes and dimensions --- Assets/Scripts/EphysLink/CommunicationManager.cs | 4 ++-- Assets/Scripts/EphysLink/DataFormats.cs | 3 ++- .../Probes/ManipulatorBehaviorController.cs | 10 +++++++--- 3 files changed, 11 insertions(+), 6 deletions(-) diff --git a/Assets/Scripts/EphysLink/CommunicationManager.cs b/Assets/Scripts/EphysLink/CommunicationManager.cs index ce09c93a..02d55c53 100644 --- a/Assets/Scripts/EphysLink/CommunicationManager.cs +++ b/Assets/Scripts/EphysLink/CommunicationManager.cs @@ -182,13 +182,13 @@ public void GetVersion(Action onSuccessCallback, Action onErrorCallback /// /// Callback function to handle incoming manipulator ID's /// Callback function to handle errors - public void GetManipulators(Action onSuccessCallback, Action onErrorCallback = null) + public void GetManipulators(Action onSuccessCallback, Action onErrorCallback = null) { _connectionManager.Socket.ExpectAcknowledgement(data => { if (data.error == "") { - onSuccessCallback?.Invoke(data.manipulators, data.type); + onSuccessCallback?.Invoke(data.manipulators, data.num_axes, data.dimensions); } else { diff --git a/Assets/Scripts/EphysLink/DataFormats.cs b/Assets/Scripts/EphysLink/DataFormats.cs index b01489ea..3d937391 100644 --- a/Assets/Scripts/EphysLink/DataFormats.cs +++ b/Assets/Scripts/EphysLink/DataFormats.cs @@ -110,7 +110,8 @@ public InsideBrainInputDataFormat(string manipulatorId, bool inside) public struct GetManipulatorsCallbackParameters { public string[] manipulators; - public string type; + public int num_axes; + public float[] dimensions; public string error; } diff --git a/Assets/Scripts/TrajectoryPlanner/Probes/ManipulatorBehaviorController.cs b/Assets/Scripts/TrajectoryPlanner/Probes/ManipulatorBehaviorController.cs index 9bcdcb2c..9fbe3cee 100644 --- a/Assets/Scripts/TrajectoryPlanner/Probes/ManipulatorBehaviorController.cs +++ b/Assets/Scripts/TrajectoryPlanner/Probes/ManipulatorBehaviorController.cs @@ -31,6 +31,9 @@ public class ManipulatorBehaviorController : MonoBehaviour public string ManipulatorID { get; private set; } public string ManipulatorType { get; set; } + public int NumAxes { get; set; } + + public Vector3 Dimensions { get; set; } /** * Getter and setter or the zero coordinate offset of the manipulator. @@ -222,14 +225,15 @@ private void EchoPosition(Vector4 pos) public void Initialize(string manipulatorID, bool calibrated) { - CommunicationManager.Instance.GetManipulators((ids, type) => + CommunicationManager.Instance.GetManipulators((ids, numAxes, dimensions) => { // Shortcut exit if we have an invalid manipulator ID if (!ids.Contains(manipulatorID)) return; - // Set manipulator ID and type + // Set manipulator ID, number of axes, and dimensions ManipulatorID = manipulatorID; - ManipulatorType = type; + NumAxes = numAxes; + Dimensions = new Vector3(dimensions[0], dimensions[1], dimensions[2]); // Update transform and space UpdateSpaceAndTransform(); From 39c0fbce29547cb8f61bf714549bc1a7e06ed4dd Mon Sep 17 00:00:00 2001 From: Kenneth Yang Date: Tue, 10 Oct 2023 12:35:37 -0700 Subject: [PATCH 23/78] Integrated axes and dimensions everywhere --- .../Probes/ManipulatorBehaviorController.cs | 16 +++---- .../TrajectoryPlanner/Probes/ProbeManager.cs | 43 +++++++++---------- .../TrajectoryPlannerManager.cs | 8 ++-- .../UI/EphysLinkSettings/EphysLinkSettings.cs | 7 ++- .../ManipulatorConnectionPanel.cs | 21 +++++---- Assets/Tests/CommunicationManagerTests.cs | 3 +- 6 files changed, 46 insertions(+), 52 deletions(-) diff --git a/Assets/Scripts/TrajectoryPlanner/Probes/ManipulatorBehaviorController.cs b/Assets/Scripts/TrajectoryPlanner/Probes/ManipulatorBehaviorController.cs index 9fbe3cee..cc642d47 100644 --- a/Assets/Scripts/TrajectoryPlanner/Probes/ManipulatorBehaviorController.cs +++ b/Assets/Scripts/TrajectoryPlanner/Probes/ManipulatorBehaviorController.cs @@ -30,7 +30,6 @@ public class ManipulatorBehaviorController : MonoBehaviour public string ManipulatorID { get; private set; } - public string ManipulatorType { get; set; } public int NumAxes { get; set; } public Vector3 Dimensions { get; set; } @@ -148,7 +147,7 @@ private void EchoPosition(Vector4 pos) if (!enabled && _probeController == null) return; // Check for special pathfinder mode (directly set probe position, no calculations needed) - if (ManipulatorType.Contains("pathfinder")) + if (NumAxes == -1) { CommunicationManager.Instance.GetAngles(ManipulatorID, angles => { @@ -271,13 +270,14 @@ void StartEchoing() public void UpdateSpaceAndTransform() { CoordinateSpace = new ManipulatorSpace(); - if (ManipulatorType == "sensapex") - Transform = IsRightHanded + Transform = NumAxes switch + { + 4 => IsRightHanded ? new FourAxisRightHandedManipulatorTransform(_probeController.Insertion.yaw) - : new FourAxisLeftHandedManipulatorTransform(_probeController.Insertion.yaw); - else - Transform = new ThreeAxisLeftHandedTransform(_probeController.Insertion.yaw, - _probeController.Insertion.pitch); + : new FourAxisLeftHandedManipulatorTransform(_probeController.Insertion.yaw), + 3 => new ThreeAxisLeftHandedTransform(_probeController.Insertion.yaw, _probeController.Insertion.pitch), + _ => Transform + }; } public Vector4 ConvertInsertionToManipulatorPosition(Vector3 insertionAPMLDV) diff --git a/Assets/Scripts/TrajectoryPlanner/Probes/ProbeManager.cs b/Assets/Scripts/TrajectoryPlanner/Probes/ProbeManager.cs index 0f67d613..e12ad15d 100644 --- a/Assets/Scripts/TrajectoryPlanner/Probes/ProbeManager.cs +++ b/Assets/Scripts/TrajectoryPlanner/Probes/ProbeManager.cs @@ -1014,7 +1014,6 @@ public struct ProbeData // CoordinateSpace/Transform public string CoordSpaceName; public string CoordTransformName; - public Vector4 ZeroCoordOffset; // ChannelMap public string SelectionLayerName; @@ -1029,41 +1028,39 @@ public struct ProbeData public string APITarget; // Ephys Link - public string ManipulatorType; + public int NumAxes; public string ManipulatorID; + public Vector4 ZeroCoordOffset; + public Vector3 Dimensions; public float BrainSurfaceOffset; public bool Drop2SurfaceWithDepth; public bool IsRightHanded; public static ProbeData ProbeManager2ProbeData(ProbeManager probeManager) { - ProbeData data = new ProbeData(); - - data.APMLDV = probeManager.ProbeController.Insertion.apmldv; - data.Angles = probeManager.ProbeController.Insertion.angles; - - data.CoordSpaceName = probeManager.ProbeController.Insertion.CoordinateSpace.Name; - - if (probeManager.ProbeController.Insertion.CoordinateTransform.Name.Equals("Custom")) - data.CoordTransformName = CoordinateSpaceManager.OriginalTransform.Name; - else - data.CoordTransformName = probeManager.ProbeController.Insertion.CoordinateTransform.Name; - - data.SelectionLayerName = probeManager.SelectionLayerName; - - data.Type = (int)probeManager.ProbeType; - data.Color = probeManager.Color; - data.UUID = probeManager.UUID; - data.Name = probeManager.name; - - data.APITarget = probeManager.APITarget; + var data = new ProbeData + { + APMLDV = probeManager.ProbeController.Insertion.apmldv, + Angles = probeManager.ProbeController.Insertion.angles, + CoordSpaceName = probeManager.ProbeController.Insertion.CoordinateSpace.Name, + CoordTransformName = probeManager.ProbeController.Insertion.CoordinateTransform.Name.Equals("Custom") + ? CoordinateSpaceManager.OriginalTransform.Name + : probeManager.ProbeController.Insertion.CoordinateTransform.Name, + SelectionLayerName = probeManager.SelectionLayerName, + Type = (int)probeManager.ProbeType, + Color = probeManager.Color, + UUID = probeManager.UUID, + Name = probeManager.name, + APITarget = probeManager.APITarget + }; // Manipulator Behavior data (if it exists) if (!probeManager.ManipulatorBehaviorController) return data; - data.ManipulatorType = probeManager.ManipulatorBehaviorController.ManipulatorType; + data.NumAxes = probeManager.ManipulatorBehaviorController.NumAxes; data.ManipulatorID = probeManager.ManipulatorBehaviorController.ManipulatorID; data.ZeroCoordOffset = probeManager.ManipulatorBehaviorController.ZeroCoordinateOffset; + data.Dimensions = probeManager.ManipulatorBehaviorController.Dimensions; data.BrainSurfaceOffset = probeManager.ManipulatorBehaviorController.BrainSurfaceOffset; data.Drop2SurfaceWithDepth = probeManager.ManipulatorBehaviorController.IsSetToDropToSurfaceWithDepth; data.IsRightHanded = probeManager.ManipulatorBehaviorController.IsRightHanded; diff --git a/Assets/Scripts/TrajectoryPlanner/TrajectoryPlannerManager.cs b/Assets/Scripts/TrajectoryPlanner/TrajectoryPlannerManager.cs index cb891aa4..78aec458 100644 --- a/Assets/Scripts/TrajectoryPlanner/TrajectoryPlannerManager.cs +++ b/Assets/Scripts/TrajectoryPlanner/TrajectoryPlannerManager.cs @@ -409,7 +409,7 @@ private void RecoverActiveProbeController() coordinateSpaceOpts[probeData.CoordSpaceName], coordinateTransformOpts[probeData.CoordTransformName]); ProbeManager newProbeManager = AddNewProbe((ProbeProperties.ProbeType)probeData.Type, probeInsertion, - probeData.ManipulatorType, probeData.ManipulatorID, probeData.ZeroCoordOffset, probeData.BrainSurfaceOffset, + probeData.NumAxes, probeData.ManipulatorID, probeData.ZeroCoordOffset, probeData.BrainSurfaceOffset, probeData.Drop2SurfaceWithDepth, probeData.IsRightHanded, probeData.UUID); newProbeManager.UpdateSelectionLayer(probeData.SelectionLayerName); @@ -479,7 +479,7 @@ public ProbeManager AddNewProbe(ProbeProperties.ProbeType probeType, ProbeInsert } public ProbeManager AddNewProbe(ProbeProperties.ProbeType probeType, ProbeInsertion insertion, - string manipulatorType, string manipulatorId, Vector4 zeroCoordinateOffset, float brainSurfaceOffset, bool dropToSurfaceWithDepth, bool isRightHanded, string UUID = null) + int numAxes, string manipulatorId, Vector4 zeroCoordinateOffset, float brainSurfaceOffset, bool dropToSurfaceWithDepth, bool isRightHanded, string UUID = null) { var probeManager = AddNewProbe(probeType, UUID); @@ -491,7 +491,7 @@ public ProbeManager AddNewProbe(ProbeProperties.ProbeType probeType, ProbeInsert if (Settings.IsEphysLinkDataExpired()) return probeManager; // Repopulate Ephys Link information - probeManager.ManipulatorBehaviorController.ManipulatorType = manipulatorType; + probeManager.ManipulatorBehaviorController.NumAxes = numAxes; probeManager.ManipulatorBehaviorController.ZeroCoordinateOffset = zeroCoordinateOffset; probeManager.ManipulatorBehaviorController.BrainSurfaceOffset = brainSurfaceOffset; probeManager.ManipulatorBehaviorController.IsSetToDropToSurfaceWithDepth = dropToSurfaceWithDepth; @@ -996,7 +996,7 @@ private void LoadSavedProbesFromStringArray(string[] savedProbes) ProbeManager newProbeManager = AddNewProbe((ProbeProperties.ProbeType)probeData.Type, probeInsertion, - probeData.ManipulatorType, probeData.ManipulatorID, probeData.ZeroCoordOffset, probeData.BrainSurfaceOffset, + probeData.NumAxes, probeData.ManipulatorID, probeData.ZeroCoordOffset, probeData.BrainSurfaceOffset, probeData.Drop2SurfaceWithDepth, probeData.IsRightHanded, probeData.UUID); newProbeManager.UpdateSelectionLayer(probeData.SelectionLayerName); diff --git a/Assets/Scripts/TrajectoryPlanner/UI/EphysLinkSettings/EphysLinkSettings.cs b/Assets/Scripts/TrajectoryPlanner/UI/EphysLinkSettings/EphysLinkSettings.cs index 95f8e86c..a0cc03b9 100644 --- a/Assets/Scripts/TrajectoryPlanner/UI/EphysLinkSettings/EphysLinkSettings.cs +++ b/Assets/Scripts/TrajectoryPlanner/UI/EphysLinkSettings/EphysLinkSettings.cs @@ -89,11 +89,10 @@ private void UpdateManipulatorPanels() if (CommunicationManager.Instance.IsConnected) { - // FIXME: Dependent on Manipulator Type. Should be standardized by Ephys Link. - CommunicationManager.Instance.GetManipulators((availableIDs, type) => + CommunicationManager.Instance.GetManipulators((availableIDs, numAxes, _) => { // Enable Copilot button if using Sensapex or New Scale - _copilotToggle.interactable = !type.Contains("pathfinder"); + _copilotToggle.interactable = numAxes > 0; // Keep track of handled manipulator panels var handledManipulatorIds = new HashSet(); @@ -112,7 +111,7 @@ private void UpdateManipulatorPanels() .GetComponent(); // Set manipulator id - manipulatorConnectionSettingsPanel.Initialize(this, manipulatorID, type); + manipulatorConnectionSettingsPanel.Initialize(this, manipulatorID, numAxes); // Add to dictionary _manipulatorIdToManipulatorConnectionSettingsPanel.Add(manipulatorID, diff --git a/Assets/Scripts/TrajectoryPlanner/UI/EphysLinkSettings/ManipulatorConnectionPanel.cs b/Assets/Scripts/TrajectoryPlanner/UI/EphysLinkSettings/ManipulatorConnectionPanel.cs index 23d0df10..18c9f4f3 100644 --- a/Assets/Scripts/TrajectoryPlanner/UI/EphysLinkSettings/ManipulatorConnectionPanel.cs +++ b/Assets/Scripts/TrajectoryPlanner/UI/EphysLinkSettings/ManipulatorConnectionPanel.cs @@ -14,12 +14,12 @@ public class ManipulatorConnectionPanel : MonoBehaviour { #region Constructor - public void Initialize(EphysLinkSettings settingsMenu, string manipulatorID, string type) + public void Initialize(EphysLinkSettings settingsMenu, string manipulatorID, int numAxes) { // Set properties _ephysLinkSettings = settingsMenu; _manipulatorId = manipulatorID; - _type = type; + _numAxes = numAxes; // Get attached probe (could be null) _attachedProbe = ProbeManager.Instances.Find(manager => manager.IsEphysLinkControlled && @@ -30,7 +30,7 @@ public void Initialize(EphysLinkSettings settingsMenu, string manipulatorID, str _manipulatorIdText.text = manipulatorID; // Spawn and setup Pathfinder manipulators - if (type.Contains("pathfinder")) + if (_numAxes == -1) { // Hide all parts _handednessGroup.SetActive(false); @@ -42,7 +42,7 @@ public void Initialize(EphysLinkSettings settingsMenu, string manipulatorID, str var newProbe = trajectoryPlannerManager.AddNewProbe(ProbeProperties.ProbeType.Neuropixels1); // Configure probe and link to Ephys Link - newProbe.ManipulatorBehaviorController.ManipulatorType = type; + newProbe.ManipulatorBehaviorController.NumAxes = numAxes; newProbe.Color = Color.magenta; newProbe.name = "nsp_" + manipulatorID; newProbe.Saved = false; @@ -54,9 +54,8 @@ public void Initialize(EphysLinkSettings settingsMenu, string manipulatorID, str UpdateLinkableProbeOptions(); - // FIXME: Dependent on Manipulator Type. Should be standardized by Ephys Link. // Show or hide handedness dropdown depending on manipulator type - if (type.Contains("new_scale")) + if (numAxes == 3) { _handednessDropdown.value = 0; _handednessGroup.SetActive(false); @@ -66,12 +65,11 @@ public void Initialize(EphysLinkSettings settingsMenu, string manipulatorID, str _handednessGroup.SetActive(true); } - // FIXME: Dependent on Manipulator Type. Should be standardized by Ephys Link. // Apply handedness from memory or default to right handed, also pass along manipulator type if (_attachedProbe) { _handednessDropdown.value = _attachedProbe.ManipulatorBehaviorController.IsRightHanded ? 1 : 0; - _attachedProbe.ManipulatorBehaviorController.ManipulatorType = type; + _attachedProbe.ManipulatorBehaviorController.NumAxes = numAxes; } else { @@ -167,7 +165,7 @@ public void OnLinkedProbeSelectionChanged(int value) _ephysLinkSettings.LinkedProbes.Add(_attachedProbe); // Copy over manipulator type, handedness, and dropdown direction and enable state - _attachedProbe.ManipulatorBehaviorController.ManipulatorType = _type; + _attachedProbe.ManipulatorBehaviorController.NumAxes = _numAxes; OnManipulatorHandednessValueChanged(_handednessDropdown.value); UpdateDuraDropDirection(_duraDropDirectionDropdown.value); SetDuraDropInteractable(_attachedProbe.ManipulatorBehaviorController.BrainSurfaceOffset == 0); @@ -316,7 +314,8 @@ void PostMoveAction() /// private void UpdateProbePropertiesSectionState() { - if (_attachedProbe && !_type.Contains("pathfinder")) + // Split between having probes and whether pathfinder is being used (pathfinder has no probe properties) + if (_attachedProbe && _numAxes > 0) { _probePropertiesSection.SetActive(true); UpdateZeroCoordinateOffsetInputFields(_attachedProbe.ManipulatorBehaviorController @@ -424,7 +423,7 @@ private void UpdateBrainSurfaceOffsetInputField(float brainSurfaceOffset) private EphysLinkSettings _ephysLinkSettings; private string _manipulatorId; - private string _type; + private int _numAxes; private bool _returningToZeroCoordinate; diff --git a/Assets/Tests/CommunicationManagerTests.cs b/Assets/Tests/CommunicationManagerTests.cs index c9907cc0..51f34eb0 100644 --- a/Assets/Tests/CommunicationManagerTests.cs +++ b/Assets/Tests/CommunicationManagerTests.cs @@ -48,9 +48,8 @@ public IEnumerator Setup() // Get manipulators var state = State.None; - // FIXME: Dependent on Manipulator Type. Should be standardized by Ephys Link. _communicationManager.GetManipulators( - (returnedManipulators, _) => + (returnedManipulators, _, _) => { _manipulators = returnedManipulators; state = State.Success; From 303ffafc5d44a7355fe53ab2e3712220f3d3df98 Mon Sep 17 00:00:00 2001 From: Kenneth Yang Date: Tue, 10 Oct 2023 12:36:51 -0700 Subject: [PATCH 24/78] Bump minimum ephys link version --- Assets/Scripts/EphysLink/CommunicationManager.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Assets/Scripts/EphysLink/CommunicationManager.cs b/Assets/Scripts/EphysLink/CommunicationManager.cs index 02d55c53..33e4835b 100644 --- a/Assets/Scripts/EphysLink/CommunicationManager.cs +++ b/Assets/Scripts/EphysLink/CommunicationManager.cs @@ -20,7 +20,7 @@ public class CommunicationManager : MonoBehaviour #region Properties - public static readonly int[] EPHYS_LINK_MIN_VERSION = { 0, 9, 14 }; + public static readonly int[] EPHYS_LINK_MIN_VERSION = { 0, 9, 15 }; public static readonly string EPHYS_LINK_MIN_VERSION_STRING = "≥ v" + string.Join(".", EPHYS_LINK_MIN_VERSION); From b2c45fd9e6c03cab7d96f1f5f86776c527b7d2d8 Mon Sep 17 00:00:00 2001 From: Kenneth Yang Date: Tue, 10 Oct 2023 15:15:39 -0700 Subject: [PATCH 25/78] Add shared dura position dictionary --- .../UI/EphysCopilot/DrivePanelHandler.cs | 169 ++++++++---------- .../ResetDuraOffsetPanelHandler.cs | 27 ++- 2 files changed, 96 insertions(+), 100 deletions(-) diff --git a/Assets/Scripts/TrajectoryPlanner/UI/EphysCopilot/DrivePanelHandler.cs b/Assets/Scripts/TrajectoryPlanner/UI/EphysCopilot/DrivePanelHandler.cs index b449bf82..25cfa126 100644 --- a/Assets/Scripts/TrajectoryPlanner/UI/EphysCopilot/DrivePanelHandler.cs +++ b/Assets/Scripts/TrajectoryPlanner/UI/EphysCopilot/DrivePanelHandler.cs @@ -189,14 +189,11 @@ public void Drive() StartCoroutine(CountDownTimer(_targetDriveDuration, _driveState)); // Drive - // FIXME: Dependent on CoordinateSpace direction. Should be standardized by Ephys Link. + // Compute initial drive depth (before getting to near target distance) var driveDepth = _duraDepth; - if (Mathf.Abs(_duraDepth - _targetDepth) > NEAR_TARGET_DISTANCE) - driveDepth = _targetDepth - ProbeManager.ManipulatorBehaviorController - .CoordinateSpace - .World2SpaceAxisChange(Vector3.down).z * - NEAR_TARGET_DISTANCE; + if (_targetDepth - _duraDepth > NEAR_TARGET_DISTANCE) + driveDepth = _targetDepth - NEAR_TARGET_DISTANCE; // Drive until within near target distance CommunicationManager.Instance.DriveToDepth( @@ -207,9 +204,7 @@ public void Drive() // Drive through past target distance CommunicationManager.Instance.DriveToDepth( ProbeManager.ManipulatorBehaviorController.ManipulatorID, - _targetDepth + - ProbeManager.ManipulatorBehaviorController.CoordinateSpace - .World2SpaceAxisChange(Vector3.down).z * _drivePastTargetDistance, + _targetDepth + _drivePastTargetDistance, _targetDriveSpeed * NEAR_TARGET_SPEED_MULTIPLIER, _ => { @@ -231,64 +226,67 @@ public void Drive() public void DriveBackToSurface() { - // Drive - CommunicationManager.Instance.SetCanWrite(ProbeManager.ManipulatorBehaviorController.ManipulatorID, true, 1, - canWrite => - { - if (!canWrite) return; - // Set drive status and show stop button - _statusText.text = "Driving back to surface..."; - _returnButton.SetActive(false); - _stopButton.SetActive(true); - _driveState = DriveState.DrivingToSurface; - - // Start timer - StartCoroutine(CountDownTimer(_exitDriveDuration, _driveState)); - - // Compute initial drive depth (before getting to near target distance) - var driveDepth = _duraDepth; - if (Mathf.Abs(_duraDepth - _targetDepth) > NEAR_TARGET_DISTANCE) - driveDepth = _targetDepth - - ProbeManager.ManipulatorBehaviorController - .CoordinateSpace - .World2SpaceAxisChange(Vector3.down).z * - NEAR_TARGET_DISTANCE; - - // Drive back to dura by near target distance (as much as possible) - CommunicationManager.Instance.DriveToDepth(ProbeManager.ManipulatorBehaviorController.ManipulatorID, - driveDepth, _exitDriveBaseSpeed * NEAR_TARGET_SPEED_MULTIPLIER, _ => - { - // Drive back to dura - CommunicationManager.Instance.DriveToDepth( - ProbeManager.ManipulatorBehaviorController.ManipulatorID, _duraDepth, - _exitDriveBaseSpeed, _ => - { - // Drive out by dura exit margin - // FIXME: Dependent on CoordinateSpace direction. Should be standardized by Ephys Link. - CommunicationManager.Instance.DriveToDepth( - ProbeManager.ManipulatorBehaviorController.ManipulatorID, - _duraDepth - ProbeManager.ManipulatorBehaviorController.CoordinateSpace - .World2SpaceAxisChange(Vector3.up).z * DURA_MARGIN_DISTANCE, - _exitDriveBaseSpeed, _ => - { - // Drive the rest of the way to the surface - CommunicationManager.Instance.DriveToDepth( - ProbeManager.ManipulatorBehaviorController.ManipulatorID, - _exitDepth, _outsideDriveSpeed, _ => - { - // Reset manipulator drive states - CommunicationManager.Instance.SetCanWrite( - ProbeManager.ManipulatorBehaviorController - .ManipulatorID, - false, - 1, - null, - Debug.LogError); - }, Debug.LogError); - }, Debug.LogError); - }, Debug.LogError); - }, Debug.LogError); - }, Debug.LogError); + CommunicationManager.Instance.GetPos(ProbeManager.ManipulatorBehaviorController.ManipulatorID, pos => + { + // Drive + CommunicationManager.Instance.SetCanWrite(ProbeManager.ManipulatorBehaviorController.ManipulatorID, + true, 1, + canWrite => + { + if (!canWrite) return; + // Set drive status and show stop button + _statusText.text = "Driving back to surface..."; + _returnButton.SetActive(false); + _stopButton.SetActive(true); + _driveState = DriveState.DrivingToSurface; + + // Start timer + StartCoroutine(CountDownTimer(_exitDriveDuration, _driveState)); + + // Drive + + // Compute drive back to dura (while still in near target distance) + var driveDepth = _duraDepth; + if (pos.w - _duraDepth > _targetDepth - NEAR_TARGET_DISTANCE - _duraDepth) + driveDepth = pos.w - NEAR_TARGET_DISTANCE; + + // Drive back to dura by near target distance (as much as possible) + CommunicationManager.Instance.DriveToDepth( + ProbeManager.ManipulatorBehaviorController.ManipulatorID, + driveDepth, _exitDriveBaseSpeed * NEAR_TARGET_SPEED_MULTIPLIER, _ => + { + // Drive back to dura + CommunicationManager.Instance.DriveToDepth( + ProbeManager.ManipulatorBehaviorController.ManipulatorID, _duraDepth, + _exitDriveBaseSpeed, _ => + { + // Drive out by dura exit margin + // FIXME: Dependent on CoordinateSpace direction. Should be standardized by Ephys Link. + CommunicationManager.Instance.DriveToDepth( + ProbeManager.ManipulatorBehaviorController.ManipulatorID, + _duraDepth - ProbeManager.ManipulatorBehaviorController.CoordinateSpace + .World2SpaceAxisChange(Vector3.up).z * DURA_MARGIN_DISTANCE, + _exitDriveBaseSpeed, _ => + { + // Drive the rest of the way to the surface + CommunicationManager.Instance.DriveToDepth( + ProbeManager.ManipulatorBehaviorController.ManipulatorID, + _exitDepth, _outsideDriveSpeed, _ => + { + // Reset manipulator drive states + CommunicationManager.Instance.SetCanWrite( + ProbeManager.ManipulatorBehaviorController + .ManipulatorID, + false, + 1, + null, + Debug.LogError); + }, Debug.LogError); + }, Debug.LogError); + }, Debug.LogError); + }, Debug.LogError); + }, Debug.LogError); + }, Debug.LogError); } public void Stop() @@ -354,41 +352,35 @@ private void ComputeAndSetDriveTime(float depthDriveBaseSpeed, Action callback = targetInsertion.CoordinateTransform.Space2TransformAxisChange( targetInsertion.CoordinateSpace.World2Space(offsetAdjustedTargetPositionWorldT)); - // Compute return surface position (500 dv above surface) - - var surfaceInsertion = new ProbeInsertion(0, 0, 0.5f, 0, 0, 0, targetInsertion.CoordinateSpace, + // Compute return exit position (500 dv above surface) + var exitInsertion = new ProbeInsertion(0, 0, 0.5f, 0, 0, 0, targetInsertion.CoordinateSpace, targetInsertion.CoordinateTransform, false); - var surfacePositionWorldT = surfaceInsertion.PositionWorldT(); - var surfacePlane = new Plane(Vector3.down, surfacePositionWorldT); + var exitPositionWorldT = exitInsertion.PositionWorldT(); + var exitPlane = new Plane(Vector3.down, exitPositionWorldT); var direction = new Ray(ProbeManager.ProbeController.Insertion.PositionWorldT(), probeTipTUp); var offsetAdjustedSurfacePositionWorldT = Vector3.zero; - if (surfacePlane.Raycast(direction, out var distanceToSurface)) + if (exitPlane.Raycast(direction, out var distanceToSurface)) offsetAdjustedSurfacePositionWorldT = direction.GetPoint(distanceToSurface); // Converting worldT back to APMLDV (position transformed) var offsetAdjustedSurfacePosition = - surfaceInsertion.CoordinateTransform.Space2TransformAxisChange( - surfaceInsertion.CoordinateSpace.World2Space(offsetAdjustedSurfacePositionWorldT)); + exitInsertion.CoordinateTransform.Space2TransformAxisChange( + exitInsertion.CoordinateSpace.World2Space(offsetAdjustedSurfacePositionWorldT)); // Compute drive distances var targetDriveDistance = Vector3.Distance(targetInsertion.apmldv, ProbeManager.ProbeController.Insertion.apmldv); - var surfaceDriveDistance = Vector3.Distance(offsetAdjustedSurfacePosition, + var exitDriveDistance = Vector3.Distance(offsetAdjustedSurfacePosition, ProbeManager.ProbeController.Insertion.apmldv); // Set target and exit depths - _targetDepth = position.w + - ProbeManager.ManipulatorBehaviorController.CoordinateSpace - .World2SpaceAxisChange(Vector3.down).z * targetDriveDistance; - _exitDepth = position.w + - ProbeManager.ManipulatorBehaviorController.CoordinateSpace - .World2SpaceAxisChange(Vector3.up).z * surfaceDriveDistance; + _targetDepth = _duraDepth + targetDriveDistance; + _exitDepth = _duraDepth - exitDriveDistance; // Warn if target depth is out of bounds if (!_acknowledgeOutOfBounds && - (_targetDepth > ProbeManager.ManipulatorBehaviorController.CoordinateSpace.Dimensions.z || - _targetDepth < 0)) + (_targetDepth > ProbeManager.ManipulatorBehaviorController.Dimensions.z || _targetDepth < 0)) { QuestionDialogue.Instance.NewQuestion( "Target depth is out of bounds. Are you sure you want to continue?"); @@ -396,7 +388,6 @@ private void ComputeAndSetDriveTime(float depthDriveBaseSpeed, Action callback = } // Set drive speeds (base + x mm/s / 1 mm of depth) - _targetDriveSpeed = _depthDriveBaseSpeed + targetDriveDistance * _per1000Speed; /* @@ -424,7 +415,7 @@ private void ComputeAndSetDriveTime(float depthDriveBaseSpeed, Action callback = (_exitDriveBaseSpeed * NEAR_TARGET_SPEED_MULTIPLIER) + Mathf.Max(0, targetDriveDistance - NEAR_TARGET_DISTANCE) / _exitDriveBaseSpeed + _duraMarginDriveDuration + - (surfaceDriveDistance - targetDriveDistance - DURA_MARGIN_DISTANCE) / + (exitDriveDistance - targetDriveDistance - DURA_MARGIN_DISTANCE) / _outsideDriveSpeed; // Set timer text @@ -435,12 +426,6 @@ private void ComputeAndSetDriveTime(float depthDriveBaseSpeed, Action callback = }); } - private void ComputeAndSetExitDriveTime(Action callback = null) - { - CommunicationManager.Instance.GetPos(ProbeManager.ManipulatorBehaviorController.ManipulatorID, - position => { }); - } - private IEnumerator CountDownTimer(float seconds, DriveState driveState) { // Set timer text diff --git a/Assets/Scripts/TrajectoryPlanner/UI/EphysCopilot/ResetDuraOffsetPanelHandler.cs b/Assets/Scripts/TrajectoryPlanner/UI/EphysCopilot/ResetDuraOffsetPanelHandler.cs index dfc1e458..3303d735 100644 --- a/Assets/Scripts/TrajectoryPlanner/UI/EphysCopilot/ResetDuraOffsetPanelHandler.cs +++ b/Assets/Scripts/TrajectoryPlanner/UI/EphysCopilot/ResetDuraOffsetPanelHandler.cs @@ -1,3 +1,5 @@ +using System.Collections.Generic; +using EphysLink; using TMPro; using TrajectoryPlanner.Probes; using UnityEngine; @@ -6,6 +8,20 @@ namespace TrajectoryPlanner.UI.EphysCopilot { public class ResetDuraOffsetPanelHandler : MonoBehaviour { + #region Components + + [SerializeField] private TMP_Text _manipulatorIDText; + public ProbeManager ProbeManager { private get; set; } + private ManipulatorBehaviorController _manipulatorBehaviorController; + + #endregion + + #region Properties + + public static Dictionary ManipulatorIdToDuraDepth = new(); + + #endregion + #region Unity private void Start() @@ -27,15 +43,10 @@ public void ResetDuraOffset() { // Reset dura offset _manipulatorBehaviorController.ComputeBrainSurfaceOffset(); - } - - #endregion - - #region Components - [SerializeField] private TMP_Text _manipulatorIDText; - public ProbeManager ProbeManager { private get; set; } - private ManipulatorBehaviorController _manipulatorBehaviorController; + CommunicationManager.Instance.GetPos(_manipulatorBehaviorController.ManipulatorID, + pos => { ManipulatorIdToDuraDepth[_manipulatorBehaviorController.ManipulatorID] = pos.w; }); + } #endregion } From 34b122e69c53b5554ad24f6934a5e3f5c73c7454 Mon Sep 17 00:00:00 2001 From: Kenneth Yang Date: Tue, 10 Oct 2023 16:55:41 -0700 Subject: [PATCH 26/78] Wrote state manager --- .../UI/EphysCopilot/DrivePanelHandler.cs | 145 +++++++++++++++++- 1 file changed, 143 insertions(+), 2 deletions(-) diff --git a/Assets/Scripts/TrajectoryPlanner/UI/EphysCopilot/DrivePanelHandler.cs b/Assets/Scripts/TrajectoryPlanner/UI/EphysCopilot/DrivePanelHandler.cs index 25cfa126..ea7c8d94 100644 --- a/Assets/Scripts/TrajectoryPlanner/UI/EphysCopilot/DrivePanelHandler.cs +++ b/Assets/Scripts/TrajectoryPlanner/UI/EphysCopilot/DrivePanelHandler.cs @@ -14,9 +14,22 @@ public class DrivePanelHandler : MonoBehaviour private enum DriveState { Ready, + DrivingToSurface, DrivingToTarget, + + Outside, + ExitingToOutside, + AtExitMargin, + ExitingToMargin, + AtDura, + ExitingToDura, + DrivingToNearTarget, + AtNearTarget, + ExitingToNearTarget, + DriveToPastTarget, + AtPastTarget, + ReturningToTarget, AtTarget, - DrivingToSurface } private const float DRIVE_PAST_TARGET_DISTANCE = 0.05f; @@ -51,6 +64,134 @@ private enum DriveState public ProbeManager ProbeManager { private get; set; } + private class DriveStateManager + { + // Define state, defaults to at dura + public DriveState DriveState { get; private set; } = DriveState.AtDura; + + /// + /// Increments drive state to be in progress driving down. + /// Unable to drive down when not at a landmark. + /// + public void DriveIncrement() + { + switch (DriveState) + { + case DriveState.AtDura: + DriveState = DriveState.DrivingToNearTarget; + break; + case DriveState.AtNearTarget: + DriveState = DriveState.DriveToPastTarget; + break; + case DriveState.AtPastTarget: + DriveState = DriveState.ReturningToTarget; + break; + + // Error cases: Cannot drive down from these states + case DriveState.Ready: + case DriveState.DrivingToSurface: + case DriveState.DrivingToTarget: + 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: " + DriveState); + break; + } + } + + public void ExitIncrement() + { + switch (DriveState) + { + // Typical case: Increment to next state from landmarks + case DriveState.AtExitMargin: + DriveState = DriveState.ExitingToOutside; + break; + case DriveState.AtDura: + DriveState = DriveState.ExitingToMargin; + break; + case DriveState.AtNearTarget: + DriveState = DriveState.ExitingToDura; + break; + case DriveState.AtTarget: + DriveState = DriveState.ExitingToNearTarget; + break; + + // Driving transition cases: Switch to exit transition state + case DriveState.DrivingToNearTarget: + DriveState = DriveState.ExitingToDura; + break; + case DriveState.DriveToPastTarget or DriveState.ReturningToTarget: + DriveState = DriveState.ExitingToNearTarget; + break; + + // Error cases: Cannot exit from these states + case DriveState.Ready: + case DriveState.DrivingToSurface: + case DriveState.DrivingToTarget: + case DriveState.Outside: + case DriveState.ExitingToMargin: + case DriveState.ExitingToDura: + case DriveState.ExitingToNearTarget: + case DriveState.AtPastTarget: + default: + Debug.LogError("Cannot exit from state: " + DriveState); + break; + } + } + + public void MovementCompleted() + { + switch (DriveState) + { + // Typical cases (was in driving state) + case DriveState.ExitingToOutside: + DriveState = DriveState.Outside; + break; + case DriveState.ExitingToMargin: + DriveState = DriveState.AtExitMargin; + break; + case DriveState.ExitingToDura: + DriveState = DriveState.AtDura; + break; + case DriveState.DrivingToNearTarget: + DriveState = DriveState.AtNearTarget; + break; + case DriveState.ExitingToNearTarget: + DriveState = DriveState.AtNearTarget; + break; + case DriveState.DriveToPastTarget: + DriveState = DriveState.AtPastTarget; + break; + case DriveState.ReturningToTarget: + DriveState = DriveState.AtTarget; + break; + + // Error cases: cannot complete movement from non-transitional states + case DriveState.Ready: + case DriveState.DrivingToSurface: + case DriveState.DrivingToTarget: + case DriveState.Outside: + case DriveState.AtExitMargin: + case DriveState.AtDura: + case DriveState.AtNearTarget: + case DriveState.AtPastTarget: + case DriveState.AtTarget: + default: + Debug.LogError("Cannot complete movement from non-transitional state: " + DriveState); + break; + } + } + } + #endregion #region Properties @@ -189,7 +330,7 @@ public void Drive() StartCoroutine(CountDownTimer(_targetDriveDuration, _driveState)); // Drive - + // Compute initial drive depth (before getting to near target distance) var driveDepth = _duraDepth; if (_targetDepth - _duraDepth > NEAR_TARGET_DISTANCE) From 44cfdbb60388bd8e222ff315c148cbdacd8f5195 Mon Sep 17 00:00:00 2001 From: Kenneth Yang Date: Tue, 17 Oct 2023 10:36:00 -0700 Subject: [PATCH 27/78] Update JetBrains plugin --- Packages/manifest.json | 2 +- Packages/packages-lock.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Packages/manifest.json b/Packages/manifest.json index 340db395..e0d31f57 100644 --- a/Packages/manifest.json +++ b/Packages/manifest.json @@ -2,7 +2,7 @@ "dependencies": { "com.unity.addressables": "1.19.19", "com.unity.animation.rigging": "1.1.1", - "com.unity.ide.rider": "3.0.25", + "com.unity.ide.rider": "3.0.26", "com.unity.ide.visualstudio": "2.0.16", "com.unity.ide.vscode": "1.2.5", "com.unity.inputsystem": "1.4.4", diff --git a/Packages/packages-lock.json b/Packages/packages-lock.json index 767e320e..765f1bc0 100644 --- a/Packages/packages-lock.json +++ b/Packages/packages-lock.json @@ -75,7 +75,7 @@ "url": "https://packages.unity.com" }, "com.unity.ide.rider": { - "version": "3.0.25", + "version": "3.0.26", "depth": 0, "source": "registry", "dependencies": { From e74b260a94eff8786ecaf4e4863fa6d882cc0136 Mon Sep 17 00:00:00 2001 From: Kenneth Yang Date: Tue, 17 Oct 2023 15:24:31 -0700 Subject: [PATCH 28/78] Allow beta versions of Ephys Link --- .../Scripts/EphysLink/CommunicationManager.cs | 29 +++++++++++-------- .../UI/EphysCopilot/DrivePanelHandler.cs | 2 +- .../UI/EphysLinkSettings/EphysLinkSettings.cs | 28 ++++-------------- 3 files changed, 23 insertions(+), 36 deletions(-) diff --git a/Assets/Scripts/EphysLink/CommunicationManager.cs b/Assets/Scripts/EphysLink/CommunicationManager.cs index 33e4835b..c0a1d0b0 100644 --- a/Assets/Scripts/EphysLink/CommunicationManager.cs +++ b/Assets/Scripts/EphysLink/CommunicationManager.cs @@ -53,16 +53,7 @@ public void ServerSettingsLoaded() ConnectToServer(Settings.EphysLinkServerIp, Settings.EphysLinkServerPort, () => { // Verify Ephys Link version - Instance.GetVersion(version => - { - if (!version.Split(".").Where((versionNumber, index) => - int.Parse(versionNumber) < - EPHYS_LINK_MIN_VERSION[index]) - .Any()) - IsEphysLinkCompatible = true; - else - Instance.DisconnectFromServer(); - }); + VerifyVersion(() => IsEphysLinkCompatible = true, () => Instance.DisconnectFromServer()); }); } @@ -156,6 +147,20 @@ public void DisconnectFromServer(Action onDisconnected = null) onDisconnected?.Invoke(); } + public void VerifyVersion(Action onSuccess, Action onFailure) + { + GetVersion(version => + { + if (!version.Split(".").Where((versionNumber, index) => + int.Parse(new string(versionNumber.TakeWhile(char.IsDigit).ToArray())) < + EPHYS_LINK_MIN_VERSION[index]) + .Any()) + onSuccess.Invoke(); + else + onFailure.Invoke(); + }, onFailure.Invoke); + } + #endregion #region Event Handlers @@ -176,13 +181,13 @@ public void GetVersion(Action onSuccessCallback, Action onErrorCallback }).Emit("get_version"); } - // FIXME: Dependent on Manipulator Type. Should be standardized by Ephys Link. /// /// Get manipulators event sender. /// /// Callback function to handle incoming manipulator ID's /// Callback function to handle errors - public void GetManipulators(Action onSuccessCallback, Action onErrorCallback = null) + public void GetManipulators(Action onSuccessCallback, + Action onErrorCallback = null) { _connectionManager.Socket.ExpectAcknowledgement(data => { diff --git a/Assets/Scripts/TrajectoryPlanner/UI/EphysCopilot/DrivePanelHandler.cs b/Assets/Scripts/TrajectoryPlanner/UI/EphysCopilot/DrivePanelHandler.cs index ea7c8d94..477a5f0a 100644 --- a/Assets/Scripts/TrajectoryPlanner/UI/EphysCopilot/DrivePanelHandler.cs +++ b/Assets/Scripts/TrajectoryPlanner/UI/EphysCopilot/DrivePanelHandler.cs @@ -148,7 +148,7 @@ public void ExitIncrement() } } - public void MovementCompleted() + public void CompleteMovement() { switch (DriveState) { diff --git a/Assets/Scripts/TrajectoryPlanner/UI/EphysLinkSettings/EphysLinkSettings.cs b/Assets/Scripts/TrajectoryPlanner/UI/EphysLinkSettings/EphysLinkSettings.cs index a0cc03b9..f7359f94 100644 --- a/Assets/Scripts/TrajectoryPlanner/UI/EphysLinkSettings/EphysLinkSettings.cs +++ b/Assets/Scripts/TrajectoryPlanner/UI/EphysLinkSettings/EphysLinkSettings.cs @@ -163,35 +163,17 @@ public void OnConnectDisconnectPressed() () => { // Check Ephys Link version - CommunicationManager.Instance.GetVersion(version => + CommunicationManager.Instance.VerifyVersion(() => { - if (!version.Split(".").Where((versionNumber, index) => - int.Parse(versionNumber) < - CommunicationManager.EPHYS_LINK_MIN_VERSION[index]) - .Any()) - { - // Ephys Link is current enough - CommunicationManager.Instance.IsEphysLinkCompatible = true; - UpdateConnectionPanel(); - } - else - // Ephys Link needs updating - { - CommunicationManager.Instance.DisconnectFromServer(() => - { - _connectionErrorText.text = - "Ephys Link is outdated. Please update to " + - CommunicationManager.EPHYS_LINK_MIN_VERSION_STRING; - _connectButtonText.text = "Connect"; - }); - } + // Ephys Link is current enough + CommunicationManager.Instance.IsEphysLinkCompatible = true; + UpdateConnectionPanel(); }, () => { - // Failed to get version (probably because it's outdated) CommunicationManager.Instance.DisconnectFromServer(() => { _connectionErrorText.text = - "Unable to get server version. Please ensure Ephys Link version is " + + "Ephys Link is outdated. Please update to " + CommunicationManager.EPHYS_LINK_MIN_VERSION_STRING; _connectButtonText.text = "Connect"; }); From a0de813f6003c968f198c85e26de6b2bdf55eb1a Mon Sep 17 00:00:00 2001 From: Kenneth Yang Date: Tue, 17 Oct 2023 17:59:46 -0700 Subject: [PATCH 29/78] Start implementing drive states --- .../UI/EphysCopilot/DrivePanelHandler.cs | 101 +++++++++++++----- 1 file changed, 72 insertions(+), 29 deletions(-) diff --git a/Assets/Scripts/TrajectoryPlanner/UI/EphysCopilot/DrivePanelHandler.cs b/Assets/Scripts/TrajectoryPlanner/UI/EphysCopilot/DrivePanelHandler.cs index 477a5f0a..3d68ad59 100644 --- a/Assets/Scripts/TrajectoryPlanner/UI/EphysCopilot/DrivePanelHandler.cs +++ b/Assets/Scripts/TrajectoryPlanner/UI/EphysCopilot/DrivePanelHandler.cs @@ -66,8 +66,9 @@ private enum DriveState private class DriveStateManager { + // FIXME: use position to detect state // Define state, defaults to at dura - public DriveState DriveState { get; private set; } = DriveState.AtDura; + public DriveState State { get; private set; } = DriveState.AtDura; /// /// Increments drive state to be in progress driving down. @@ -75,16 +76,16 @@ private class DriveStateManager /// public void DriveIncrement() { - switch (DriveState) + switch (State) { case DriveState.AtDura: - DriveState = DriveState.DrivingToNearTarget; + State = DriveState.DrivingToNearTarget; break; case DriveState.AtNearTarget: - DriveState = DriveState.DriveToPastTarget; + State = DriveState.DriveToPastTarget; break; case DriveState.AtPastTarget: - DriveState = DriveState.ReturningToTarget; + State = DriveState.ReturningToTarget; break; // Error cases: Cannot drive down from these states @@ -102,35 +103,35 @@ public void DriveIncrement() case DriveState.ReturningToTarget: case DriveState.AtTarget: default: - Debug.LogError("Cannot drive down from state: " + DriveState); + Debug.LogError("Cannot drive down from state: " + State); break; } } public void ExitIncrement() { - switch (DriveState) + switch (State) { // Typical case: Increment to next state from landmarks case DriveState.AtExitMargin: - DriveState = DriveState.ExitingToOutside; + State = DriveState.ExitingToOutside; break; case DriveState.AtDura: - DriveState = DriveState.ExitingToMargin; + State = DriveState.ExitingToMargin; break; case DriveState.AtNearTarget: - DriveState = DriveState.ExitingToDura; + State = DriveState.ExitingToDura; break; case DriveState.AtTarget: - DriveState = DriveState.ExitingToNearTarget; + State = DriveState.ExitingToNearTarget; break; // Driving transition cases: Switch to exit transition state case DriveState.DrivingToNearTarget: - DriveState = DriveState.ExitingToDura; + State = DriveState.ExitingToDura; break; case DriveState.DriveToPastTarget or DriveState.ReturningToTarget: - DriveState = DriveState.ExitingToNearTarget; + State = DriveState.ExitingToNearTarget; break; // Error cases: Cannot exit from these states @@ -143,36 +144,36 @@ public void ExitIncrement() case DriveState.ExitingToNearTarget: case DriveState.AtPastTarget: default: - Debug.LogError("Cannot exit from state: " + DriveState); + Debug.LogError("Cannot exit from state: " + State); break; } } public void CompleteMovement() { - switch (DriveState) + switch (State) { // Typical cases (was in driving state) case DriveState.ExitingToOutside: - DriveState = DriveState.Outside; + State = DriveState.Outside; break; case DriveState.ExitingToMargin: - DriveState = DriveState.AtExitMargin; + State = DriveState.AtExitMargin; break; case DriveState.ExitingToDura: - DriveState = DriveState.AtDura; + State = DriveState.AtDura; break; case DriveState.DrivingToNearTarget: - DriveState = DriveState.AtNearTarget; + State = DriveState.AtNearTarget; break; case DriveState.ExitingToNearTarget: - DriveState = DriveState.AtNearTarget; + State = DriveState.AtNearTarget; break; case DriveState.DriveToPastTarget: - DriveState = DriveState.AtPastTarget; + State = DriveState.AtPastTarget; break; case DriveState.ReturningToTarget: - DriveState = DriveState.AtTarget; + State = DriveState.AtTarget; break; // Error cases: cannot complete movement from non-transitional states @@ -186,7 +187,7 @@ public void CompleteMovement() case DriveState.AtPastTarget: case DriveState.AtTarget: default: - Debug.LogError("Cannot complete movement from non-transitional state: " + DriveState); + Debug.LogError("Cannot complete movement from non-transitional state: " + State); break; } } @@ -196,13 +197,23 @@ public void CompleteMovement() #region Properties + // Boundary acknowledgements private bool _acknowledgeOutOfBounds; private bool _acknowledgeTestSpeeds; private bool _acknowledgeHighSpeeds; + // Drive state private DriveState _driveState; + private readonly DriveStateManager _driveStateManager = new(); + + // Landmark depths + private float _outsideDepth; + private float _exitMarginDepth; private float _duraDepth; + private float _nearTargetDepth; private float _targetDepth; + private float _pastTargetDepth; + private float _targetDriveDuration; private float _duraMarginDepth; private float _duraMarginDriveDuration => DURA_MARGIN_DISTANCE / _exitDriveBaseSpeed; @@ -211,8 +222,8 @@ public void CompleteMovement() private float _targetDriveSpeed; private float _drivePastTargetDistance = DRIVE_PAST_TARGET_DISTANCE; - private float _depthDriveBaseSpeed = DEPTH_DRIVE_BASE_SPEED; - private float _exitDriveBaseSpeed => _depthDriveBaseSpeed * EXIT_DRIVE_SPEED_MULTIPLIER; + private float _driveBaseSpeed = DEPTH_DRIVE_BASE_SPEED; + private float _exitDriveBaseSpeed => _driveBaseSpeed * EXIT_DRIVE_SPEED_MULTIPLIER; private float _exitDuraMarginSpeed; private float _outsideDriveSpeed; private float _per1000Speed; @@ -275,7 +286,7 @@ public void OnUseTestSpeedPressed() _acknowledgeTestSpeeds = true; UseTestSpeed(); }; - QuestionDialogue.Instance.NoCallback = () => { OnSpeedChanged(_depthDriveBaseSpeed * 1000f); }; + QuestionDialogue.Instance.NoCallback = () => { OnSpeedChanged(_driveBaseSpeed * 1000f); }; QuestionDialogue.Instance.NewQuestion( "Please ensure this is for testing purposes only. Do you want to continue?"); } @@ -310,7 +321,18 @@ public void OnDrivePastDistanceChanged(string value) public void Drive() { - ComputeAndSetDriveTime(_depthDriveBaseSpeed, () => + _driveStateManager.DriveIncrement(); + switch (_driveStateManager.State) + { + case DriveState.DrivingToNearTarget: + // Are we between dura and near target? + break; + } + } + + public void OldDrive() + { + ComputeAndSetDriveTime(_driveBaseSpeed, () => { CommunicationManager.Instance.SetCanWrite(ProbeManager.ManipulatorBehaviorController.ManipulatorID, true, 1, canWrite => @@ -458,11 +480,32 @@ public void Stop() #region Helper Functions + + private void SetDriveSpeeds(float driveBaseSpeed) + { + _driveBaseSpeed = driveBaseSpeed; + _outsideDriveSpeed = driveBaseSpeed * OUTSIDE_DRIVE_SPEED_MULTIPLIER; + _per1000Speed = driveBaseSpeed < DEPTH_DRIVE_BASE_SPEED_TEST ? PER_1000_SPEED : PER_1000_SPEED_TEST; + } + + private void ComputeLandmarkDepths() + { + if (!ResetDuraOffsetPanelHandler.ManipulatorIdToDuraDepth.ContainsKey(ProbeManager.ManipulatorBehaviorController.ManipulatorID)) + { + Debug.LogError("Manipulator "+ProbeManager.ManipulatorBehaviorController.ManipulatorID+" has not been placed on dura."); + return; + } + + _duraDepth = + ResetDuraOffsetPanelHandler.ManipulatorIdToDuraDepth[ + ProbeManager.ManipulatorBehaviorController.ManipulatorID]; + + } private void ComputeAndSetDriveTime(float depthDriveBaseSpeed, Action callback = null) { // Compute speed variables based on speed - _depthDriveBaseSpeed = depthDriveBaseSpeed; + _driveBaseSpeed = depthDriveBaseSpeed; _outsideDriveSpeed = depthDriveBaseSpeed * OUTSIDE_DRIVE_SPEED_MULTIPLIER; _per1000Speed = depthDriveBaseSpeed < DEPTH_DRIVE_BASE_SPEED_TEST ? PER_1000_SPEED : PER_1000_SPEED_TEST; @@ -529,7 +572,7 @@ private void ComputeAndSetDriveTime(float depthDriveBaseSpeed, Action callback = } // Set drive speeds (base + x mm/s / 1 mm of depth) - _targetDriveSpeed = _depthDriveBaseSpeed + targetDriveDistance * _per1000Speed; + _targetDriveSpeed = _driveBaseSpeed + targetDriveDistance * _per1000Speed; /* * Compute target drive duration From e75a50d99f5700efd054ce1192d59f60b5d6232f Mon Sep 17 00:00:00 2001 From: Kenneth Yang Date: Fri, 20 Oct 2023 16:41:50 -0700 Subject: [PATCH 30/78] Compute landmark depths, begin implementing drive --- .../UI/EphysCopilot/DrivePanelHandler.cs | 104 +++++++++++++----- 1 file changed, 74 insertions(+), 30 deletions(-) diff --git a/Assets/Scripts/TrajectoryPlanner/UI/EphysCopilot/DrivePanelHandler.cs b/Assets/Scripts/TrajectoryPlanner/UI/EphysCopilot/DrivePanelHandler.cs index 3d68ad59..a4114bbb 100644 --- a/Assets/Scripts/TrajectoryPlanner/UI/EphysCopilot/DrivePanelHandler.cs +++ b/Assets/Scripts/TrajectoryPlanner/UI/EphysCopilot/DrivePanelHandler.cs @@ -29,7 +29,7 @@ private enum DriveState DriveToPastTarget, AtPastTarget, ReturningToTarget, - AtTarget, + AtTarget } private const float DRIVE_PAST_TARGET_DISTANCE = 0.05f; @@ -205,15 +205,51 @@ public void CompleteMovement() // Drive state private DriveState _driveState; private readonly DriveStateManager _driveStateManager = new(); - + // Landmark depths - private float _outsideDepth; - private float _exitMarginDepth; - private float _duraDepth; - private float _nearTargetDepth; - private float _targetDepth; - private float _pastTargetDepth; - + private float _outsideDepth; // FIXME: probably not needed as we just pull up on DV + private float _exitMarginDepth => _duraDepth - DURA_MARGIN_DISTANCE; + + private float _duraDepth => + ResetDuraOffsetPanelHandler.ManipulatorIdToDuraDepth.TryGetValue( + ProbeManager.ManipulatorBehaviorController.ManipulatorID, out var depth) + ? depth + : float.NaN; + + private float _nearTargetDepth => _targetDepth - NEAR_TARGET_DISTANCE; + + private float _targetDepth + { + get + { + // Calibrate target insertion depth based on surface position + var targetInsertion = new ProbeInsertion( + InsertionSelectionPanelHandler.ManipulatorIDToSelectedTargetProbeManager[ + ProbeManager.ManipulatorBehaviorController.ManipulatorID].ProbeController.Insertion); + var targetPositionWorldT = targetInsertion.PositionWorldT(); + var relativePositionWorldT = + ProbeManager.ProbeController.Insertion.PositionWorldT() - targetPositionWorldT; + var probeTipTUp = ProbeManager.ProbeController.ProbeTipT.up; + var offsetAdjustedRelativeTargetPositionWorldT = + Vector3.ProjectOnPlane(relativePositionWorldT, probeTipTUp); + var offsetAdjustedTargetPositionWorldT = + targetPositionWorldT + offsetAdjustedRelativeTargetPositionWorldT; + + // Converting worldT back to APMLDV (position transformed) + targetInsertion.apmldv = + targetInsertion.CoordinateTransform.Space2TransformAxisChange( + targetInsertion.CoordinateSpace.World2Space(offsetAdjustedTargetPositionWorldT)); + + // Compute drive distances + var targetDriveDistance = + Vector3.Distance(targetInsertion.apmldv, ProbeManager.ProbeController.Insertion.apmldv); + + return _duraDepth + targetDriveDistance; + } + } + + private float _pastTargetDepth => _targetDepth + _drivePastTargetDistance; + private float _targetDriveDuration; private float _duraMarginDepth; private float _duraMarginDriveDuration => DURA_MARGIN_DISTANCE / _exitDriveBaseSpeed; @@ -321,13 +357,35 @@ public void OnDrivePastDistanceChanged(string value) public void Drive() { - _driveStateManager.DriveIncrement(); - switch (_driveStateManager.State) + // Get current position + CommunicationManager.Instance.GetPos(ProbeManager.ManipulatorBehaviorController.ManipulatorID, position => { - case DriveState.DrivingToNearTarget: - // Are we between dura and near target? - break; - } + // TODO: Validate position and state + + // Increment state + _driveStateManager.DriveIncrement(); + + // Do something based on current state + switch (_driveStateManager.State) + { + case DriveState.DrivingToNearTarget: + CommunicationManager.Instance.SetCanWrite( + ProbeManager.ManipulatorBehaviorController.ManipulatorID, true, 1, + canWrite => + { + // Update status text + _statusText.text = "Driving to target..."; + + // Replace drive buttons with stop + _driveGroup.SetActive(false); + _stopButton.SetActive(true); + + // Drive to near target depth + }); + + break; + } + }); } public void OldDrive() @@ -480,7 +538,7 @@ public void Stop() #region Helper Functions - + private void SetDriveSpeeds(float driveBaseSpeed) { _driveBaseSpeed = driveBaseSpeed; @@ -488,20 +546,6 @@ private void SetDriveSpeeds(float driveBaseSpeed) _per1000Speed = driveBaseSpeed < DEPTH_DRIVE_BASE_SPEED_TEST ? PER_1000_SPEED : PER_1000_SPEED_TEST; } - private void ComputeLandmarkDepths() - { - if (!ResetDuraOffsetPanelHandler.ManipulatorIdToDuraDepth.ContainsKey(ProbeManager.ManipulatorBehaviorController.ManipulatorID)) - { - Debug.LogError("Manipulator "+ProbeManager.ManipulatorBehaviorController.ManipulatorID+" has not been placed on dura."); - return; - } - - _duraDepth = - ResetDuraOffsetPanelHandler.ManipulatorIdToDuraDepth[ - ProbeManager.ManipulatorBehaviorController.ManipulatorID]; - - } - private void ComputeAndSetDriveTime(float depthDriveBaseSpeed, Action callback = null) { // Compute speed variables based on speed From cc59114fe3a47774b6caa23fa29cb2c5edaddd07 Mon Sep 17 00:00:00 2001 From: Kenneth Yang Date: Tue, 24 Oct 2023 10:43:37 -0700 Subject: [PATCH 31/78] WIP drive. Depth is not computed right... --- .../UI/EphysCopilot/DrivePanelHandler.cs | 181 ++++++++++++------ 1 file changed, 123 insertions(+), 58 deletions(-) diff --git a/Assets/Scripts/TrajectoryPlanner/UI/EphysCopilot/DrivePanelHandler.cs b/Assets/Scripts/TrajectoryPlanner/UI/EphysCopilot/DrivePanelHandler.cs index a4114bbb..a405fb37 100644 --- a/Assets/Scripts/TrajectoryPlanner/UI/EphysCopilot/DrivePanelHandler.cs +++ b/Assets/Scripts/TrajectoryPlanner/UI/EphysCopilot/DrivePanelHandler.cs @@ -206,19 +206,8 @@ public void CompleteMovement() private DriveState _driveState; private readonly DriveStateManager _driveStateManager = new(); - // Landmark depths - private float _outsideDepth; // FIXME: probably not needed as we just pull up on DV - private float _exitMarginDepth => _duraDepth - DURA_MARGIN_DISTANCE; - - private float _duraDepth => - ResetDuraOffsetPanelHandler.ManipulatorIdToDuraDepth.TryGetValue( - ProbeManager.ManipulatorBehaviorController.ManipulatorID, out var depth) - ? depth - : float.NaN; - - private float _nearTargetDepth => _targetDepth - NEAR_TARGET_DISTANCE; - - private float _targetDepth + // Target drive distance + private float _targetDriveDistance { get { @@ -239,15 +228,24 @@ private float _targetDepth targetInsertion.apmldv = targetInsertion.CoordinateTransform.Space2TransformAxisChange( targetInsertion.CoordinateSpace.World2Space(offsetAdjustedTargetPositionWorldT)); - - // Compute drive distances - var targetDriveDistance = - Vector3.Distance(targetInsertion.apmldv, ProbeManager.ProbeController.Insertion.apmldv); - - return _duraDepth + targetDriveDistance; + return Vector3.Distance(targetInsertion.apmldv, ProbeManager.ProbeController.Insertion.apmldv); } } + // Landmark depths + private float _outsideDepth; // FIXME: probably not needed as we just pull up on DV + private float _exitMarginDepth => _duraDepth - DURA_MARGIN_DISTANCE; + + private float _duraDepth => + ResetDuraOffsetPanelHandler.ManipulatorIdToDuraDepth.TryGetValue( + ProbeManager.ManipulatorBehaviorController.ManipulatorID, out var depth) + ? depth + : float.NaN; + + private float _nearTargetDepth => _targetDepth - NEAR_TARGET_DISTANCE; + + private float _targetDepth => _duraDepth + _targetDriveDistance; + private float _pastTargetDepth => _targetDepth + _drivePastTargetDistance; private float _targetDriveDuration; @@ -255,14 +253,16 @@ private float _targetDepth private float _duraMarginDriveDuration => DURA_MARGIN_DISTANCE / _exitDriveBaseSpeed; private float _exitDepth; private float _exitDriveDuration; - private float _targetDriveSpeed; private float _drivePastTargetDistance = DRIVE_PAST_TARGET_DISTANCE; + + // Drive Speeds private float _driveBaseSpeed = DEPTH_DRIVE_BASE_SPEED; + private float _per1000Speed => _driveBaseSpeed < DEPTH_DRIVE_BASE_SPEED ? PER_1000_SPEED : PER_1000_SPEED_TEST; + private float _targetDriveSpeed => _driveBaseSpeed + _targetDriveDistance * _per1000Speed; + private float _nearTargetDriveSpeed => _driveBaseSpeed * NEAR_TARGET_SPEED_MULTIPLIER; private float _exitDriveBaseSpeed => _driveBaseSpeed * EXIT_DRIVE_SPEED_MULTIPLIER; - private float _exitDuraMarginSpeed; - private float _outsideDriveSpeed; - private float _per1000Speed; + private float _outsideDriveSpeed => _driveBaseSpeed * OUTSIDE_DRIVE_SPEED_MULTIPLIER; #endregion @@ -304,9 +304,9 @@ public void OnSpeedChanged(float value) SpeedToString(DEPTH_DRIVE_BASE_SPEED) + ". Are you sure you want to continue?"); } - - // Compute with speed converted to mm/s - ComputeAndSetDriveTime(value / 1000f); + + // Update base speed accordingly + _driveBaseSpeed = value / 1000f; } public void OnUseTestSpeedPressed() @@ -360,32 +360,109 @@ public void Drive() // Get current position CommunicationManager.Instance.GetPos(ProbeManager.ManipulatorBehaviorController.ManipulatorID, position => { - // TODO: Validate position and state - // Increment state _driveStateManager.DriveIncrement(); - // Do something based on current state - switch (_driveStateManager.State) - { - case DriveState.DrivingToNearTarget: - CommunicationManager.Instance.SetCanWrite( - ProbeManager.ManipulatorBehaviorController.ManipulatorID, true, 1, - canWrite => - { + CommunicationManager.Instance.SetCanWrite( + ProbeManager.ManipulatorBehaviorController.ManipulatorID, true, 1, + canWrite => + { + if (!canWrite) return; + + // Do something based on current state + switch (_driveStateManager.State) + { + case DriveState.DrivingToNearTarget: // Update status text - _statusText.text = "Driving to target..."; - + _statusText.text = "Driving to " + _drivePastTargetDistance + " µm past target..."; + // Replace drive buttons with stop _driveGroup.SetActive(false); _stopButton.SetActive(true); - + // Drive to near target depth - }); + if (position.w < _nearTargetDepth) + CommunicationManager.Instance.DriveToDepth( + ProbeManager.ManipulatorBehaviorController.ManipulatorID, _nearTargetDepth, + _targetDriveSpeed, _ => CompleteAndAdvance(), Debug.LogError); + else + CompleteAndAdvance(); + + break; + case DriveState.DriveToPastTarget: + // Update status text + _statusText.text = "Driving to " + _drivePastTargetDistance + " µm past target..."; - break; - } - }); + // Replace drive buttons with stop + _driveGroup.SetActive(false); + _stopButton.SetActive(true); + + // Drive to past target depth + if (position.w < _pastTargetDepth) + CommunicationManager.Instance.DriveToDepth( + ProbeManager.ManipulatorBehaviorController.ManipulatorID, _pastTargetDepth, + _nearTargetDriveSpeed, _ => CompleteAndAdvance(), Debug.LogError); + else + CompleteAndAdvance(); + + break; + case DriveState.ReturningToTarget: + // Update status text + _statusText.text = "Returning to target..."; + + // Replace drive buttons with stop + _driveGroup.SetActive(false); + _stopButton.SetActive(true); + + // Drive to target and complete movement + CommunicationManager.Instance.DriveToDepth( + ProbeManager.ManipulatorBehaviorController.ManipulatorID, _targetDepth, + _nearTargetDriveSpeed, _ => + { + CommunicationManager.Instance.SetCanWrite( + ProbeManager.ManipulatorBehaviorController.ManipulatorID, false, 0, + _ => + { + _driveStateManager.CompleteMovement(); + + // Complete driving + _statusText.text = "Drive complete"; + _stopButton.SetActive(false); + }); + }, Debug.LogError); + break; + + case DriveState.Ready: + case DriveState.DrivingToSurface: + case DriveState.DrivingToTarget: + case DriveState.Outside: + case DriveState.ExitingToOutside: + case DriveState.AtExitMargin: + case DriveState.ExitingToMargin: + case DriveState.AtDura: + case DriveState.ExitingToDura: + case DriveState.AtNearTarget: + case DriveState.ExitingToNearTarget: + case DriveState.AtPastTarget: + case DriveState.AtTarget: + default: + Debug.LogError("Invalid Drive state."); + return; + } + }, Debug.LogError); + }, Debug.LogError); + return; + + void CompleteAndAdvance() + { + CommunicationManager.Instance.SetCanWrite(ProbeManager.ManipulatorBehaviorController.ManipulatorID, + false, 0, + _ => + { + _driveStateManager.CompleteMovement(); + Drive(); + }, Debug.LogError); + } } public void OldDrive() @@ -539,20 +616,8 @@ public void Stop() #region Helper Functions - private void SetDriveSpeeds(float driveBaseSpeed) - { - _driveBaseSpeed = driveBaseSpeed; - _outsideDriveSpeed = driveBaseSpeed * OUTSIDE_DRIVE_SPEED_MULTIPLIER; - _per1000Speed = driveBaseSpeed < DEPTH_DRIVE_BASE_SPEED_TEST ? PER_1000_SPEED : PER_1000_SPEED_TEST; - } - private void ComputeAndSetDriveTime(float depthDriveBaseSpeed, Action callback = null) { - // Compute speed variables based on speed - _driveBaseSpeed = depthDriveBaseSpeed; - _outsideDriveSpeed = depthDriveBaseSpeed * OUTSIDE_DRIVE_SPEED_MULTIPLIER; - _per1000Speed = depthDriveBaseSpeed < DEPTH_DRIVE_BASE_SPEED_TEST ? PER_1000_SPEED : PER_1000_SPEED_TEST; - // Update drive past distance and return to surface button text _returnButtonText.text = "Return to Surface (" + SpeedToString(_exitDriveBaseSpeed) + ")"; @@ -560,7 +625,7 @@ private void ComputeAndSetDriveTime(float depthDriveBaseSpeed, Action callback = CommunicationManager.Instance.GetPos(ProbeManager.ManipulatorBehaviorController.ManipulatorID, position => { // Remember dura depth - _duraDepth = position.w; + // _duraDepth = position.w; // Calibrate target insertion depth based on surface position var targetInsertion = new ProbeInsertion( @@ -603,7 +668,7 @@ private void ComputeAndSetDriveTime(float depthDriveBaseSpeed, Action callback = ProbeManager.ProbeController.Insertion.apmldv); // Set target and exit depths - _targetDepth = _duraDepth + targetDriveDistance; + // _targetDepth = _duraDepth + targetDriveDistance; _exitDepth = _duraDepth - exitDriveDistance; // Warn if target depth is out of bounds @@ -616,7 +681,7 @@ private void ComputeAndSetDriveTime(float depthDriveBaseSpeed, Action callback = } // Set drive speeds (base + x mm/s / 1 mm of depth) - _targetDriveSpeed = _driveBaseSpeed + targetDriveDistance * _per1000Speed; + // _targetDriveSpeed = _driveBaseSpeed + targetDriveDistance * _per1000Speed; /* * Compute target drive duration From b6e421d10a32449ceecc6f8e6f374d05170ab6be Mon Sep 17 00:00:00 2001 From: Kenneth Yang Date: Tue, 24 Oct 2023 11:15:21 -0700 Subject: [PATCH 32/78] Fixed drop to depth, not computing full depth correctly --- .../Probes/ManipulatorBehaviorController.cs | 10 ++++++++-- .../UI/EphysCopilot/DrivePanelHandler.cs | 8 +++++--- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/Assets/Scripts/TrajectoryPlanner/Probes/ManipulatorBehaviorController.cs b/Assets/Scripts/TrajectoryPlanner/Probes/ManipulatorBehaviorController.cs index f1b61e65..4541d0e8 100644 --- a/Assets/Scripts/TrajectoryPlanner/Probes/ManipulatorBehaviorController.cs +++ b/Assets/Scripts/TrajectoryPlanner/Probes/ManipulatorBehaviorController.cs @@ -176,7 +176,7 @@ private void EchoPosition(Vector4 pos) if (IsSetToDropToSurfaceWithDepth) zeroCoordinateAdjustedManipulatorPosition.w += brainSurfaceAdjustment; else - manipulatorSpacePosition.z -= brainSurfaceAdjustment; + manipulatorSpacePosition.y -= brainSurfaceAdjustment; // Convert to world space var zeroCoordinateAdjustedWorldPosition = @@ -326,7 +326,7 @@ public void ComputeBrainSurfaceOffset() if (float.IsNaN(brainSurfaceCoordinate.x)) { - Debug.LogWarning("Could not find brain surface! Canceling set brain offset."); + Debug.LogError("Could not find brain surface! Canceling set brain offset."); return; } @@ -334,6 +334,12 @@ public void ComputeBrainSurfaceOffset() _probeController.Insertion.World2Transformed( _annotationDataset.CoordinateSpace.Space2World(brainSurfaceCoordinate)); + print("Brain surface offset: " + BrainSurfaceOffset + " + " + Vector3.Distance( + brainSurfaceToTransformed, + _probeController.Insertion.apmldv) + " = " + (BrainSurfaceOffset + Vector3.Distance( + brainSurfaceToTransformed, + _probeController.Insertion.apmldv))); + BrainSurfaceOffset += Vector3.Distance(brainSurfaceToTransformed, _probeController.Insertion.apmldv); } diff --git a/Assets/Scripts/TrajectoryPlanner/UI/EphysCopilot/DrivePanelHandler.cs b/Assets/Scripts/TrajectoryPlanner/UI/EphysCopilot/DrivePanelHandler.cs index a405fb37..cec69236 100644 --- a/Assets/Scripts/TrajectoryPlanner/UI/EphysCopilot/DrivePanelHandler.cs +++ b/Assets/Scripts/TrajectoryPlanner/UI/EphysCopilot/DrivePanelHandler.cs @@ -228,12 +228,13 @@ private float _targetDriveDistance targetInsertion.apmldv = targetInsertion.CoordinateTransform.Space2TransformAxisChange( targetInsertion.CoordinateSpace.World2Space(offsetAdjustedTargetPositionWorldT)); + return Vector3.Distance(targetInsertion.apmldv, ProbeManager.ProbeController.Insertion.apmldv); } } // Landmark depths - private float _outsideDepth; // FIXME: probably not needed as we just pull up on DV + private float _outsideDepth; private float _exitMarginDepth => _duraDepth - DURA_MARGIN_DISTANCE; private float _duraDepth => @@ -246,15 +247,16 @@ private float _targetDriveDistance private float _targetDepth => _duraDepth + _targetDriveDistance; + private float _drivePastTargetDistance = DRIVE_PAST_TARGET_DISTANCE; private float _pastTargetDepth => _targetDepth + _drivePastTargetDistance; - + + // Durations private float _targetDriveDuration; private float _duraMarginDepth; private float _duraMarginDriveDuration => DURA_MARGIN_DISTANCE / _exitDriveBaseSpeed; private float _exitDepth; private float _exitDriveDuration; - private float _drivePastTargetDistance = DRIVE_PAST_TARGET_DISTANCE; // Drive Speeds private float _driveBaseSpeed = DEPTH_DRIVE_BASE_SPEED; From 1a98e05b3347332579a01b2d89e81f9b53695f62 Mon Sep 17 00:00:00 2001 From: Kenneth Yang Date: Tue, 24 Oct 2023 11:50:42 -0700 Subject: [PATCH 33/78] Drive can complete --- .../Probes/ManipulatorBehaviorController.cs | 6 --- .../UI/EphysCopilot/DrivePanelHandler.cs | 39 ++++++++++++++++--- .../ResetDuraOffsetPanelHandler.cs | 22 ++++++----- 3 files changed, 45 insertions(+), 22 deletions(-) diff --git a/Assets/Scripts/TrajectoryPlanner/Probes/ManipulatorBehaviorController.cs b/Assets/Scripts/TrajectoryPlanner/Probes/ManipulatorBehaviorController.cs index 4541d0e8..4512cf83 100644 --- a/Assets/Scripts/TrajectoryPlanner/Probes/ManipulatorBehaviorController.cs +++ b/Assets/Scripts/TrajectoryPlanner/Probes/ManipulatorBehaviorController.cs @@ -334,12 +334,6 @@ public void ComputeBrainSurfaceOffset() _probeController.Insertion.World2Transformed( _annotationDataset.CoordinateSpace.Space2World(brainSurfaceCoordinate)); - print("Brain surface offset: " + BrainSurfaceOffset + " + " + Vector3.Distance( - brainSurfaceToTransformed, - _probeController.Insertion.apmldv) + " = " + (BrainSurfaceOffset + Vector3.Distance( - brainSurfaceToTransformed, - _probeController.Insertion.apmldv))); - BrainSurfaceOffset += Vector3.Distance(brainSurfaceToTransformed, _probeController.Insertion.apmldv); } diff --git a/Assets/Scripts/TrajectoryPlanner/UI/EphysCopilot/DrivePanelHandler.cs b/Assets/Scripts/TrajectoryPlanner/UI/EphysCopilot/DrivePanelHandler.cs index cec69236..fe22594d 100644 --- a/Assets/Scripts/TrajectoryPlanner/UI/EphysCopilot/DrivePanelHandler.cs +++ b/Assets/Scripts/TrajectoryPlanner/UI/EphysCopilot/DrivePanelHandler.cs @@ -206,7 +206,7 @@ public void CompleteMovement() private DriveState _driveState; private readonly DriveStateManager _driveStateManager = new(); - // Target drive distance + // Target drive distance (returns NaN if not on dura) private float _targetDriveDistance { get @@ -228,8 +228,12 @@ private float _targetDriveDistance targetInsertion.apmldv = targetInsertion.CoordinateTransform.Space2TransformAxisChange( targetInsertion.CoordinateSpace.World2Space(offsetAdjustedTargetPositionWorldT)); - - return Vector3.Distance(targetInsertion.apmldv, ProbeManager.ProbeController.Insertion.apmldv); + + return Vector3.Distance(targetInsertion.apmldv, + ResetDuraOffsetPanelHandler.ManipulatorIdToDuraApmldv.TryGetValue( + ProbeManager.ManipulatorBehaviorController.ManipulatorID, out var depth) + ? depth + : new Vector3(float.NaN, float.NaN, float.NaN)); } } @@ -242,11 +246,11 @@ private float _targetDriveDistance ProbeManager.ManipulatorBehaviorController.ManipulatorID, out var depth) ? depth : float.NaN; - - private float _nearTargetDepth => _targetDepth - NEAR_TARGET_DISTANCE; - + private float _targetDepth => _duraDepth + _targetDriveDistance; + private float _nearTargetDepth => _targetDepth - NEAR_TARGET_DISTANCE; + private float _drivePastTargetDistance = DRIVE_PAST_TARGET_DISTANCE; private float _pastTargetDepth => _targetDepth + _drivePastTargetDistance; @@ -382,6 +386,14 @@ public void Drive() _driveGroup.SetActive(false); _stopButton.SetActive(true); + print("Dura depth: " + _duraDepth + " + target drive distance: " + + _targetDriveDistance + " - near target distance: " + NEAR_TARGET_DISTANCE + + " = near target depth " + _nearTargetDepth); + + print("Currently at " + position.w + " and driving to near target depth " + + _nearTargetDepth + + " at speed " + _targetDriveSpeed); + // Drive to near target depth if (position.w < _nearTargetDepth) CommunicationManager.Instance.DriveToDepth( @@ -399,6 +411,14 @@ public void Drive() _driveGroup.SetActive(false); _stopButton.SetActive(true); + + print("Dura depth: " + _duraDepth + " + target drive distance: " + + _targetDriveDistance + " + past target distance: " + _drivePastTargetDistance + + " = past target depth " + _pastTargetDepth); + print("Currently at " + position.w + " and driving to past target depth " + + _pastTargetDepth + + " at speed " + _targetDriveSpeed); + // Drive to past target depth if (position.w < _pastTargetDepth) CommunicationManager.Instance.DriveToDepth( @@ -416,6 +436,13 @@ public void Drive() _driveGroup.SetActive(false); _stopButton.SetActive(true); + print("Dura depth: " + _duraDepth + "; target drive distance: " + _targetDriveDistance + + " = target depth " + _targetDepth); + + print("Currently at " + position.w + " and driving to target depth " + _targetDepth + + " at speed " + + _targetDriveSpeed); + // Drive to target and complete movement CommunicationManager.Instance.DriveToDepth( ProbeManager.ManipulatorBehaviorController.ManipulatorID, _targetDepth, diff --git a/Assets/Scripts/TrajectoryPlanner/UI/EphysCopilot/ResetDuraOffsetPanelHandler.cs b/Assets/Scripts/TrajectoryPlanner/UI/EphysCopilot/ResetDuraOffsetPanelHandler.cs index 3303d735..45c89737 100644 --- a/Assets/Scripts/TrajectoryPlanner/UI/EphysCopilot/ResetDuraOffsetPanelHandler.cs +++ b/Assets/Scripts/TrajectoryPlanner/UI/EphysCopilot/ResetDuraOffsetPanelHandler.cs @@ -1,7 +1,6 @@ using System.Collections.Generic; using EphysLink; using TMPro; -using TrajectoryPlanner.Probes; using UnityEngine; namespace TrajectoryPlanner.UI.EphysCopilot @@ -12,13 +11,13 @@ public class ResetDuraOffsetPanelHandler : MonoBehaviour [SerializeField] private TMP_Text _manipulatorIDText; public ProbeManager ProbeManager { private get; set; } - private ManipulatorBehaviorController _manipulatorBehaviorController; #endregion #region Properties - public static Dictionary ManipulatorIdToDuraDepth = new(); + public static readonly Dictionary ManipulatorIdToDuraDepth = new(); + public static readonly Dictionary ManipulatorIdToDuraApmldv = new(); #endregion @@ -26,9 +25,7 @@ public class ResetDuraOffsetPanelHandler : MonoBehaviour private void Start() { - _manipulatorBehaviorController = ProbeManager.gameObject.GetComponent(); - - _manipulatorIDText.text = "Manipulator " + _manipulatorBehaviorController.ManipulatorID; + _manipulatorIDText.text = "Manipulator " + ProbeManager.ManipulatorBehaviorController.ManipulatorID; _manipulatorIDText.color = ProbeManager.Color; } @@ -42,10 +39,15 @@ private void Start() public void ResetDuraOffset() { // Reset dura offset - _manipulatorBehaviorController.ComputeBrainSurfaceOffset(); - - CommunicationManager.Instance.GetPos(_manipulatorBehaviorController.ManipulatorID, - pos => { ManipulatorIdToDuraDepth[_manipulatorBehaviorController.ManipulatorID] = pos.w; }); + ProbeManager.ManipulatorBehaviorController.ComputeBrainSurfaceOffset(); + + CommunicationManager.Instance.GetPos(ProbeManager.ManipulatorBehaviorController.ManipulatorID, + pos => + { + ManipulatorIdToDuraDepth[ProbeManager.ManipulatorBehaviorController.ManipulatorID] = pos.w; + ManipulatorIdToDuraApmldv[ProbeManager.ManipulatorBehaviorController.ManipulatorID] = + ProbeManager.ProbeController.Insertion.apmldv; + }); } #endregion From e5a04cbbf0b7f98f6a4562cef2d63c5817c0a987 Mon Sep 17 00:00:00 2001 From: Kenneth Yang Date: Tue, 24 Oct 2023 14:05:13 -0700 Subject: [PATCH 34/78] Exiting --- .../Prefabs/UI/EphysCopilot/DrivePanel.prefab | 10 +- Assets/Scenes/TrajectoryPlanner.unity | 22 +- .../UI/EphysCopilot/DrivePanelHandler.cs | 202 ++++++++++++++---- 3 files changed, 176 insertions(+), 58 deletions(-) diff --git a/Assets/Prefabs/UI/EphysCopilot/DrivePanel.prefab b/Assets/Prefabs/UI/EphysCopilot/DrivePanel.prefab index 4cb26835..060b294f 100644 --- a/Assets/Prefabs/UI/EphysCopilot/DrivePanel.prefab +++ b/Assets/Prefabs/UI/EphysCopilot/DrivePanel.prefab @@ -2750,7 +2750,7 @@ GameObject: - component: {fileID: 4132892186996900426} - component: {fileID: 2688848427838830438} m_Layer: 5 - m_Name: ReturnButton + m_Name: ExitButton m_TagString: Untagged m_Icon: {fileID: 0} m_NavMeshLayer: 0 @@ -2774,7 +2774,7 @@ 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: -116.292206} + m_AnchoredPosition: {x: 250, y: -205.83333} m_SizeDelta: {x: 500, y: 55} m_Pivot: {x: 0.5, y: 0.5} --- !u!222 &5092748061186658588 @@ -2862,7 +2862,7 @@ MonoBehaviour: - m_Target: {fileID: 4325646625566643338} m_TargetAssemblyTypeName: TrajectoryPlanner.UI.EphysCopilot.DrivePanelHandler, trajectoryplanner.ui.ephyscopilot - m_MethodName: DriveBackToSurface + m_MethodName: Exit m_Mode: 1 m_Arguments: m_ObjectArgument: {fileID: 0} @@ -3454,8 +3454,8 @@ MonoBehaviour: _drivePastDistanceInputField: {fileID: 1362464887898080331} _stopButton: {fileID: 8950310822258812797} _skipSettlingButton: {fileID: 3200770919843244483} - _returnButton: {fileID: 6315168989377721155} - _returnButtonText: {fileID: 3744103793431505929} + _exitButton: {fileID: 6315168989377721155} + _exitButtonText: {fileID: 3744103793431505929} _statusText: {fileID: 3023744443413706275} _timerText: {fileID: 6333824926798648489} --- !u!114 &2376644107146004916 diff --git a/Assets/Scenes/TrajectoryPlanner.unity b/Assets/Scenes/TrajectoryPlanner.unity index 233ec83b..749989ce 100644 --- a/Assets/Scenes/TrajectoryPlanner.unity +++ b/Assets/Scenes/TrajectoryPlanner.unity @@ -2335,15 +2335,15 @@ PrefabInstance: objectReference: {fileID: 1703646459} - target: {fileID: 341190943836035196, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} propertyPath: m_AnchorMax.y - value: 0 + value: 1 objectReference: {fileID: 0} - target: {fileID: 341190943836035196, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} propertyPath: m_AnchorMin.y - value: 0 + value: 1 objectReference: {fileID: 0} - target: {fileID: 341190943836035196, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} propertyPath: m_AnchoredPosition.x - value: 0 + value: 169.88 objectReference: {fileID: 0} - target: {fileID: 341190943836276264, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} propertyPath: onValueChanged.m_PersistentCalls.m_Calls.Array.data[0].m_Target @@ -2439,19 +2439,19 @@ PrefabInstance: objectReference: {fileID: 1445581475} - target: {fileID: 341190944034978748, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} propertyPath: m_AnchorMax.y - value: 0 + value: 1 objectReference: {fileID: 0} - target: {fileID: 341190944034978748, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} propertyPath: m_AnchorMin.y - value: 0 + value: 1 objectReference: {fileID: 0} - target: {fileID: 341190944034978748, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} propertyPath: m_AnchoredPosition.x - value: 0 + value: 354.84 objectReference: {fileID: 0} - target: {fileID: 341190944034978748, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} propertyPath: m_AnchoredPosition.y - value: 0 + value: -15 objectReference: {fileID: 0} - target: {fileID: 341190944083206642, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} propertyPath: m_Name @@ -2679,19 +2679,19 @@ PrefabInstance: objectReference: {fileID: 0} - target: {fileID: 341190944410943211, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} propertyPath: m_AnchorMax.y - value: 0 + value: 1 objectReference: {fileID: 0} - target: {fileID: 341190944410943211, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} propertyPath: m_AnchorMin.y - value: 0 + value: 1 objectReference: {fileID: 0} - target: {fileID: 341190944410943211, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} propertyPath: m_AnchoredPosition.x - value: 0 + value: 384.91998 objectReference: {fileID: 0} - target: {fileID: 341190944410943211, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} propertyPath: m_AnchoredPosition.y - value: 0 + value: -15 objectReference: {fileID: 0} - target: {fileID: 341190944411999430, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} propertyPath: m_AnchorMax.y diff --git a/Assets/Scripts/TrajectoryPlanner/UI/EphysCopilot/DrivePanelHandler.cs b/Assets/Scripts/TrajectoryPlanner/UI/EphysCopilot/DrivePanelHandler.cs index fe22594d..77582a08 100644 --- a/Assets/Scripts/TrajectoryPlanner/UI/EphysCopilot/DrivePanelHandler.cs +++ b/Assets/Scripts/TrajectoryPlanner/UI/EphysCopilot/DrivePanelHandler.cs @@ -32,17 +32,23 @@ private enum DriveState AtTarget } - private const float DRIVE_PAST_TARGET_DISTANCE = 0.05f; + // Relative distances (in mm) + private const float OUTSIDE_DISTANCE = 3.5f; private const float DURA_MARGIN_DISTANCE = 0.1f; private const float NEAR_TARGET_DISTANCE = 1f; + private const float DRIVE_PAST_TARGET_DISTANCE = 0.05f; - private const float DEPTH_DRIVE_BASE_SPEED = 0.005f; + // 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; + // Speed multipliers private const float NEAR_TARGET_SPEED_MULTIPLIER = 2f / 3f; private const int EXIT_DRIVE_SPEED_MULTIPLIER = 5; private const int OUTSIDE_DRIVE_SPEED_MULTIPLIER = 20; + // Per 1000 um speed increase (in mm/s) private const float PER_1000_SPEED = 0.001f; private const float PER_1000_SPEED_TEST = 0.01f; @@ -57,13 +63,13 @@ private enum DriveState [SerializeField] private TMP_InputField _drivePastDistanceInputField; [SerializeField] private GameObject _stopButton; [SerializeField] private GameObject _skipSettlingButton; - [SerializeField] private GameObject _returnButton; - [SerializeField] private TMP_Text _returnButtonText; + [SerializeField] private GameObject _exitButton; + [SerializeField] private TMP_Text _exitButtonText; [SerializeField] private TMP_Text _statusText; [SerializeField] private TMP_Text _timerText; public ProbeManager ProbeManager { private get; set; } - + private class DriveStateManager { // FIXME: use position to detect state @@ -238,7 +244,7 @@ private float _targetDriveDistance } // Landmark depths - private float _outsideDepth; + private float _outsideDepth => _duraDepth - OUTSIDE_DISTANCE; private float _exitMarginDepth => _duraDepth - DURA_MARGIN_DISTANCE; private float _duraDepth => @@ -246,14 +252,11 @@ private float _targetDriveDistance ProbeManager.ManipulatorBehaviorController.ManipulatorID, out var depth) ? depth : float.NaN; - private float _targetDepth => _duraDepth + _targetDriveDistance; - private float _nearTargetDepth => _targetDepth - NEAR_TARGET_DISTANCE; - private float _drivePastTargetDistance = DRIVE_PAST_TARGET_DISTANCE; private float _pastTargetDepth => _targetDepth + _drivePastTargetDistance; - + // Durations private float _targetDriveDuration; private float _duraMarginDepth; @@ -268,6 +271,8 @@ private float _targetDriveDistance private float _targetDriveSpeed => _driveBaseSpeed + _targetDriveDistance * _per1000Speed; private float _nearTargetDriveSpeed => _driveBaseSpeed * NEAR_TARGET_SPEED_MULTIPLIER; private float _exitDriveBaseSpeed => _driveBaseSpeed * EXIT_DRIVE_SPEED_MULTIPLIER; + private float _exitDriveSpeed => _exitDriveBaseSpeed + _targetDriveDistance * _per1000Speed; + private float _nearTargetExitSpeed => _exitDriveBaseSpeed * NEAR_TARGET_SPEED_MULTIPLIER; private float _outsideDriveSpeed => _driveBaseSpeed * OUTSIDE_DRIVE_SPEED_MULTIPLIER; #endregion @@ -310,7 +315,7 @@ public void OnSpeedChanged(float value) SpeedToString(DEPTH_DRIVE_BASE_SPEED) + ". Are you sure you want to continue?"); } - + // Update base speed accordingly _driveBaseSpeed = value / 1000f; } @@ -386,22 +391,14 @@ public void Drive() _driveGroup.SetActive(false); _stopButton.SetActive(true); - print("Dura depth: " + _duraDepth + " + target drive distance: " + - _targetDriveDistance + " - near target distance: " + NEAR_TARGET_DISTANCE + - " = near target depth " + _nearTargetDepth); - - print("Currently at " + position.w + " and driving to near target depth " + - _nearTargetDepth + - " at speed " + _targetDriveSpeed); - // Drive to near target depth if (position.w < _nearTargetDepth) CommunicationManager.Instance.DriveToDepth( ProbeManager.ManipulatorBehaviorController.ManipulatorID, _nearTargetDepth, _targetDriveSpeed, _ => CompleteAndAdvance(), Debug.LogError); else + // Already closer than near target depth, so continue CompleteAndAdvance(); - break; case DriveState.DriveToPastTarget: // Update status text @@ -411,22 +408,14 @@ public void Drive() _driveGroup.SetActive(false); _stopButton.SetActive(true); - - print("Dura depth: " + _duraDepth + " + target drive distance: " + - _targetDriveDistance + " + past target distance: " + _drivePastTargetDistance + - " = past target depth " + _pastTargetDepth); - print("Currently at " + position.w + " and driving to past target depth " + - _pastTargetDepth + - " at speed " + _targetDriveSpeed); - // Drive to past target depth if (position.w < _pastTargetDepth) CommunicationManager.Instance.DriveToDepth( ProbeManager.ManipulatorBehaviorController.ManipulatorID, _pastTargetDepth, _nearTargetDriveSpeed, _ => CompleteAndAdvance(), Debug.LogError); else + // Already further than past target depth, so continue CompleteAndAdvance(); - break; case DriveState.ReturningToTarget: // Update status text @@ -436,13 +425,6 @@ public void Drive() _driveGroup.SetActive(false); _stopButton.SetActive(true); - print("Dura depth: " + _duraDepth + "; target drive distance: " + _targetDriveDistance + - " = target depth " + _targetDepth); - - print("Currently at " + position.w + " and driving to target depth " + _targetDepth + - " at speed " + - _targetDriveSpeed); - // Drive to target and complete movement CommunicationManager.Instance.DriveToDepth( ProbeManager.ManipulatorBehaviorController.ManipulatorID, _targetDepth, @@ -457,10 +439,12 @@ public void Drive() // Complete driving _statusText.text = "Drive complete"; _stopButton.SetActive(false); + + // Enable return to surface button + _exitButton.SetActive(true); }); }, Debug.LogError); break; - case DriveState.Ready: case DriveState.DrivingToSurface: case DriveState.DrivingToTarget: @@ -475,7 +459,7 @@ public void Drive() case DriveState.AtPastTarget: case DriveState.AtTarget: default: - Debug.LogError("Invalid Drive state."); + Debug.LogError("Invalid Drive state for driving."); return; } }, Debug.LogError); @@ -550,6 +534,140 @@ public void OldDrive() }); } + public void Exit() + { + // Get current position + CommunicationManager.Instance.GetPos(ProbeManager.ManipulatorBehaviorController.ManipulatorID, position => + { + // Increment state + _driveStateManager.ExitIncrement(); + + CommunicationManager.Instance.SetCanWrite(ProbeManager.ManipulatorBehaviorController.ManipulatorID, + true, 1, + canWrite => + { + if (!canWrite) return; + + // Do something based on current state + switch (_driveStateManager.State) + { + case DriveState.ExitingToNearTarget: + // Update status text + _statusText.text = "Returning to surface..."; + + // Replace drive buttons with stop + _exitButton.SetActive(false); + _stopButton.SetActive(true); + + // Drive to near target depth + if (position.w > _nearTargetDepth && _nearTargetDepth > _duraDepth) + CommunicationManager.Instance.DriveToDepth( + ProbeManager.ManipulatorBehaviorController.ManipulatorID, _nearTargetDepth, + _nearTargetExitSpeed, _ => CompleteAndAdvance(), Debug.LogError); + else + // Dura depth is within near target distance, so continue + CompleteAndAdvance(); + + break; + case DriveState.ExitingToDura: + // Update status text + _statusText.text = "Returning to surface..."; + + // Replace drive buttons with stop + _exitButton.SetActive(false); + _stopButton.SetActive(true); + + // Drive to dura depth (set speed based on dura depth and near target depth) + if (position.w > _duraDepth) + CommunicationManager.Instance.DriveToDepth( + ProbeManager.ManipulatorBehaviorController.ManipulatorID, _duraDepth, + position.w > _nearTargetDepth ? _nearTargetExitSpeed : _exitDriveSpeed, + _ => CompleteAndAdvance(), Debug.LogError); + else + // Already at dura depth, so continue + CompleteAndAdvance(); + break; + case DriveState.ExitingToMargin: + // Update status text + _statusText.text = "Exiting Dura..."; + + // Replace drive buttons with stop + _exitButton.SetActive(false); + _stopButton.SetActive(true); + + // Drive to dura margin depth + if (position.w > _exitMarginDepth) + CommunicationManager.Instance.DriveToDepth( + ProbeManager.ManipulatorBehaviorController.ManipulatorID, _exitMarginDepth, + position.w > _nearTargetDepth ? _nearTargetExitSpeed : _exitDriveSpeed, + _ => CompleteAndAdvance(), Debug.LogError); + else + // Already at dura margin depth, so continue + CompleteAndAdvance(); + break; + case DriveState.ExitingToOutside: + // Update status text + _statusText.text = "Exiting Dura..."; + + // Replace drive buttons with stop + _exitButton.SetActive(false); + _stopButton.SetActive(true); + + // Drive to outside depth + if (position.w > _outsideDepth) + CommunicationManager.Instance.DriveToDepth( + ProbeManager.ManipulatorBehaviorController.ManipulatorID, _outsideDepth, + _outsideDriveSpeed, _ => CompleteOutside(), Debug.LogError); + else + // Already outside, so complete + CompleteOutside(); + break; + case DriveState.Ready: + case DriveState.DrivingToSurface: + case DriveState.DrivingToTarget: + case DriveState.Outside: + case DriveState.AtExitMargin: + case DriveState.AtDura: + case DriveState.DrivingToNearTarget: + case DriveState.AtNearTarget: + case DriveState.DriveToPastTarget: + case DriveState.AtPastTarget: + case DriveState.ReturningToTarget: + case DriveState.AtTarget: + default: + Debug.LogError("Invalid Drive state for exiting."); + return; + } + }, Debug.LogError); + }, Debug.LogError); + return; + + void CompleteAndAdvance() + { + CommunicationManager.Instance.SetCanWrite(ProbeManager.ManipulatorBehaviorController.ManipulatorID, + false, 0, + _ => + { + _driveStateManager.CompleteMovement(); + Exit(); + }, Debug.LogError); + } + + void CompleteOutside() + { + CommunicationManager.Instance.SetCanWrite(ProbeManager.ManipulatorBehaviorController.ManipulatorID, + false, 0, + _ => + { + _driveStateManager.CompleteMovement(); + + // Reset UI + _statusText.text = "Ready to Drive"; + _stopButton.SetActive(false); + _driveGroup.SetActive(true); + }, Debug.LogError); + } + } public void DriveBackToSurface() { @@ -563,7 +681,7 @@ public void DriveBackToSurface() if (!canWrite) return; // Set drive status and show stop button _statusText.text = "Driving back to surface..."; - _returnButton.SetActive(false); + _exitButton.SetActive(false); _stopButton.SetActive(true); _driveState = DriveState.DrivingToSurface; @@ -628,7 +746,7 @@ public void Stop() // Setup for returning to surface _driveState = DriveState.AtTarget; _stopButton.SetActive(false); - _returnButton.SetActive(true); + _exitButton.SetActive(true); } else { @@ -648,7 +766,7 @@ public void Stop() private void ComputeAndSetDriveTime(float depthDriveBaseSpeed, Action callback = null) { // Update drive past distance and return to surface button text - _returnButtonText.text = "Return to Surface (" + SpeedToString(_exitDriveBaseSpeed) + ")"; + _exitButtonText.text = "Return to Surface (" + SpeedToString(_exitDriveBaseSpeed) + ")"; // Compute drive distance and duration CommunicationManager.Instance.GetPos(ProbeManager.ManipulatorBehaviorController.ManipulatorID, position => @@ -793,7 +911,7 @@ private void CompleteDrive() { _statusText.text = "Drive complete"; _skipSettlingButton.SetActive(false); - _returnButton.SetActive(true); + _exitButton.SetActive(true); _driveState = DriveState.AtTarget; } From 1150899fc3b65fe7fe1e02acfcce3d045d8a790e Mon Sep 17 00:00:00 2001 From: Kenneth Yang Date: Tue, 24 Oct 2023 14:30:10 -0700 Subject: [PATCH 35/78] Extract manipulatorId --- .../UI/EphysCopilot/DrivePanelHandler.cs | 277 +++++++++--------- 1 file changed, 132 insertions(+), 145 deletions(-) diff --git a/Assets/Scripts/TrajectoryPlanner/UI/EphysCopilot/DrivePanelHandler.cs b/Assets/Scripts/TrajectoryPlanner/UI/EphysCopilot/DrivePanelHandler.cs index 77582a08..894a36ce 100644 --- a/Assets/Scripts/TrajectoryPlanner/UI/EphysCopilot/DrivePanelHandler.cs +++ b/Assets/Scripts/TrajectoryPlanner/UI/EphysCopilot/DrivePanelHandler.cs @@ -69,10 +69,9 @@ private enum DriveState [SerializeField] private TMP_Text _timerText; public ProbeManager ProbeManager { private get; set; } - + private class DriveStateManager { - // FIXME: use position to detect state // Define state, defaults to at dura public DriveState State { get; private set; } = DriveState.AtDura; @@ -203,6 +202,9 @@ public void CompleteMovement() #region Properties + // Manipulator ID + private string _manipulatorId => ProbeManager.ManipulatorBehaviorController.ManipulatorID; + // Boundary acknowledgements private bool _acknowledgeOutOfBounds; private bool _acknowledgeTestSpeeds; @@ -220,7 +222,7 @@ private float _targetDriveDistance // Calibrate target insertion depth based on surface position var targetInsertion = new ProbeInsertion( InsertionSelectionPanelHandler.ManipulatorIDToSelectedTargetProbeManager[ - ProbeManager.ManipulatorBehaviorController.ManipulatorID].ProbeController.Insertion); + _manipulatorId].ProbeController.Insertion); var targetPositionWorldT = targetInsertion.PositionWorldT(); var relativePositionWorldT = ProbeManager.ProbeController.Insertion.PositionWorldT() - targetPositionWorldT; @@ -237,7 +239,7 @@ private float _targetDriveDistance return Vector3.Distance(targetInsertion.apmldv, ResetDuraOffsetPanelHandler.ManipulatorIdToDuraApmldv.TryGetValue( - ProbeManager.ManipulatorBehaviorController.ManipulatorID, out var depth) + _manipulatorId, out var depth) ? depth : new Vector3(float.NaN, float.NaN, float.NaN)); } @@ -249,9 +251,10 @@ private float _targetDriveDistance private float _duraDepth => ResetDuraOffsetPanelHandler.ManipulatorIdToDuraDepth.TryGetValue( - ProbeManager.ManipulatorBehaviorController.ManipulatorID, out var depth) + _manipulatorId, out var depth) ? depth : float.NaN; + private float _targetDepth => _duraDepth + _targetDriveDistance; private float _nearTargetDepth => _targetDepth - NEAR_TARGET_DISTANCE; private float _drivePastTargetDistance = DRIVE_PAST_TARGET_DISTANCE; @@ -282,7 +285,7 @@ private float _targetDriveDistance private void Start() { // Set manipulator ID text - _manipulatorIDText.text = "Manipulator " + ProbeManager.ManipulatorBehaviorController.ManipulatorID; + _manipulatorIDText.text = "Manipulator " + _manipulatorId; _manipulatorIDText.color = ProbeManager.Color; // Add drive past distance input field to focusable inputs @@ -369,13 +372,12 @@ public void OnDrivePastDistanceChanged(string value) public void Drive() { // Get current position - CommunicationManager.Instance.GetPos(ProbeManager.ManipulatorBehaviorController.ManipulatorID, position => + CommunicationManager.Instance.GetPos(_manipulatorId, position => { // Increment state _driveStateManager.DriveIncrement(); - CommunicationManager.Instance.SetCanWrite( - ProbeManager.ManipulatorBehaviorController.ManipulatorID, true, 1, + CommunicationManager.Instance.SetCanWrite(_manipulatorId, true, 1, canWrite => { if (!canWrite) return; @@ -393,8 +395,7 @@ public void Drive() // Drive to near target depth if (position.w < _nearTargetDepth) - CommunicationManager.Instance.DriveToDepth( - ProbeManager.ManipulatorBehaviorController.ManipulatorID, _nearTargetDepth, + CommunicationManager.Instance.DriveToDepth(_manipulatorId, _nearTargetDepth, _targetDriveSpeed, _ => CompleteAndAdvance(), Debug.LogError); else // Already closer than near target depth, so continue @@ -410,8 +411,7 @@ public void Drive() // Drive to past target depth if (position.w < _pastTargetDepth) - CommunicationManager.Instance.DriveToDepth( - ProbeManager.ManipulatorBehaviorController.ManipulatorID, _pastTargetDepth, + CommunicationManager.Instance.DriveToDepth(_manipulatorId, _pastTargetDepth, _nearTargetDriveSpeed, _ => CompleteAndAdvance(), Debug.LogError); else // Already further than past target depth, so continue @@ -427,11 +427,10 @@ public void Drive() // Drive to target and complete movement CommunicationManager.Instance.DriveToDepth( - ProbeManager.ManipulatorBehaviorController.ManipulatorID, _targetDepth, + _manipulatorId, _targetDepth, _nearTargetDriveSpeed, _ => { - CommunicationManager.Instance.SetCanWrite( - ProbeManager.ManipulatorBehaviorController.ManipulatorID, false, 0, + CommunicationManager.Instance.SetCanWrite(_manipulatorId, false, 0, _ => { _driveStateManager.CompleteMovement(); @@ -468,7 +467,7 @@ public void Drive() void CompleteAndAdvance() { - CommunicationManager.Instance.SetCanWrite(ProbeManager.ManipulatorBehaviorController.ManipulatorID, + CommunicationManager.Instance.SetCanWrite(_manipulatorId, false, 0, _ => { @@ -482,7 +481,7 @@ public void OldDrive() { ComputeAndSetDriveTime(_driveBaseSpeed, () => { - CommunicationManager.Instance.SetCanWrite(ProbeManager.ManipulatorBehaviorController.ManipulatorID, + CommunicationManager.Instance.SetCanWrite(_manipulatorId, true, 1, canWrite => { if (!canWrite) return; @@ -508,13 +507,13 @@ public void OldDrive() // Drive until within near target distance CommunicationManager.Instance.DriveToDepth( - ProbeManager.ManipulatorBehaviorController.ManipulatorID, + _manipulatorId, driveDepth, _targetDriveSpeed, _ => { // Drive through past target distance CommunicationManager.Instance.DriveToDepth( - ProbeManager.ManipulatorBehaviorController.ManipulatorID, + _manipulatorId, _targetDepth + _drivePastTargetDistance, _targetDriveSpeed * NEAR_TARGET_SPEED_MULTIPLIER, _ => @@ -523,7 +522,7 @@ public void OldDrive() // Drive back to target CommunicationManager.Instance.DriveToDepth( - ProbeManager.ManipulatorBehaviorController.ManipulatorID, + _manipulatorId, _targetDepth, _targetDriveSpeed * NEAR_TARGET_SPEED_MULTIPLIER, _ => StartSettling(), Debug.LogError); @@ -537,145 +536,133 @@ public void OldDrive() public void Exit() { // Get current position - CommunicationManager.Instance.GetPos(ProbeManager.ManipulatorBehaviorController.ManipulatorID, position => + CommunicationManager.Instance.GetPos(_manipulatorId, position => { // Increment state _driveStateManager.ExitIncrement(); - CommunicationManager.Instance.SetCanWrite(ProbeManager.ManipulatorBehaviorController.ManipulatorID, - true, 1, - canWrite => - { - if (!canWrite) return; - - // Do something based on current state - switch (_driveStateManager.State) - { - case DriveState.ExitingToNearTarget: - // Update status text - _statusText.text = "Returning to surface..."; - - // Replace drive buttons with stop - _exitButton.SetActive(false); - _stopButton.SetActive(true); - - // Drive to near target depth - if (position.w > _nearTargetDepth && _nearTargetDepth > _duraDepth) - CommunicationManager.Instance.DriveToDepth( - ProbeManager.ManipulatorBehaviorController.ManipulatorID, _nearTargetDepth, - _nearTargetExitSpeed, _ => CompleteAndAdvance(), Debug.LogError); - else - // Dura depth is within near target distance, so continue - CompleteAndAdvance(); - - break; - case DriveState.ExitingToDura: - // Update status text - _statusText.text = "Returning to surface..."; - - // Replace drive buttons with stop - _exitButton.SetActive(false); - _stopButton.SetActive(true); - - // Drive to dura depth (set speed based on dura depth and near target depth) - if (position.w > _duraDepth) - CommunicationManager.Instance.DriveToDepth( - ProbeManager.ManipulatorBehaviorController.ManipulatorID, _duraDepth, - position.w > _nearTargetDepth ? _nearTargetExitSpeed : _exitDriveSpeed, - _ => CompleteAndAdvance(), Debug.LogError); - else - // Already at dura depth, so continue - CompleteAndAdvance(); - break; - case DriveState.ExitingToMargin: - // Update status text - _statusText.text = "Exiting Dura..."; - - // Replace drive buttons with stop - _exitButton.SetActive(false); - _stopButton.SetActive(true); - - // Drive to dura margin depth - if (position.w > _exitMarginDepth) - CommunicationManager.Instance.DriveToDepth( - ProbeManager.ManipulatorBehaviorController.ManipulatorID, _exitMarginDepth, - position.w > _nearTargetDepth ? _nearTargetExitSpeed : _exitDriveSpeed, - _ => CompleteAndAdvance(), Debug.LogError); - else - // Already at dura margin depth, so continue - CompleteAndAdvance(); - break; - case DriveState.ExitingToOutside: - // Update status text - _statusText.text = "Exiting Dura..."; - - // Replace drive buttons with stop - _exitButton.SetActive(false); - _stopButton.SetActive(true); + CommunicationManager.Instance.SetCanWrite(_manipulatorId, true, 1, canWrite => + { + if (!canWrite) return; - // Drive to outside depth - if (position.w > _outsideDepth) - CommunicationManager.Instance.DriveToDepth( - ProbeManager.ManipulatorBehaviorController.ManipulatorID, _outsideDepth, - _outsideDriveSpeed, _ => CompleteOutside(), Debug.LogError); - else - // Already outside, so complete - CompleteOutside(); - break; - case DriveState.Ready: - case DriveState.DrivingToSurface: - case DriveState.DrivingToTarget: - case DriveState.Outside: - case DriveState.AtExitMargin: - case DriveState.AtDura: - case DriveState.DrivingToNearTarget: - case DriveState.AtNearTarget: - case DriveState.DriveToPastTarget: - case DriveState.AtPastTarget: - case DriveState.ReturningToTarget: - case DriveState.AtTarget: - default: - Debug.LogError("Invalid Drive state for exiting."); - return; - } - }, Debug.LogError); + // Do something based on current state + switch (_driveStateManager.State) + { + case DriveState.ExitingToNearTarget: + // Update status text + _statusText.text = "Returning to surface..."; + + // Replace drive buttons with stop + _exitButton.SetActive(false); + _stopButton.SetActive(true); + + // Drive to near target depth + if (_nearTargetDepth > _duraDepth && position.w > _nearTargetDepth) + CommunicationManager.Instance.DriveToDepth(_manipulatorId, _nearTargetDepth, + _nearTargetExitSpeed, _ => CompleteAndAdvance(), Debug.LogError); + else + // Dura depth is within near target distance, so continue + CompleteAndAdvance(); + break; + case DriveState.ExitingToDura: + // Update status text + _statusText.text = "Returning to surface..."; + + // Replace drive buttons with stop + _exitButton.SetActive(false); + _stopButton.SetActive(true); + + // Drive to dura depth (set speed based on dura depth and near target depth) + if (position.w > _duraDepth) + CommunicationManager.Instance.DriveToDepth(_manipulatorId, _duraDepth, + position.w > _nearTargetDepth ? _nearTargetExitSpeed : _exitDriveSpeed, + _ => CompleteAndAdvance(), Debug.LogError); + else + // Already at dura depth, so continue + CompleteAndAdvance(); + break; + case DriveState.ExitingToMargin: + // Update status text + _statusText.text = "Exiting Dura..."; + + // Replace drive buttons with stop + _exitButton.SetActive(false); + _stopButton.SetActive(true); + + // Drive to dura margin depth + if (position.w > _exitMarginDepth) + CommunicationManager.Instance.DriveToDepth(_manipulatorId, _exitMarginDepth, + position.w > _nearTargetDepth ? _nearTargetExitSpeed : _exitDriveSpeed, + _ => CompleteAndAdvance(), Debug.LogError); + else + // Already at dura margin depth, so continue + CompleteAndAdvance(); + break; + case DriveState.ExitingToOutside: + // Update status text + _statusText.text = "Exiting Dura..."; + + // Replace drive buttons with stop + _exitButton.SetActive(false); + _stopButton.SetActive(true); + + // Drive to outside depth + if (position.w > _outsideDepth) + CommunicationManager.Instance.DriveToDepth(_manipulatorId, _outsideDepth, + _outsideDriveSpeed, _ => CompleteOutside(), Debug.LogError); + else + // Already outside, so complete + CompleteOutside(); + break; + case DriveState.Ready: + case DriveState.DrivingToSurface: + case DriveState.DrivingToTarget: + case DriveState.Outside: + case DriveState.AtExitMargin: + case DriveState.AtDura: + case DriveState.DrivingToNearTarget: + case DriveState.AtNearTarget: + case DriveState.DriveToPastTarget: + case DriveState.AtPastTarget: + case DriveState.ReturningToTarget: + case DriveState.AtTarget: + default: + Debug.LogError("Invalid Drive state for exiting."); + return; + } + }, Debug.LogError); }, Debug.LogError); return; void CompleteAndAdvance() { - CommunicationManager.Instance.SetCanWrite(ProbeManager.ManipulatorBehaviorController.ManipulatorID, - false, 0, - _ => - { - _driveStateManager.CompleteMovement(); - Exit(); - }, Debug.LogError); + CommunicationManager.Instance.SetCanWrite(_manipulatorId, false, 0, _ => + { + _driveStateManager.CompleteMovement(); + Exit(); + }, Debug.LogError); } void CompleteOutside() { - CommunicationManager.Instance.SetCanWrite(ProbeManager.ManipulatorBehaviorController.ManipulatorID, - false, 0, - _ => - { - _driveStateManager.CompleteMovement(); + CommunicationManager.Instance.SetCanWrite(_manipulatorId, false, 0, _ => + { + _driveStateManager.CompleteMovement(); - // Reset UI - _statusText.text = "Ready to Drive"; - _stopButton.SetActive(false); - _driveGroup.SetActive(true); - }, Debug.LogError); + // Reset UI + _statusText.text = "Ready to Drive"; + _stopButton.SetActive(false); + _driveGroup.SetActive(true); + }, Debug.LogError); } } public void DriveBackToSurface() { - CommunicationManager.Instance.GetPos(ProbeManager.ManipulatorBehaviorController.ManipulatorID, pos => + CommunicationManager.Instance.GetPos(_manipulatorId, pos => { // Drive - CommunicationManager.Instance.SetCanWrite(ProbeManager.ManipulatorBehaviorController.ManipulatorID, - true, 1, + CommunicationManager.Instance.SetCanWrite(_manipulatorId, true, 1, canWrite => { if (!canWrite) return; @@ -697,25 +684,25 @@ public void DriveBackToSurface() // Drive back to dura by near target distance (as much as possible) CommunicationManager.Instance.DriveToDepth( - ProbeManager.ManipulatorBehaviorController.ManipulatorID, + _manipulatorId, driveDepth, _exitDriveBaseSpeed * NEAR_TARGET_SPEED_MULTIPLIER, _ => { // Drive back to dura CommunicationManager.Instance.DriveToDepth( - ProbeManager.ManipulatorBehaviorController.ManipulatorID, _duraDepth, + _manipulatorId, _duraDepth, _exitDriveBaseSpeed, _ => { // Drive out by dura exit margin // FIXME: Dependent on CoordinateSpace direction. Should be standardized by Ephys Link. CommunicationManager.Instance.DriveToDepth( - ProbeManager.ManipulatorBehaviorController.ManipulatorID, + _manipulatorId, _duraDepth - ProbeManager.ManipulatorBehaviorController.CoordinateSpace .World2SpaceAxisChange(Vector3.up).z * DURA_MARGIN_DISTANCE, _exitDriveBaseSpeed, _ => { // Drive the rest of the way to the surface CommunicationManager.Instance.DriveToDepth( - ProbeManager.ManipulatorBehaviorController.ManipulatorID, + _manipulatorId, _exitDepth, _outsideDriveSpeed, _ => { // Reset manipulator drive states @@ -769,7 +756,7 @@ private void ComputeAndSetDriveTime(float depthDriveBaseSpeed, Action callback = _exitButtonText.text = "Return to Surface (" + SpeedToString(_exitDriveBaseSpeed) + ")"; // Compute drive distance and duration - CommunicationManager.Instance.GetPos(ProbeManager.ManipulatorBehaviorController.ManipulatorID, position => + CommunicationManager.Instance.GetPos(_manipulatorId, position => { // Remember dura depth // _duraDepth = position.w; @@ -777,7 +764,7 @@ private void ComputeAndSetDriveTime(float depthDriveBaseSpeed, Action callback = // Calibrate target insertion depth based on surface position var targetInsertion = new ProbeInsertion( InsertionSelectionPanelHandler.ManipulatorIDToSelectedTargetProbeManager[ - ProbeManager.ManipulatorBehaviorController.ManipulatorID].ProbeController.Insertion); + _manipulatorId].ProbeController.Insertion); var targetPositionWorldT = targetInsertion.PositionWorldT(); var relativePositionWorldT = ProbeManager.ProbeController.Insertion.PositionWorldT() - targetPositionWorldT; @@ -917,7 +904,7 @@ private void CompleteDrive() private void StartSettling() { - CommunicationManager.Instance.SetCanWrite(ProbeManager.ManipulatorBehaviorController.ManipulatorID, false, + CommunicationManager.Instance.SetCanWrite(_manipulatorId, false, 0, _ => { From 5376667e29734e786cf6aa7dc6423f90a9a9bb84 Mon Sep 17 00:00:00 2001 From: Kenneth Yang Date: Tue, 24 Oct 2023 14:46:36 -0700 Subject: [PATCH 36/78] Bump Ephys Link --- Assets/Scripts/EphysLink/CommunicationManager.cs | 2 +- .../UI/EphysCopilot/DrivePanelHandler.cs | 16 ++-------------- 2 files changed, 3 insertions(+), 15 deletions(-) diff --git a/Assets/Scripts/EphysLink/CommunicationManager.cs b/Assets/Scripts/EphysLink/CommunicationManager.cs index c0a1d0b0..1d450bf7 100644 --- a/Assets/Scripts/EphysLink/CommunicationManager.cs +++ b/Assets/Scripts/EphysLink/CommunicationManager.cs @@ -20,7 +20,7 @@ public class CommunicationManager : MonoBehaviour #region Properties - public static readonly int[] EPHYS_LINK_MIN_VERSION = { 0, 9, 15 }; + public static readonly int[] EPHYS_LINK_MIN_VERSION = { 0, 9, 16 }; public static readonly string EPHYS_LINK_MIN_VERSION_STRING = "≥ v" + string.Join(".", EPHYS_LINK_MIN_VERSION); diff --git a/Assets/Scripts/TrajectoryPlanner/UI/EphysCopilot/DrivePanelHandler.cs b/Assets/Scripts/TrajectoryPlanner/UI/EphysCopilot/DrivePanelHandler.cs index 894a36ce..ac0540c5 100644 --- a/Assets/Scripts/TrajectoryPlanner/UI/EphysCopilot/DrivePanelHandler.cs +++ b/Assets/Scripts/TrajectoryPlanner/UI/EphysCopilot/DrivePanelHandler.cs @@ -728,20 +728,8 @@ public void Stop() if (!b) return; _statusText.text = "Stopped"; - if (_driveState == DriveState.DrivingToTarget) - { - // Setup for returning to surface - _driveState = DriveState.AtTarget; - _stopButton.SetActive(false); - _exitButton.SetActive(true); - } - else - { - // Otherwise, just reset - _driveState = DriveState.Ready; - _stopButton.SetActive(false); - _driveGroup.SetActive(true); - } + // Reset UI based on state + }); } From 10a9b498f9a27a765e673dc52fbd70a747e874a7 Mon Sep 17 00:00:00 2001 From: Kenneth Yang Date: Tue, 24 Oct 2023 14:57:31 -0700 Subject: [PATCH 37/78] Bump Ephys Link to 0.9.17 --- Assets/Scripts/EphysLink/CommunicationManager.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Assets/Scripts/EphysLink/CommunicationManager.cs b/Assets/Scripts/EphysLink/CommunicationManager.cs index 1d450bf7..2a4611db 100644 --- a/Assets/Scripts/EphysLink/CommunicationManager.cs +++ b/Assets/Scripts/EphysLink/CommunicationManager.cs @@ -20,7 +20,7 @@ public class CommunicationManager : MonoBehaviour #region Properties - public static readonly int[] EPHYS_LINK_MIN_VERSION = { 0, 9, 16 }; + private static readonly int[] EPHYS_LINK_MIN_VERSION = { 0, 9, 17 }; public static readonly string EPHYS_LINK_MIN_VERSION_STRING = "≥ v" + string.Join(".", EPHYS_LINK_MIN_VERSION); From 692af1a06bc516130d4fa5f3e91d552bfc1cb977 Mon Sep 17 00:00:00 2001 From: Kenneth Yang Date: Tue, 24 Oct 2023 15:38:03 -0700 Subject: [PATCH 38/78] Removed old code --- .../UI/EphysCopilot/DrivePanelHandler.cs | 309 ------------------ 1 file changed, 309 deletions(-) diff --git a/Assets/Scripts/TrajectoryPlanner/UI/EphysCopilot/DrivePanelHandler.cs b/Assets/Scripts/TrajectoryPlanner/UI/EphysCopilot/DrivePanelHandler.cs index ac0540c5..778b70e5 100644 --- a/Assets/Scripts/TrajectoryPlanner/UI/EphysCopilot/DrivePanelHandler.cs +++ b/Assets/Scripts/TrajectoryPlanner/UI/EphysCopilot/DrivePanelHandler.cs @@ -13,10 +13,6 @@ public class DrivePanelHandler : MonoBehaviour private enum DriveState { - Ready, - DrivingToSurface, - DrivingToTarget, - Outside, ExitingToOutside, AtExitMargin, @@ -94,9 +90,6 @@ public void DriveIncrement() break; // Error cases: Cannot drive down from these states - case DriveState.Ready: - case DriveState.DrivingToSurface: - case DriveState.DrivingToTarget: case DriveState.Outside: case DriveState.ExitingToOutside: case DriveState.AtExitMargin: @@ -140,9 +133,6 @@ public void ExitIncrement() break; // Error cases: Cannot exit from these states - case DriveState.Ready: - case DriveState.DrivingToSurface: - case DriveState.DrivingToTarget: case DriveState.Outside: case DriveState.ExitingToMargin: case DriveState.ExitingToDura: @@ -182,9 +172,6 @@ public void CompleteMovement() break; // Error cases: cannot complete movement from non-transitional states - case DriveState.Ready: - case DriveState.DrivingToSurface: - case DriveState.DrivingToTarget: case DriveState.Outside: case DriveState.AtExitMargin: case DriveState.AtDura: @@ -262,9 +249,7 @@ private float _targetDriveDistance // Durations private float _targetDriveDuration; - private float _duraMarginDepth; private float _duraMarginDriveDuration => DURA_MARGIN_DISTANCE / _exitDriveBaseSpeed; - private float _exitDepth; private float _exitDriveDuration; @@ -366,7 +351,6 @@ public void OnDrivePastDistanceChanged(string value) _drivePastTargetDistance = 50; _drivePastDistanceInputField.SetTextWithoutNotify("50"); - ComputeAndSetDriveTime(_targetDriveSpeed); } public void Drive() @@ -444,9 +428,6 @@ public void Drive() }); }, Debug.LogError); break; - case DriveState.Ready: - case DriveState.DrivingToSurface: - case DriveState.DrivingToTarget: case DriveState.Outside: case DriveState.ExitingToOutside: case DriveState.AtExitMargin: @@ -477,62 +458,6 @@ void CompleteAndAdvance() } } - public void OldDrive() - { - ComputeAndSetDriveTime(_driveBaseSpeed, () => - { - CommunicationManager.Instance.SetCanWrite(_manipulatorId, - true, 1, canWrite => - { - if (!canWrite) return; - // Set drive status - _statusText.text = "Driving to " + _drivePastTargetDistance * 1000f + " µm past target..."; - - // Replace drive buttons with stop - _driveGroup.SetActive(false); - _stopButton.SetActive(true); - - // Set state - _driveState = DriveState.DrivingToTarget; - - // Start timer - StartCoroutine(CountDownTimer(_targetDriveDuration, _driveState)); - - // Drive - - // Compute initial drive depth (before getting to near target distance) - var driveDepth = _duraDepth; - if (_targetDepth - _duraDepth > NEAR_TARGET_DISTANCE) - driveDepth = _targetDepth - NEAR_TARGET_DISTANCE; - - // Drive until within near target distance - CommunicationManager.Instance.DriveToDepth( - _manipulatorId, - driveDepth, - _targetDriveSpeed, _ => - { - // Drive through past target distance - CommunicationManager.Instance.DriveToDepth( - _manipulatorId, - _targetDepth + _drivePastTargetDistance, - _targetDriveSpeed * NEAR_TARGET_SPEED_MULTIPLIER, - _ => - { - _statusText.text = "Driving back to target..."; - - // Drive back to target - CommunicationManager.Instance.DriveToDepth( - _manipulatorId, - _targetDepth, - _targetDriveSpeed * NEAR_TARGET_SPEED_MULTIPLIER, - _ => StartSettling(), Debug.LogError); - }, Debug.LogError); - }, - Debug.LogError); - }, Debug.LogError); - }); - } - public void Exit() { // Get current position @@ -614,9 +539,6 @@ public void Exit() // Already outside, so complete CompleteOutside(); break; - case DriveState.Ready: - case DriveState.DrivingToSurface: - case DriveState.DrivingToTarget: case DriveState.Outside: case DriveState.AtExitMargin: case DriveState.AtDura: @@ -657,70 +579,6 @@ void CompleteOutside() } } - public void DriveBackToSurface() - { - CommunicationManager.Instance.GetPos(_manipulatorId, pos => - { - // Drive - CommunicationManager.Instance.SetCanWrite(_manipulatorId, true, 1, - canWrite => - { - if (!canWrite) return; - // Set drive status and show stop button - _statusText.text = "Driving back to surface..."; - _exitButton.SetActive(false); - _stopButton.SetActive(true); - _driveState = DriveState.DrivingToSurface; - - // Start timer - StartCoroutine(CountDownTimer(_exitDriveDuration, _driveState)); - - // Drive - - // Compute drive back to dura (while still in near target distance) - var driveDepth = _duraDepth; - if (pos.w - _duraDepth > _targetDepth - NEAR_TARGET_DISTANCE - _duraDepth) - driveDepth = pos.w - NEAR_TARGET_DISTANCE; - - // Drive back to dura by near target distance (as much as possible) - CommunicationManager.Instance.DriveToDepth( - _manipulatorId, - driveDepth, _exitDriveBaseSpeed * NEAR_TARGET_SPEED_MULTIPLIER, _ => - { - // Drive back to dura - CommunicationManager.Instance.DriveToDepth( - _manipulatorId, _duraDepth, - _exitDriveBaseSpeed, _ => - { - // Drive out by dura exit margin - // FIXME: Dependent on CoordinateSpace direction. Should be standardized by Ephys Link. - CommunicationManager.Instance.DriveToDepth( - _manipulatorId, - _duraDepth - ProbeManager.ManipulatorBehaviorController.CoordinateSpace - .World2SpaceAxisChange(Vector3.up).z * DURA_MARGIN_DISTANCE, - _exitDriveBaseSpeed, _ => - { - // Drive the rest of the way to the surface - CommunicationManager.Instance.DriveToDepth( - _manipulatorId, - _exitDepth, _outsideDriveSpeed, _ => - { - // Reset manipulator drive states - CommunicationManager.Instance.SetCanWrite( - ProbeManager.ManipulatorBehaviorController - .ManipulatorID, - false, - 1, - null, - Debug.LogError); - }, Debug.LogError); - }, Debug.LogError); - }, Debug.LogError); - }, Debug.LogError); - }, Debug.LogError); - }, Debug.LogError); - } - public void Stop() { CommunicationManager.Instance.Stop(b => @@ -738,173 +596,6 @@ public void Stop() #region Helper Functions - private void ComputeAndSetDriveTime(float depthDriveBaseSpeed, Action callback = null) - { - // Update drive past distance and return to surface button text - _exitButtonText.text = "Return to Surface (" + SpeedToString(_exitDriveBaseSpeed) + ")"; - - // Compute drive distance and duration - CommunicationManager.Instance.GetPos(_manipulatorId, position => - { - // Remember dura depth - // _duraDepth = position.w; - - // Calibrate target insertion depth based on surface position - var targetInsertion = new ProbeInsertion( - InsertionSelectionPanelHandler.ManipulatorIDToSelectedTargetProbeManager[ - _manipulatorId].ProbeController.Insertion); - var targetPositionWorldT = targetInsertion.PositionWorldT(); - var relativePositionWorldT = - ProbeManager.ProbeController.Insertion.PositionWorldT() - targetPositionWorldT; - var probeTipTUp = ProbeManager.ProbeController.ProbeTipT.up; - var offsetAdjustedRelativeTargetPositionWorldT = - Vector3.ProjectOnPlane(relativePositionWorldT, probeTipTUp); - var offsetAdjustedTargetPositionWorldT = - targetPositionWorldT + offsetAdjustedRelativeTargetPositionWorldT; - - // Converting worldT back to APMLDV (position transformed) - targetInsertion.apmldv = - targetInsertion.CoordinateTransform.Space2TransformAxisChange( - targetInsertion.CoordinateSpace.World2Space(offsetAdjustedTargetPositionWorldT)); - - // Compute return exit position (500 dv above surface) - var exitInsertion = new ProbeInsertion(0, 0, 0.5f, 0, 0, 0, targetInsertion.CoordinateSpace, - targetInsertion.CoordinateTransform, false); - var exitPositionWorldT = exitInsertion.PositionWorldT(); - var exitPlane = new Plane(Vector3.down, exitPositionWorldT); - var direction = new Ray(ProbeManager.ProbeController.Insertion.PositionWorldT(), probeTipTUp); - var offsetAdjustedSurfacePositionWorldT = Vector3.zero; - - if (exitPlane.Raycast(direction, out var distanceToSurface)) - offsetAdjustedSurfacePositionWorldT = direction.GetPoint(distanceToSurface); - - // Converting worldT back to APMLDV (position transformed) - var offsetAdjustedSurfacePosition = - exitInsertion.CoordinateTransform.Space2TransformAxisChange( - exitInsertion.CoordinateSpace.World2Space(offsetAdjustedSurfacePositionWorldT)); - - // Compute drive distances - var targetDriveDistance = - Vector3.Distance(targetInsertion.apmldv, ProbeManager.ProbeController.Insertion.apmldv); - var exitDriveDistance = Vector3.Distance(offsetAdjustedSurfacePosition, - ProbeManager.ProbeController.Insertion.apmldv); - - // Set target and exit depths - // _targetDepth = _duraDepth + targetDriveDistance; - _exitDepth = _duraDepth - exitDriveDistance; - - // Warn if target depth is out of bounds - if (!_acknowledgeOutOfBounds && - (_targetDepth > ProbeManager.ManipulatorBehaviorController.Dimensions.z || _targetDepth < 0)) - { - QuestionDialogue.Instance.NewQuestion( - "Target depth is out of bounds. Are you sure you want to continue?"); - QuestionDialogue.Instance.YesCallback = () => _acknowledgeOutOfBounds = true; - } - - // Set drive speeds (base + x mm/s / 1 mm of depth) - // _targetDriveSpeed = _driveBaseSpeed + targetDriveDistance * _per1000Speed; - - /* - * Compute target drive duration - * 1. Drive down towards target until at near target distance at target drive speed - * 2. Drive past target by drive past distance at near target speed - * 3. Drive back to target at near target speed - * 4. Settle for 1 minute per 1 mm of target drive distance with a minimum of 2 minutes - */ - _targetDriveDuration = - Mathf.Max(0, targetDriveDistance - NEAR_TARGET_DISTANCE) / _targetDriveSpeed + - (Mathf.Min(NEAR_TARGET_DISTANCE, targetDriveDistance) + 2 * _drivePastTargetDistance) / - (_targetDriveSpeed * NEAR_TARGET_SPEED_MULTIPLIER) + - Mathf.Max(120, 60 * (targetDriveDistance + _drivePastTargetDistance)); - - /* - * Compute exit drive duration - * 1. Drive out by near target distance at near target speed - * 2. Drive out to dura at exit speed - * 3. Drive out by dura margin distance at exit speed - * 4. Drive out to surface at outside speed - */ - _exitDriveDuration = - Mathf.Max(0, NEAR_TARGET_DISTANCE - targetDriveDistance) / - (_exitDriveBaseSpeed * NEAR_TARGET_SPEED_MULTIPLIER) + - Mathf.Max(0, targetDriveDistance - NEAR_TARGET_DISTANCE) / _exitDriveBaseSpeed + - _duraMarginDriveDuration + - (exitDriveDistance - targetDriveDistance - DURA_MARGIN_DISTANCE) / - _outsideDriveSpeed; - - // Set timer text - _timerText.text = TimeSpan.FromSeconds(_targetDriveDuration).ToString(@"mm\:ss"); - - // Run callback (if any) - callback?.Invoke(); - }); - } - - private IEnumerator CountDownTimer(float seconds, DriveState driveState) - { - // Set timer text - _timerText.text = TimeSpan.FromSeconds(seconds).ToString(@"mm\:ss"); - - // Wait for 1 second - yield return new WaitForSeconds(1); - - switch (seconds) - { - // Check if timer is done - case > 0 when - _driveState == driveState: - StartCoroutine(CountDownTimer(seconds - 1, driveState)); - break; - case <= 0: - { - // Set status to complete - _timerText.text = ""; - if (_driveState == DriveState.DrivingToTarget) - { - // Completed driving to target (finished settling) - CompleteDrive(); - } - else - { - // Completed returning to surface - _statusText.text = "Ready to Drive"; - _stopButton.SetActive(false); - _driveGroup.SetActive(true); - _driveState = DriveState.Ready; - } - - break; - } - default: - _timerText.text = ""; - break; - } - } - - private void CompleteDrive() - { - _statusText.text = "Drive complete"; - _skipSettlingButton.SetActive(false); - _exitButton.SetActive(true); - _driveState = DriveState.AtTarget; - } - - private void StartSettling() - { - CommunicationManager.Instance.SetCanWrite(_manipulatorId, false, - 0, - _ => - { - // Set status text - _statusText.text = "Settling... Please wait..."; - - // Set buttons - _stopButton.SetActive(false); - _skipSettlingButton.SetActive(true); - }); - } - private static string SpeedToString(float speedMillimeters) { return Settings.DisplayUM ? speedMillimeters * 1000 + " µm/s" : speedMillimeters + " mm/s"; From 8f6201d1f156ec6bfba3bb08f5e81d8bedbcdebb Mon Sep 17 00:00:00 2001 From: Kenneth Yang Date: Tue, 24 Oct 2023 16:37:51 -0700 Subject: [PATCH 39/78] Increase insertion drive ceiling --- .../UI/EphysCopilot/InsertionSelectionPanelHandler.cs | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/Assets/Scripts/TrajectoryPlanner/UI/EphysCopilot/InsertionSelectionPanelHandler.cs b/Assets/Scripts/TrajectoryPlanner/UI/EphysCopilot/InsertionSelectionPanelHandler.cs index 92effef3..76fd232d 100644 --- a/Assets/Scripts/TrajectoryPlanner/UI/EphysCopilot/InsertionSelectionPanelHandler.cs +++ b/Assets/Scripts/TrajectoryPlanner/UI/EphysCopilot/InsertionSelectionPanelHandler.cs @@ -17,7 +17,7 @@ public class InsertionSelectionPanelHandler : MonoBehaviour private const float LINE_WIDTH = 0.1f; private const int NUM_SEGMENTS = 2; - private static readonly Vector3 PRE_DEPTH_DRIVE_BREGMA_OFFSET_W = new(0, 0.5f, 0); + private static readonly Vector3 PRE_DEPTH_DRIVE_DV_OFFSET = new(0, 3.5f, 0); private const string MOVE_TO_TARGET_INSERTION_STR = "Move to Target Insertion"; private const string STOP_MOVEMENT_STR = "Stop Movement"; @@ -304,8 +304,7 @@ private void ComputeMovementInsertions() // DV axis _movementAxesInsertions.dv = new ProbeInsertion(ProbeManager.ProbeController.Insertion) { - dv = ProbeManager.ProbeController.Insertion - .World2TransformedAxisChange(PRE_DEPTH_DRIVE_BREGMA_OFFSET_W).z + dv = ProbeManager.ProbeController.Insertion.World2TransformedAxisChange(PRE_DEPTH_DRIVE_DV_OFFSET).z }; // Recalculate AP and ML based on pre-depth-drive DV From cb8ffd110bc34cb9b53ee71942020346be751fec Mon Sep 17 00:00:00 2001 From: Kenneth Yang Date: Tue, 31 Oct 2023 14:10:29 -0700 Subject: [PATCH 40/78] Return to surface button from stop --- .../UI/EphysCopilot/DrivePanelHandler.cs | 34 ++++++++++++++++--- 1 file changed, 30 insertions(+), 4 deletions(-) diff --git a/Assets/Scripts/TrajectoryPlanner/UI/EphysCopilot/DrivePanelHandler.cs b/Assets/Scripts/TrajectoryPlanner/UI/EphysCopilot/DrivePanelHandler.cs index 778b70e5..c5de1eca 100644 --- a/Assets/Scripts/TrajectoryPlanner/UI/EphysCopilot/DrivePanelHandler.cs +++ b/Assets/Scripts/TrajectoryPlanner/UI/EphysCopilot/DrivePanelHandler.cs @@ -120,6 +120,7 @@ public void ExitIncrement() case DriveState.AtNearTarget: State = DriveState.ExitingToDura; break; + case DriveState.AtPastTarget: case DriveState.AtTarget: State = DriveState.ExitingToNearTarget; break; @@ -128,7 +129,8 @@ public void ExitIncrement() case DriveState.DrivingToNearTarget: State = DriveState.ExitingToDura; break; - case DriveState.DriveToPastTarget or DriveState.ReturningToTarget: + case DriveState.ReturningToTarget: + case DriveState.DriveToPastTarget: State = DriveState.ExitingToNearTarget; break; @@ -137,7 +139,7 @@ public void ExitIncrement() case DriveState.ExitingToMargin: case DriveState.ExitingToDura: case DriveState.ExitingToNearTarget: - case DriveState.AtPastTarget: + case DriveState.ExitingToOutside: default: Debug.LogError("Cannot exit from state: " + State); break; @@ -584,10 +586,34 @@ public void Stop() CommunicationManager.Instance.Stop(b => { if (!b) return; - _statusText.text = "Stopped"; // Reset UI based on state - + _stopButton.SetActive(false); + 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.ExitingToDura: + case DriveState.ExitingToNearTarget: + _driveGroup.SetActive(true); + _statusText.text = "Drive when outside"; + break; + default: + Debug.LogError("Unknown state for stopping: " + _driveStateManager.State); + break; + } }); } From 2160aba1938a5223d25c91d5c4d2556ef8bf1e4b Mon Sep 17 00:00:00 2001 From: Kenneth Yang Date: Tue, 31 Oct 2023 15:01:28 -0700 Subject: [PATCH 41/78] Exit with DV --- Assets/Scripts/Insertion/ProbeInsertion.cs | 2 +- .../Probes/ManipulatorBehaviorController.cs | 2 +- .../UI/EphysCopilot/DrivePanelHandler.cs | 39 +++++++++++++++---- .../InsertionSelectionPanelHandler.cs | 10 ++--- 4 files changed, 38 insertions(+), 15 deletions(-) diff --git a/Assets/Scripts/Insertion/ProbeInsertion.cs b/Assets/Scripts/Insertion/ProbeInsertion.cs index c43fdfed..19e2ceae 100644 --- a/Assets/Scripts/Insertion/ProbeInsertion.cs +++ b/Assets/Scripts/Insertion/ProbeInsertion.cs @@ -36,7 +36,7 @@ public class ProbeInsertion /// public Vector3 apmldv { - get => new Vector3(ap, ml, dv); + get => new(ap, ml, dv); set { ap = value.x; diff --git a/Assets/Scripts/TrajectoryPlanner/Probes/ManipulatorBehaviorController.cs b/Assets/Scripts/TrajectoryPlanner/Probes/ManipulatorBehaviorController.cs index 4512cf83..43de6046 100644 --- a/Assets/Scripts/TrajectoryPlanner/Probes/ManipulatorBehaviorController.cs +++ b/Assets/Scripts/TrajectoryPlanner/Probes/ManipulatorBehaviorController.cs @@ -281,7 +281,7 @@ public void UpdateSpaceAndTransform() }; } - public Vector4 ConvertInsertionToManipulatorPosition(Vector3 insertionAPMLDV) + public Vector4 ConvertInsertionAPMLDVToManipulatorPosition(Vector3 insertionAPMLDV) { // Convert apmldv to world coordinate var convertToWorld = _probeManager.ProbeController.Insertion.Transformed2WorldAxisChange(insertionAPMLDV); diff --git a/Assets/Scripts/TrajectoryPlanner/UI/EphysCopilot/DrivePanelHandler.cs b/Assets/Scripts/TrajectoryPlanner/UI/EphysCopilot/DrivePanelHandler.cs index c5de1eca..5dc42437 100644 --- a/Assets/Scripts/TrajectoryPlanner/UI/EphysCopilot/DrivePanelHandler.cs +++ b/Assets/Scripts/TrajectoryPlanner/UI/EphysCopilot/DrivePanelHandler.cs @@ -203,6 +203,13 @@ public void CompleteMovement() private DriveState _driveState; private readonly DriveStateManager _driveStateManager = new(); + // Null checked dura APMLDV (NaN if not on dura) + private Vector3 _duraAPMLDV => ResetDuraOffsetPanelHandler.ManipulatorIdToDuraApmldv.TryGetValue( + _manipulatorId, out var duraApmldv) + ? duraApmldv + : new Vector3(float.NaN, float.NaN, float.NaN); + + // Target drive distance (returns NaN if not on dura) private float _targetDriveDistance { @@ -211,7 +218,7 @@ private float _targetDriveDistance // Calibrate target insertion depth based on surface position var targetInsertion = new ProbeInsertion( InsertionSelectionPanelHandler.ManipulatorIDToSelectedTargetProbeManager[ - _manipulatorId].ProbeController.Insertion); + _manipulatorId].ProbeController.Insertion, false); var targetPositionWorldT = targetInsertion.PositionWorldT(); var relativePositionWorldT = ProbeManager.ProbeController.Insertion.PositionWorldT() - targetPositionWorldT; @@ -226,15 +233,26 @@ private float _targetDriveDistance targetInsertion.CoordinateTransform.Space2TransformAxisChange( targetInsertion.CoordinateSpace.World2Space(offsetAdjustedTargetPositionWorldT)); - return Vector3.Distance(targetInsertion.apmldv, - ResetDuraOffsetPanelHandler.ManipulatorIdToDuraApmldv.TryGetValue( - _manipulatorId, out var depth) - ? depth - : new Vector3(float.NaN, float.NaN, float.NaN)); + return Vector3.Distance(targetInsertion.apmldv, _duraAPMLDV); } } // Landmark depths + private Vector4 _outsidePosition + { + get + { + // Create outside position APMLDV + var targetAPMLDV = _duraAPMLDV; + targetAPMLDV.z = ProbeManager.ProbeController.Insertion + .World2TransformedAxisChange(InsertionSelectionPanelHandler.PRE_DEPTH_DRIVE_DV_OFFSET).z; + + // Convert to manipulator position + return ProbeManager.ManipulatorBehaviorController.ConvertInsertionAPMLDVToManipulatorPosition( + targetAPMLDV); + } + } + private float _outsideDepth => _duraDepth - OUTSIDE_DISTANCE; private float _exitMarginDepth => _duraDepth - DURA_MARGIN_DISTANCE; @@ -533,8 +551,13 @@ public void Exit() _exitButton.SetActive(false); _stopButton.SetActive(true); - // Drive to outside depth - if (position.w > _outsideDepth) + // Drive to outside position + if (position.y < _outsidePosition.y) + { + CommunicationManager.Instance.GotoPos(_manipulatorId, _outsidePosition, _outsideDriveSpeed, _=> CompleteOutside(), Debug.LogError); + } + // Drive to outside depth if DV movement is unavailable + else if (position.w > _outsideDepth) CommunicationManager.Instance.DriveToDepth(_manipulatorId, _outsideDepth, _outsideDriveSpeed, _ => CompleteOutside(), Debug.LogError); else diff --git a/Assets/Scripts/TrajectoryPlanner/UI/EphysCopilot/InsertionSelectionPanelHandler.cs b/Assets/Scripts/TrajectoryPlanner/UI/EphysCopilot/InsertionSelectionPanelHandler.cs index 76fd232d..2cf1931f 100644 --- a/Assets/Scripts/TrajectoryPlanner/UI/EphysCopilot/InsertionSelectionPanelHandler.cs +++ b/Assets/Scripts/TrajectoryPlanner/UI/EphysCopilot/InsertionSelectionPanelHandler.cs @@ -17,7 +17,7 @@ public class InsertionSelectionPanelHandler : MonoBehaviour private const float LINE_WIDTH = 0.1f; private const int NUM_SEGMENTS = 2; - private static readonly Vector3 PRE_DEPTH_DRIVE_DV_OFFSET = new(0, 3.5f, 0); + public static readonly Vector3 PRE_DEPTH_DRIVE_DV_OFFSET = new(0, 3.5f, 0); private const string MOVE_TO_TARGET_INSERTION_STR = "Move to Target Insertion"; private const string STOP_MOVEMENT_STR = "Stop Movement"; @@ -334,7 +334,7 @@ private void ComputeMovementInsertions() // Check if within bounds var manipulatorPosition = - ProbeManager.ManipulatorBehaviorController.ConvertInsertionToManipulatorPosition(_movementAxesInsertions + ProbeManager.ManipulatorBehaviorController.ConvertInsertionAPMLDVToManipulatorPosition(_movementAxesInsertions .ml.apmldv); if (!_acknowledgedOutOfBounds && (manipulatorPosition.x < 0 || manipulatorPosition.x > ProbeManager.ManipulatorBehaviorController.CoordinateSpace.Dimensions.x || @@ -372,13 +372,13 @@ private void MoveToTargetInsertion() // Setup and compute movement _isMoving = true; var apPosition = - ProbeManager.ManipulatorBehaviorController.ConvertInsertionToManipulatorPosition(_movementAxesInsertions + ProbeManager.ManipulatorBehaviorController.ConvertInsertionAPMLDVToManipulatorPosition(_movementAxesInsertions .ap.apmldv); var mlPosition = - ProbeManager.ManipulatorBehaviorController.ConvertInsertionToManipulatorPosition(_movementAxesInsertions + ProbeManager.ManipulatorBehaviorController.ConvertInsertionAPMLDVToManipulatorPosition(_movementAxesInsertions .ml.apmldv); var dvPosition = - ProbeManager.ManipulatorBehaviorController.ConvertInsertionToManipulatorPosition(_movementAxesInsertions + ProbeManager.ManipulatorBehaviorController.ConvertInsertionAPMLDVToManipulatorPosition(_movementAxesInsertions .dv.apmldv); // Move From e2cbba29681c116cd4ab8c757c8c6dd73b4b6b30 Mon Sep 17 00:00:00 2001 From: Kenneth Yang Date: Tue, 31 Oct 2023 15:22:16 -0700 Subject: [PATCH 42/78] Fixed coterminal function --- .../UI/EphysCopilot/InsertionSelectionPanelHandler.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Assets/Scripts/TrajectoryPlanner/UI/EphysCopilot/InsertionSelectionPanelHandler.cs b/Assets/Scripts/TrajectoryPlanner/UI/EphysCopilot/InsertionSelectionPanelHandler.cs index 2cf1931f..c29899e6 100644 --- a/Assets/Scripts/TrajectoryPlanner/UI/EphysCopilot/InsertionSelectionPanelHandler.cs +++ b/Assets/Scripts/TrajectoryPlanner/UI/EphysCopilot/InsertionSelectionPanelHandler.cs @@ -425,10 +425,10 @@ private void UpdateMoveButtonInteractable() .ManipulatorID); } - private bool IsCoterminal(Vector3 first, Vector3 second) + private static bool IsCoterminal(Vector3 first, Vector3 second) { - return (first.x - second.x) % 360 < 0.01f && (first.y - second.y) % 360 < 0.01f && - (first.z - second.z) % 360 < 0.01f; + return Mathf.Abs(first.x - second.x) % 360 < 0.01f && Mathf.Abs(first.y - second.y) % 360 < 0.01f && + Mathf.Abs(first.z - second.z) % 360 < 0.01f; } #endregion From 59bbf5add1f37315e91d5997138b85194249b82d Mon Sep 17 00:00:00 2001 From: Kenneth Yang Date: Tue, 31 Oct 2023 16:43:37 -0700 Subject: [PATCH 43/78] Added UI, created demo JSON --- .../SettingsMenu/Menus/EphysLinkMenu.prefab | 485 +++++++++++++++++- .../UI/EphysCopilot/CopilotDemoHandler.cs | 22 + .../EphysCopilot/CopilotDemoHandler.cs.meta | 11 + Assets/StreamingAssets/copilot_demo.json | 146 ++++++ Assets/StreamingAssets/copilot_demo.json.meta | 3 + 5 files changed, 642 insertions(+), 25 deletions(-) create mode 100644 Assets/Scripts/TrajectoryPlanner/UI/EphysCopilot/CopilotDemoHandler.cs create mode 100644 Assets/Scripts/TrajectoryPlanner/UI/EphysCopilot/CopilotDemoHandler.cs.meta create mode 100644 Assets/StreamingAssets/copilot_demo.json create mode 100644 Assets/StreamingAssets/copilot_demo.json.meta diff --git a/Assets/Prefabs/UI/SettingsMenu/Menus/EphysLinkMenu.prefab b/Assets/Prefabs/UI/SettingsMenu/Menus/EphysLinkMenu.prefab index 960157cd..24cfe853 100644 --- a/Assets/Prefabs/UI/SettingsMenu/Menus/EphysLinkMenu.prefab +++ b/Assets/Prefabs/UI/SettingsMenu/Menus/EphysLinkMenu.prefab @@ -462,6 +462,42 @@ MonoBehaviour: m_FlexibleWidth: -1 m_FlexibleHeight: 1000 m_LayoutPriority: 1 +--- !u!1 &1826329449438794058 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 4733268162864556575} + m_Layer: 5 + m_Name: Spacer + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &4733268162864556575 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1826329449438794058} + 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: [] + m_Father: {fileID: 3368363359402801633} + m_RootOrder: 2 + 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!1 &1905739261017864310 GameObject: m_ObjectHideFlags: 0 @@ -859,6 +895,82 @@ MonoBehaviour: m_OnValueChanged: m_PersistentCalls: m_Calls: [] +--- !u!1 &2463412627045294728 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 2943885646786418918} + - component: {fileID: 2307278747312407585} + - component: {fileID: 3258961051634933478} + m_Layer: 5 + m_Name: Checkmark + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &2943885646786418918 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2463412627045294728} + 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: [] + m_Father: {fileID: 1251162055235371913} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0.5, y: 0.5} + m_AnchorMax: {x: 0.5, y: 0.5} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 70, y: 70} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!222 &2307278747312407585 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2463412627045294728} + m_CullTransparentMesh: 1 +--- !u!114 &3258961051634933478 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2463412627045294728} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_RaycastTarget: 1 + m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} + m_Maskable: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_Sprite: {fileID: 10901, guid: 0000000000000000f000000000000000, type: 0} + m_Type: 0 + m_PreserveAspect: 0 + m_FillCenter: 1 + m_FillMethod: 4 + m_FillAmount: 1 + m_FillClockwise: 1 + m_FillOrigin: 0 + m_UseSpriteMesh: 0 + m_PixelsPerUnitMultiplier: 1 --- !u!1 &2820967185475947156 GameObject: m_ObjectHideFlags: 0 @@ -1015,6 +1127,93 @@ MonoBehaviour: m_FlexibleWidth: -1 m_FlexibleHeight: -1 m_LayoutPriority: 1 +--- !u!1 &3155637916616668545 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 3368363359402801633} + - component: {fileID: 2347810752957075786} + - component: {fileID: 6989381308020188390} + m_Layer: 5 + m_Name: CopilotGroup + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &3368363359402801633 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 3155637916616668545} + 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: 6454811602450069208} + - {fileID: 8862325249793869894} + - {fileID: 4733268162864556575} + m_Father: {fileID: 6362176155741130746} + m_RootOrder: 2 + 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 &2347810752957075786 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 3155637916616668545} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 306cc8c2b49d7114eaa3623786fc2126, type: 3} + m_Name: + m_EditorClassIdentifier: + m_IgnoreLayout: 0 + m_MinWidth: -1 + m_MinHeight: 70 + m_PreferredWidth: -1 + m_PreferredHeight: -1 + m_FlexibleWidth: -1 + m_FlexibleHeight: -1 + m_LayoutPriority: 1 +--- !u!114 &6989381308020188390 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 3155637916616668545} + 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: 0 + m_ChildForceExpandWidth: 1 + m_ChildForceExpandHeight: 1 + m_ChildControlWidth: 1 + m_ChildControlHeight: 1 + m_ChildScaleWidth: 0 + m_ChildScaleHeight: 0 + m_ReverseArrangement: 0 --- !u!1 &4106365493350396047 GameObject: m_ObjectHideFlags: 0 @@ -1356,7 +1555,7 @@ MonoBehaviour: m_HorizontalOverflow: 0 m_VerticalOverflow: 0 m_LineSpacing: 1 - m_Text: Enable Ephys Copilot + m_Text: Enable Copilot --- !u!1 &4514077568625554274 GameObject: m_ObjectHideFlags: 0 @@ -1492,6 +1691,86 @@ MonoBehaviour: m_hasFontAssetChanged: 0 m_baseMaterial: {fileID: 0} m_maskOffset: {x: 0, y: 0, z: 0, w: 0} +--- !u!1 &4885030235408315657 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 465684715438252110} + - component: {fileID: 1350648356087742117} + - component: {fileID: 3197261609905304939} + m_Layer: 5 + m_Name: Label + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &465684715438252110 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 4885030235408315657} + 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: [] + m_Father: {fileID: 8862325249793869894} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 1, y: 1} + m_AnchoredPosition: {x: 37.5, y: 0.5} + m_SizeDelta: {x: -85, y: -1.0000191} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!222 &1350648356087742117 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 4885030235408315657} + m_CullTransparentMesh: 1 +--- !u!114 &3197261609905304939 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 4885030235408315657} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 5f7201a12d95ffc409449d95f23cf332, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 0.19607843, g: 0.19607843, b: 0.19607843, a: 1} + m_RaycastTarget: 1 + m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} + m_Maskable: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_FontData: + m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0} + m_FontSize: 36 + m_FontStyle: 0 + m_BestFit: 0 + m_MinSize: 10 + m_MaxSize: 40 + m_Alignment: 3 + m_AlignByGeometry: 0 + m_RichText: 1 + m_HorizontalOverflow: 0 + m_VerticalOverflow: 0 + m_LineSpacing: 1 + m_Text: Enable Copilot Demo --- !u!1 &4937477631376377988 GameObject: m_ObjectHideFlags: 0 @@ -2198,7 +2477,7 @@ RectTransform: m_Children: - {fileID: 6362176154171941207} - {fileID: 2047283783586261496} - - {fileID: 6454811602450069208} + - {fileID: 3368363359402801633} - {fileID: 1243938684854324358} - {fileID: 2026155534260252091} - {fileID: 5668169073541834191} @@ -2432,7 +2711,6 @@ GameObject: m_Component: - component: {fileID: 6454811602450069208} - component: {fileID: 6762999849811435235} - - component: {fileID: 8801358471135299432} m_Layer: 5 m_Name: CopilotToggle m_TagString: Untagged @@ -2454,8 +2732,8 @@ RectTransform: m_Children: - {fileID: 2707765522829527282} - {fileID: 1529037423938537742} - m_Father: {fileID: 6362176155741130746} - m_RootOrder: 2 + m_Father: {fileID: 3368363359402801633} + m_RootOrder: 0 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 0} m_AnchorMax: {x: 0, y: 0} @@ -2523,26 +2801,6 @@ MonoBehaviour: m_BoolArgument: 0 m_CallState: 2 m_IsOn: 0 ---- !u!114 &8801358471135299432 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 6540046803930571924} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: 306cc8c2b49d7114eaa3623786fc2126, type: 3} - m_Name: - m_EditorClassIdentifier: - m_IgnoreLayout: 0 - m_MinWidth: -1 - m_MinHeight: 70 - m_PreferredWidth: -1 - m_PreferredHeight: -1 - m_FlexibleWidth: -1 - m_FlexibleHeight: -1 - m_LayoutPriority: 1 --- !u!1 &6634098708597508233 GameObject: m_ObjectHideFlags: 0 @@ -2619,6 +2877,183 @@ MonoBehaviour: m_FillOrigin: 0 m_UseSpriteMesh: 0 m_PixelsPerUnitMultiplier: 1 +--- !u!1 &6826895715115904834 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 8862325249793869894} + - component: {fileID: 282356076181514970} + m_Layer: 5 + m_Name: CopilotDemoToggle + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &8862325249793869894 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 6826895715115904834} + 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: 1251162055235371913} + - {fileID: 465684715438252110} + m_Father: {fileID: 3368363359402801633} + m_RootOrder: 1 + 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 &282356076181514970 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 6826895715115904834} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 9085046f02f69544eb97fd06b6048fe2, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Navigation: + m_Mode: 3 + m_WrapAround: 0 + m_SelectOnUp: {fileID: 0} + m_SelectOnDown: {fileID: 0} + m_SelectOnLeft: {fileID: 0} + m_SelectOnRight: {fileID: 0} + m_Transition: 1 + m_Colors: + m_NormalColor: {r: 1, g: 1, b: 1, a: 1} + m_HighlightedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1} + m_PressedColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 1} + m_SelectedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1} + m_DisabledColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 0.5019608} + m_ColorMultiplier: 1 + m_FadeDuration: 0.1 + m_SpriteState: + m_HighlightedSprite: {fileID: 0} + m_PressedSprite: {fileID: 0} + m_SelectedSprite: {fileID: 0} + m_DisabledSprite: {fileID: 0} + m_AnimationTriggers: + m_NormalTrigger: Normal + m_HighlightedTrigger: Highlighted + m_PressedTrigger: Pressed + m_SelectedTrigger: Selected + m_DisabledTrigger: Disabled + m_Interactable: 1 + m_TargetGraphic: {fileID: 1884488258719385616} + toggleTransition: 1 + graphic: {fileID: 3258961051634933478} + m_Group: {fileID: 0} + onValueChanged: + m_PersistentCalls: + m_Calls: + - m_Target: {fileID: 4412914667077470364} + m_TargetAssemblyTypeName: TrajectoryPlanner.UI.EphysLinkSettings.EphysLinkSettings, + trajectoryplanner.ui.ephyslinksettings + m_MethodName: ToggleCopilotPanel + m_Mode: 0 + m_Arguments: + m_ObjectArgument: {fileID: 0} + m_ObjectArgumentAssemblyTypeName: UnityEngine.Object, UnityEngine + m_IntArgument: 0 + m_FloatArgument: 0 + m_StringArgument: + m_BoolArgument: 0 + m_CallState: 2 + m_IsOn: 0 +--- !u!1 &7240603151880297605 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1251162055235371913} + - component: {fileID: 1788166065057526308} + - component: {fileID: 1884488258719385616} + m_Layer: 5 + m_Name: Background + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &1251162055235371913 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 7240603151880297605} + 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: 2943885646786418918} + m_Father: {fileID: 8862325249793869894} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 1} + m_AnchorMax: {x: 0, y: 1} + m_AnchoredPosition: {x: 35, y: -35} + m_SizeDelta: {x: 70, y: 70} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!222 &1788166065057526308 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 7240603151880297605} + m_CullTransparentMesh: 1 +--- !u!114 &1884488258719385616 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 7240603151880297605} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_RaycastTarget: 1 + m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} + m_Maskable: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_Sprite: {fileID: 10905, guid: 0000000000000000f000000000000000, type: 0} + m_Type: 1 + m_PreserveAspect: 0 + m_FillCenter: 1 + m_FillMethod: 4 + m_FillAmount: 1 + m_FillClockwise: 1 + m_FillOrigin: 0 + m_UseSpriteMesh: 0 + m_PixelsPerUnitMultiplier: 1 --- !u!1 &7614803770262254004 GameObject: m_ObjectHideFlags: 0 diff --git a/Assets/Scripts/TrajectoryPlanner/UI/EphysCopilot/CopilotDemoHandler.cs b/Assets/Scripts/TrajectoryPlanner/UI/EphysCopilot/CopilotDemoHandler.cs new file mode 100644 index 00000000..b1cd98c4 --- /dev/null +++ b/Assets/Scripts/TrajectoryPlanner/UI/EphysCopilot/CopilotDemoHandler.cs @@ -0,0 +1,22 @@ +using System; +using UnityEngine; + +namespace TrajectoryPlanner.UI.EphysCopilot +{ + [Serializable] + internal struct DemoData + { + public Vector3 angle; + public Vector3 idle; + public Vector4 insertion; + } + public class CopilotDemoHandler : MonoBehaviour + { + #region Components + + [SerializeField] private GameObject _startButton; + [SerializeField] private GameObject _stopButton; + + #endregion + } +} diff --git a/Assets/Scripts/TrajectoryPlanner/UI/EphysCopilot/CopilotDemoHandler.cs.meta b/Assets/Scripts/TrajectoryPlanner/UI/EphysCopilot/CopilotDemoHandler.cs.meta new file mode 100644 index 00000000..dae3ebf7 --- /dev/null +++ b/Assets/Scripts/TrajectoryPlanner/UI/EphysCopilot/CopilotDemoHandler.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 78f91eb601d18cf4ca076cc899036bd8 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/StreamingAssets/copilot_demo.json b/Assets/StreamingAssets/copilot_demo.json new file mode 100644 index 00000000..ce7b26d8 --- /dev/null +++ b/Assets/StreamingAssets/copilot_demo.json @@ -0,0 +1,146 @@ +[ + { + "angle": [ + 180, + 35, + 0 + ], + "idle": [ + 8693, + 0, + 5670 + ], + "insertion": [ + 3903, + -1000, + -1041, + 3612 + ] + }, + { + "angle": [ + 225, + 35, + 0 + ], + "idle": [ + 7513, + 7513, + 6152 + ], + "insertion": [ + 2346, + 2346, + -1281, + 3318 + ] + }, + { + "angle": [ + -90, + 35, + 0 + ], + "idle": [ + 0, + 9659, + 7411 + ], + "insertion": [ + -1000, + 2487, + -447, + 4336 + ] + }, + { + "angle": [ + -45, + 35, + 0 + ], + "idle": [ + -8879, + 8879, + 7635 + ], + "insertion": [ + -4174, + 2174, + -607, + 5361 + ] + }, + { + "angle": [ + 0, + 35, + 0 + ], + "idle": [ + -12557, + 1000, + 5635 + ], + "insertion": [ + -6400, + 0, + -999, + 3441 + ] + }, + { + "angle": [ + 45, + 35, + 0 + ], + "idle": [ + -7513, + -7513, + 9152 + ], + "insertion": [ + -4183, + -2183, + -610, + 2916 + ] + }, + { + "angle": [ + 90, + 35, + 0 + ], + "idle": [ + 0, + -8693, + 7670 + ], + "insertion": [ + -1000, + 3274, + -810, + 2852 + ] + }, + { + "angle": [ + 135, + 35, + 0 + ], + "idle": [ + 8196, + -8196, + 6894 + ], + "insertion": [ + 1785, + -2785, + -1393, + 3402 + ] + } +] \ No newline at end of file diff --git a/Assets/StreamingAssets/copilot_demo.json.meta b/Assets/StreamingAssets/copilot_demo.json.meta new file mode 100644 index 00000000..e3d1265d --- /dev/null +++ b/Assets/StreamingAssets/copilot_demo.json.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: eff6ce365d974facae5d76d9ca0105cc +timeCreated: 1698795418 \ No newline at end of file From ac2cde92b848f6a02dfb5938a6139451b810e07a Mon Sep 17 00:00:00 2001 From: Kenneth Yang Date: Tue, 31 Oct 2023 17:02:46 -0700 Subject: [PATCH 44/78] Unable to read file from streaming assets, find alternative --- .../UI/EphysCopilot/CopilotDemoHandler.cs | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/Assets/Scripts/TrajectoryPlanner/UI/EphysCopilot/CopilotDemoHandler.cs b/Assets/Scripts/TrajectoryPlanner/UI/EphysCopilot/CopilotDemoHandler.cs index b1cd98c4..6cea9136 100644 --- a/Assets/Scripts/TrajectoryPlanner/UI/EphysCopilot/CopilotDemoHandler.cs +++ b/Assets/Scripts/TrajectoryPlanner/UI/EphysCopilot/CopilotDemoHandler.cs @@ -1,4 +1,5 @@ using System; +using System.IO; using UnityEngine; namespace TrajectoryPlanner.UI.EphysCopilot @@ -18,5 +19,14 @@ public class CopilotDemoHandler : MonoBehaviour [SerializeField] private GameObject _stopButton; #endregion + + private void Start() + { + print(Application.streamingAssetsPath + "/copilot_demo.json"); + print(File.ReadAllText(Application.streamingAssetsPath + "/copilot_demo.json")); + // var data = JsonUtility.FromJson(Resources + // .Load(Application.streamingAssetsPath + "/copilot_demo.json").text); + // print(data); + } } } From 0bf869a4005f1612118da3dbd2b8385f7ed9a923 Mon Sep 17 00:00:00 2001 From: Kenneth Yang Date: Tue, 31 Oct 2023 17:03:00 -0700 Subject: [PATCH 45/78] WIP reading from file --- Assets/Scenes/TrajectoryPlanner.unity | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/Assets/Scenes/TrajectoryPlanner.unity b/Assets/Scenes/TrajectoryPlanner.unity index 749989ce..26b70c2f 100644 --- a/Assets/Scenes/TrajectoryPlanner.unity +++ b/Assets/Scenes/TrajectoryPlanner.unity @@ -581,6 +581,11 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: 674c3dd0800387342aa2d83aa5da1843, type: 3} m_Name: m_EditorClassIdentifier: +--- !u!1 &728289668 stripped +GameObject: + m_CorrespondingSourceObject: {fileID: 7852855776637929136, guid: 3d86af372ed9f2e41b42b525846d962f, type: 3} + m_PrefabInstance: {fileID: 46940034} + m_PrefabAsset: {fileID: 0} --- !u!1 &745816212 GameObject: m_ObjectHideFlags: 0 @@ -1862,12 +1867,26 @@ MonoBehaviour: m_CorrespondingSourceObject: {fileID: 6854367561162462583, guid: 3d86af372ed9f2e41b42b525846d962f, type: 3} m_PrefabInstance: {fileID: 46940034} m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 0} + m_GameObject: {fileID: 728289668} m_Enabled: 1 m_EditorHideFlags: 0 m_Script: {fileID: 11500000, guid: 1d1472904c7237a449b283ca843dc7a2, type: 3} m_Name: m_EditorClassIdentifier: +--- !u!114 &1572420111 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 728289668} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 78f91eb601d18cf4ca076cc899036bd8, type: 3} + m_Name: + m_EditorClassIdentifier: + _startButton: {fileID: 0} + _stopButton: {fileID: 0} --- !u!114 &1593103045 stripped MonoBehaviour: m_CorrespondingSourceObject: {fileID: 2443417254122746566, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} From acaebc09c69b5033f321d26f8be348efd5c8a01d Mon Sep 17 00:00:00 2001 From: Kenneth Yang Date: Thu, 2 Nov 2023 14:45:58 -0700 Subject: [PATCH 46/78] Rig and brain scaling --- .../UI/SettingsMenu/Menus/AtlasMenu.prefab | 7 +- Assets/Scenes/TrajectoryPlanner.unity | 402 +++++++++++++++++- 2 files changed, 404 insertions(+), 5 deletions(-) diff --git a/Assets/Prefabs/UI/SettingsMenu/Menus/AtlasMenu.prefab b/Assets/Prefabs/UI/SettingsMenu/Menus/AtlasMenu.prefab index 330a1d3c..0c084882 100644 --- a/Assets/Prefabs/UI/SettingsMenu/Menus/AtlasMenu.prefab +++ b/Assets/Prefabs/UI/SettingsMenu/Menus/AtlasMenu.prefab @@ -1226,7 +1226,6 @@ MonoBehaviour: _apField: {fileID: 7501057391960236679} _mlField: {fileID: 8396062300239328662} _dvField: {fileID: 6782200178353439303} - _tpmanager: {fileID: 0} --- !u!1 &2884005272208550139 GameObject: m_ObjectHideFlags: 0 @@ -8203,7 +8202,7 @@ PrefabInstance: objectReference: {fileID: 0} - target: {fileID: 3083274347254332316, guid: ccb05abfadf2adb40913f92c0327f4fc, type: 3} propertyPath: m_Text - value: 4.15 + value: 6.3 objectReference: {fileID: 0} - target: {fileID: 3083274347384374709, guid: ccb05abfadf2adb40913f92c0327f4fc, type: 3} propertyPath: m_AnchorMax.x @@ -8303,11 +8302,11 @@ PrefabInstance: objectReference: {fileID: 0} - target: {fileID: 3083274347408712454, guid: ccb05abfadf2adb40913f92c0327f4fc, type: 3} propertyPath: m_Value - value: 4.15 + value: 6.3 objectReference: {fileID: 0} - target: {fileID: 3083274347408712454, guid: ccb05abfadf2adb40913f92c0327f4fc, type: 3} propertyPath: m_MaxValue - value: 5 + value: 6.3 objectReference: {fileID: 0} - target: {fileID: 3083274347408712454, guid: ccb05abfadf2adb40913f92c0327f4fc, type: 3} propertyPath: m_MinValue diff --git a/Assets/Scenes/TrajectoryPlanner.unity b/Assets/Scenes/TrajectoryPlanner.unity index 26b70c2f..59b485b3 100644 --- a/Assets/Scenes/TrajectoryPlanner.unity +++ b/Assets/Scenes/TrajectoryPlanner.unity @@ -2288,6 +2288,14 @@ PrefabInstance: propertyPath: cameraController value: objectReference: {fileID: 1445581475} + - target: {fileID: 341190943612973627, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} + propertyPath: m_AnchorMax.x + value: 0.37492186 + objectReference: {fileID: 0} + - target: {fileID: 341190943612973627, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} + propertyPath: m_AnchorMax.y + value: 1 + objectReference: {fileID: 0} - target: {fileID: 341190943640395761, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} propertyPath: onValueChanged.m_PersistentCalls.m_Calls.Array.data[0].m_Target value: @@ -2324,6 +2332,30 @@ PrefabInstance: propertyPath: m_AnchoredPosition.x value: 0 objectReference: {fileID: 0} + - target: {fileID: 341190943678743979, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} + propertyPath: m_AnchorMax.y + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 341190943678743979, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} + propertyPath: m_AnchorMin.y + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 341190943678743979, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} + propertyPath: m_AnchoredPosition.x + value: 333.15 + objectReference: {fileID: 0} + - target: {fileID: 341190943678743979, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} + propertyPath: m_AnchoredPosition.y + value: -23.55 + objectReference: {fileID: 0} + - target: {fileID: 341190943691732233, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} + propertyPath: m_AnchorMax.x + value: 0.32352942 + objectReference: {fileID: 0} + - target: {fileID: 341190943691732233, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} + propertyPath: m_AnchorMax.y + value: 1 + objectReference: {fileID: 0} - target: {fileID: 341190943753887484, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} propertyPath: onValueChanged.m_PersistentCalls.m_Calls.Array.data[0].m_Target value: @@ -2348,6 +2380,26 @@ PrefabInstance: propertyPath: m_AnchoredPosition.y value: 0 objectReference: {fileID: 0} + - target: {fileID: 341190943796979255, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} + propertyPath: m_AnchorMax.y + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 341190943796979255, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} + propertyPath: m_AnchorMin.y + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 341190943796979255, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} + propertyPath: m_SizeDelta.x + value: 411.3 + objectReference: {fileID: 0} + - target: {fileID: 341190943796979255, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} + propertyPath: m_AnchoredPosition.x + value: 205.65 + objectReference: {fileID: 0} + - target: {fileID: 341190943796979255, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} + propertyPath: m_AnchoredPosition.y + value: -90.90201 + objectReference: {fileID: 0} - target: {fileID: 341190943819448291, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} propertyPath: onValueChanged.m_PersistentCalls.m_Calls.Array.data[0].m_Target value: @@ -2420,6 +2472,22 @@ PrefabInstance: propertyPath: m_AnchoredPosition.y value: 0 objectReference: {fileID: 0} + - target: {fileID: 341190943877956477, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} + propertyPath: m_AnchorMax.y + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 341190943877956477, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} + propertyPath: m_AnchorMin.y + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 341190943877956477, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} + propertyPath: m_AnchoredPosition.y + value: -15 + objectReference: {fileID: 0} + - target: {fileID: 341190943877956478, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} + propertyPath: m_Value + value: 3 + objectReference: {fileID: 0} - target: {fileID: 341190943896879072, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} propertyPath: m_AnchorMax.y value: 1 @@ -2452,6 +2520,34 @@ PrefabInstance: propertyPath: onValueChanged.m_PersistentCalls.m_Calls.Array.data[0].m_TargetAssemblyTypeName value: UIManager, trajectoryplanner.ui objectReference: {fileID: 0} + - target: {fileID: 341190943994242963, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} + propertyPath: m_AnchorMax.x + value: 0.37492186 + objectReference: {fileID: 0} + - target: {fileID: 341190943994242963, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} + propertyPath: m_AnchorMax.y + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 341190943994242963, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} + propertyPath: m_AnchorMin.x + value: 0.37492186 + objectReference: {fileID: 0} + - target: {fileID: 341190943997476560, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} + propertyPath: m_AnchorMax.y + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 341190943997476560, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} + propertyPath: m_AnchorMin.y + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 341190943997476560, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} + propertyPath: m_AnchoredPosition.y + value: -23.55 + objectReference: {fileID: 0} + - target: {fileID: 341190943997476561, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} + propertyPath: m_Value + value: -3.5 + objectReference: {fileID: 0} - target: {fileID: 341190944004995884, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} propertyPath: brainCameraController value: @@ -2472,6 +2568,14 @@ PrefabInstance: propertyPath: m_AnchoredPosition.y value: -15 objectReference: {fileID: 0} + - target: {fileID: 341190944071593138, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} + propertyPath: m_AnchorMax.x + value: 0.7631579 + objectReference: {fileID: 0} + - target: {fileID: 341190944071593138, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} + propertyPath: m_AnchorMax.y + value: 1 + objectReference: {fileID: 0} - target: {fileID: 341190944083206642, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} propertyPath: m_Name value: MainCanvas @@ -2580,6 +2684,22 @@ PrefabInstance: propertyPath: onValueChanged.m_PersistentCalls.m_Calls.Array.data[0].m_Target value: objectReference: {fileID: 1703646459} + - target: {fileID: 341190944172622829, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} + propertyPath: m_AnchorMax.y + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 341190944172622829, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} + propertyPath: m_AnchorMin.y + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 341190944172622829, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} + propertyPath: m_AnchoredPosition.x + value: 333.15 + objectReference: {fileID: 0} + - target: {fileID: 341190944172622829, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} + propertyPath: m_AnchoredPosition.y + value: -25 + objectReference: {fileID: 0} - target: {fileID: 341190944221791551, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} propertyPath: m_AnchorMax.y value: 0 @@ -2612,6 +2732,22 @@ PrefabInstance: propertyPath: m_AnchoredPosition.y value: -80.20117 objectReference: {fileID: 0} + - target: {fileID: 341190944261106099, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} + propertyPath: m_AnchorMax.y + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 341190944261106099, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} + propertyPath: m_AnchorMin.y + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 341190944261106099, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} + propertyPath: m_SizeDelta.x + value: 411.3 + objectReference: {fileID: 0} + - target: {fileID: 341190944261106099, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} + propertyPath: m_AnchoredPosition.y + value: -138.75801 + objectReference: {fileID: 0} - target: {fileID: 341190944298537966, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} propertyPath: m_AnchorMax.y value: 0 @@ -2724,6 +2860,22 @@ PrefabInstance: propertyPath: m_AnchoredPosition.y value: 0 objectReference: {fileID: 0} + - target: {fileID: 341190944449543596, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} + propertyPath: m_AnchorMax.y + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 341190944449543596, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} + propertyPath: m_AnchorMin.y + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 341190944449543596, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} + propertyPath: m_SizeDelta.x + value: 411.3 + objectReference: {fileID: 0} + - target: {fileID: 341190944449543596, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} + propertyPath: m_AnchoredPosition.y + value: -186.61401 + objectReference: {fileID: 0} - target: {fileID: 341190944480746761, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} propertyPath: m_AnchorMax.y value: 1 @@ -2872,6 +3024,18 @@ PrefabInstance: propertyPath: m_AnchoredPosition.y value: 0 objectReference: {fileID: 0} + - target: {fileID: 341190944717202799, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} + propertyPath: m_AnchorMax.x + value: 0.32352942 + objectReference: {fileID: 0} + - target: {fileID: 341190944717202799, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} + propertyPath: m_AnchorMax.y + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 341190944717202799, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} + propertyPath: m_AnchorMin.x + value: 0.32352942 + objectReference: {fileID: 0} - target: {fileID: 341190944799665630, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} propertyPath: m_AnchorMax.y value: 1 @@ -2944,6 +3108,22 @@ PrefabInstance: propertyPath: m_AnchoredPosition.y value: -42.5 objectReference: {fileID: 0} + - target: {fileID: 341190944908400157, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} + propertyPath: m_AnchorMax.y + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 341190944908400157, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} + propertyPath: m_AnchorMin.y + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 341190944908400157, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} + propertyPath: m_AnchoredPosition.y + value: -15 + objectReference: {fileID: 0} + - target: {fileID: 341190944908400158, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} + propertyPath: m_Value + value: 3 + objectReference: {fileID: 0} - target: {fileID: 341190944924531704, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} propertyPath: m_Enabled value: 0 @@ -3168,6 +3348,26 @@ PrefabInstance: propertyPath: cameraController value: objectReference: {fileID: 1445581475} + - target: {fileID: 341190945325589191, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} + propertyPath: m_AnchorMax.y + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 341190945325589191, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} + propertyPath: m_AnchorMin.y + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 341190945325589191, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} + propertyPath: m_SizeDelta.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 341190945325589191, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} + propertyPath: m_AnchoredPosition.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 341190945325589191, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} + propertyPath: m_AnchoredPosition.y + value: -19.48 + objectReference: {fileID: 0} - target: {fileID: 341190945333939074, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} propertyPath: onValueChanged.m_PersistentCalls.m_Calls.Array.data[0].m_Target value: @@ -3220,6 +3420,18 @@ PrefabInstance: propertyPath: m_Sprite value: objectReference: {fileID: 10905, guid: 0000000000000000f000000000000000, type: 0} + - target: {fileID: 341190945422144250, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} + propertyPath: m_AnchorMax.x + value: 0.7631579 + objectReference: {fileID: 0} + - target: {fileID: 341190945422144250, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} + propertyPath: m_AnchorMax.y + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 341190945422144250, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} + propertyPath: m_AnchorMin.x + value: 0.7631579 + objectReference: {fileID: 0} - target: {fileID: 341190945424324216, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} propertyPath: onValueChanged.m_PersistentCalls.m_Calls.Array.data[0].m_Target value: @@ -3264,10 +3476,34 @@ PrefabInstance: propertyPath: m_AnchoredPosition.y value: -108.814995 objectReference: {fileID: 0} + - target: {fileID: 341190945559892363, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} + propertyPath: m_IsActive + value: 0 + objectReference: {fileID: 0} - target: {fileID: 341190945559892368, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} propertyPath: _craniotomySkull value: objectReference: {fileID: 1826524689} + - target: {fileID: 341190945559892372, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} + propertyPath: m_AnchorMax.y + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 341190945559892372, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} + propertyPath: m_AnchorMin.y + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 341190945559892372, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} + propertyPath: m_SizeDelta.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 341190945559892372, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} + propertyPath: m_AnchoredPosition.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 341190945559892372, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} + propertyPath: m_AnchoredPosition.y + value: 0 + objectReference: {fileID: 0} - target: {fileID: 341190945640548129, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} propertyPath: onValueChanged.m_PersistentCalls.m_Calls.Array.data[0].m_Target value: @@ -3280,6 +3516,22 @@ PrefabInstance: propertyPath: onValueChanged.m_PersistentCalls.m_Calls.Array.data[0].m_TargetAssemblyTypeName value: Settings, trajectoryplanner.core.utilities objectReference: {fileID: 0} + - target: {fileID: 341190945661919518, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} + propertyPath: m_AnchorMax.y + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 341190945661919518, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} + propertyPath: m_AnchorMin.y + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 341190945661919518, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} + propertyPath: m_AnchoredPosition.x + value: 333.15 + objectReference: {fileID: 0} + - target: {fileID: 341190945661919518, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} + propertyPath: m_AnchoredPosition.y + value: -25 + objectReference: {fileID: 0} - target: {fileID: 440767525426848379, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} propertyPath: m_AnchorMax.y value: 1 @@ -3328,6 +3580,22 @@ PrefabInstance: propertyPath: m_AnchoredPosition.x value: -55.600006 objectReference: {fileID: 0} + - target: {fileID: 568637148373482672, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} + propertyPath: m_AnchorMax.y + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 568637148373482672, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} + propertyPath: m_AnchorMin.y + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 568637148373482672, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} + propertyPath: m_AnchoredPosition.x + value: 34.65 + objectReference: {fileID: 0} + - target: {fileID: 568637148373482672, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} + propertyPath: m_AnchoredPosition.y + value: -13.15 + objectReference: {fileID: 0} - target: {fileID: 662835937906372099, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} propertyPath: m_AnchorMax.y value: 0 @@ -3360,6 +3628,22 @@ PrefabInstance: propertyPath: m_SizeDelta.x value: 0 objectReference: {fileID: 0} + - target: {fileID: 816776614456266176, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} + propertyPath: m_AnchorMax.y + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 816776614456266176, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} + propertyPath: m_AnchorMin.y + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 816776614456266176, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} + propertyPath: m_AnchoredPosition.x + value: 311.85 + objectReference: {fileID: 0} + - target: {fileID: 816776614456266176, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} + propertyPath: m_AnchoredPosition.y + value: -13.15 + objectReference: {fileID: 0} - target: {fileID: 831438952939078622, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} propertyPath: m_AnchorMax.y value: 0 @@ -4160,6 +4444,22 @@ PrefabInstance: propertyPath: m_text value: Please select path to HelloSGLX.exe objectReference: {fileID: 0} + - target: {fileID: 3162619661544978193, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} + propertyPath: m_AnchorMax.y + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 3162619661544978193, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} + propertyPath: m_AnchorMin.y + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 3162619661544978193, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} + propertyPath: m_AnchoredPosition.x + value: 173.25 + objectReference: {fileID: 0} + - target: {fileID: 3162619661544978193, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} + propertyPath: m_AnchoredPosition.y + value: -13.15 + objectReference: {fileID: 0} - target: {fileID: 3168666580928764846, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} propertyPath: m_OnClick.m_PersistentCalls.m_Calls.Array.data[0].m_Target value: @@ -5552,6 +5852,22 @@ PrefabInstance: propertyPath: m_AnchoredPosition.x value: -58.299988 objectReference: {fileID: 0} + - target: {fileID: 5792341622686053858, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} + propertyPath: m_AnchorMax.y + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 5792341622686053858, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} + propertyPath: m_AnchorMin.y + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 5792341622686053858, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} + propertyPath: m_AnchoredPosition.x + value: 242.55002 + objectReference: {fileID: 0} + - target: {fileID: 5792341622686053858, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} + propertyPath: m_AnchoredPosition.y + value: -13.15 + objectReference: {fileID: 0} - target: {fileID: 5802217744712247084, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} propertyPath: m_AnchorMax.y value: 0 @@ -5564,6 +5880,22 @@ PrefabInstance: propertyPath: m_AnchoredPosition.x value: 391.77 objectReference: {fileID: 0} + - target: {fileID: 5844811128190724770, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} + propertyPath: m_AnchorMax.y + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 5844811128190724770, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} + propertyPath: m_AnchorMin.y + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 5844811128190724770, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} + propertyPath: m_AnchoredPosition.x + value: 103.950005 + objectReference: {fileID: 0} + - target: {fileID: 5844811128190724770, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} + propertyPath: m_AnchoredPosition.y + value: -13.15 + objectReference: {fileID: 0} - target: {fileID: 5902561801272478782, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} propertyPath: m_AnchoredPosition.x value: 70.93555 @@ -6280,6 +6612,26 @@ PrefabInstance: propertyPath: m_AnchoredPosition.x value: 311.77 objectReference: {fileID: 0} + - target: {fileID: 8014893230272162812, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} + propertyPath: m_AnchorMax.y + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 8014893230272162812, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} + propertyPath: m_AnchorMin.y + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 8014893230272162812, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} + propertyPath: m_SizeDelta.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 8014893230272162812, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} + propertyPath: m_AnchoredPosition.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 8014893230272162812, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} + propertyPath: m_AnchoredPosition.y + value: -53.156002 + objectReference: {fileID: 0} - target: {fileID: 8017547552066817441, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} propertyPath: _lockBehavior value: @@ -6400,6 +6752,22 @@ PrefabInstance: propertyPath: m_SizeDelta.y value: -815.1095 objectReference: {fileID: 0} + - target: {fileID: 8249628473690748754, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} + propertyPath: m_AnchorMax.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 8249628473690748754, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} + propertyPath: m_AnchorMin.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 8249628473690748754, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} + propertyPath: m_AnchoredPosition.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 8249628473690748754, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} + propertyPath: m_AnchoredPosition.y + value: 0 + objectReference: {fileID: 0} - target: {fileID: 8278374878278529525, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} propertyPath: m_Name value: LogUI @@ -6933,9 +7301,37 @@ PrefabInstance: m_Modification: m_TransformParent: {fileID: 0} m_Modifications: + - target: {fileID: 1302158967507098526, guid: 734f6254569c01842b9d2e2ff1b1d7ae, type: 3} + propertyPath: m_LocalScale.x + value: 1.5 + objectReference: {fileID: 0} + - target: {fileID: 1302158967507098526, guid: 734f6254569c01842b9d2e2ff1b1d7ae, type: 3} + propertyPath: m_LocalScale.y + value: 1.5 + objectReference: {fileID: 0} + - target: {fileID: 1302158967507098526, guid: 734f6254569c01842b9d2e2ff1b1d7ae, type: 3} + propertyPath: m_LocalScale.z + value: 1.5 + objectReference: {fileID: 0} + - target: {fileID: 1302158967507098526, guid: 734f6254569c01842b9d2e2ff1b1d7ae, type: 3} + propertyPath: m_LocalPosition.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1302158967507098526, guid: 734f6254569c01842b9d2e2ff1b1d7ae, type: 3} + propertyPath: m_LocalPosition.y + value: -2.12 + objectReference: {fileID: 0} + - target: {fileID: 1302158967507098526, guid: 734f6254569c01842b9d2e2ff1b1d7ae, type: 3} + propertyPath: m_LocalPosition.z + value: 0.86 + objectReference: {fileID: 0} + - target: {fileID: 1302158967507098526, guid: 734f6254569c01842b9d2e2ff1b1d7ae, type: 3} + propertyPath: m_ConstrainProportionsScale + value: 1 + objectReference: {fileID: 0} - target: {fileID: 1302158967507098527, guid: 734f6254569c01842b9d2e2ff1b1d7ae, type: 3} propertyPath: m_IsActive - value: 0 + value: 1 objectReference: {fileID: 0} - target: {fileID: 1302158967915866754, guid: 734f6254569c01842b9d2e2ff1b1d7ae, type: 3} propertyPath: util @@ -7113,6 +7509,10 @@ PrefabInstance: propertyPath: m_Name value: BrainParts objectReference: {fileID: 0} + - target: {fileID: 1302158968772066709, guid: 734f6254569c01842b9d2e2ff1b1d7ae, type: 3} + propertyPath: m_IsActive + value: 0 + objectReference: {fileID: 0} - target: {fileID: 1302158968859411074, guid: 734f6254569c01842b9d2e2ff1b1d7ae, type: 3} propertyPath: m_Enabled value: 0 From e6078cfe3be087723baf07452afa877a8bc722f6 Mon Sep 17 00:00:00 2001 From: Kenneth Yang Date: Thu, 2 Nov 2023 15:02:01 -0700 Subject: [PATCH 47/78] Set probe to line --- Assets/Scenes/TrajectoryPlanner.unity | 2 +- Assets/Scripts/TrajectoryPlanner/Probes/ProbeManager.cs | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/Assets/Scenes/TrajectoryPlanner.unity b/Assets/Scenes/TrajectoryPlanner.unity index 59b485b3..de3ed8b5 100644 --- a/Assets/Scenes/TrajectoryPlanner.unity +++ b/Assets/Scenes/TrajectoryPlanner.unity @@ -7331,7 +7331,7 @@ PrefabInstance: objectReference: {fileID: 0} - target: {fileID: 1302158967507098527, guid: 734f6254569c01842b9d2e2ff1b1d7ae, type: 3} propertyPath: m_IsActive - value: 1 + value: 0 objectReference: {fileID: 0} - target: {fileID: 1302158967915866754, guid: 734f6254569c01842b9d2e2ff1b1d7ae, type: 3} propertyPath: util diff --git a/Assets/Scripts/TrajectoryPlanner/Probes/ProbeManager.cs b/Assets/Scripts/TrajectoryPlanner/Probes/ProbeManager.cs index e12ad15d..d10e3992 100644 --- a/Assets/Scripts/TrajectoryPlanner/Probes/ProbeManager.cs +++ b/Assets/Scripts/TrajectoryPlanner/Probes/ProbeManager.cs @@ -1,6 +1,7 @@ using System; using System.Collections; using System.Collections.Generic; +using System.Drawing.Imaging; using System.Linq; using EphysLink; using TrajectoryPlanner.Probes; @@ -179,6 +180,13 @@ public Color Color UIUpdateEvent.Invoke(); if (ActiveProbeManager == this) ActiveProbeUIUpdateEvent.Invoke(); + + // Switch to line if green + if (value == ProbeProperties.ProbeColors[4]) + { + print("Probe is green"); + ProbeDisplay = ProbeDisplayType.Line; + } } } From 99b7b913c630ae4743bb1cc4dfb680b3ed586d93 Mon Sep 17 00:00:00 2001 From: Kenneth Yang Date: Thu, 2 Nov 2023 16:50:55 -0700 Subject: [PATCH 48/78] Got poster images, revert some steps --- .../TrajectoryPlanner/Probes/ProbeManager.cs | 7 ------ .../UI/EphysCopilot/DrivePanelHandler.cs | 22 +++++++++++-------- 2 files changed, 13 insertions(+), 16 deletions(-) diff --git a/Assets/Scripts/TrajectoryPlanner/Probes/ProbeManager.cs b/Assets/Scripts/TrajectoryPlanner/Probes/ProbeManager.cs index d10e3992..21393457 100644 --- a/Assets/Scripts/TrajectoryPlanner/Probes/ProbeManager.cs +++ b/Assets/Scripts/TrajectoryPlanner/Probes/ProbeManager.cs @@ -180,13 +180,6 @@ public Color Color UIUpdateEvent.Invoke(); if (ActiveProbeManager == this) ActiveProbeUIUpdateEvent.Invoke(); - - // Switch to line if green - if (value == ProbeProperties.ProbeColors[4]) - { - print("Probe is green"); - ProbeDisplay = ProbeDisplayType.Line; - } } } diff --git a/Assets/Scripts/TrajectoryPlanner/UI/EphysCopilot/DrivePanelHandler.cs b/Assets/Scripts/TrajectoryPlanner/UI/EphysCopilot/DrivePanelHandler.cs index 5dc42437..1fe4f79f 100644 --- a/Assets/Scripts/TrajectoryPlanner/UI/EphysCopilot/DrivePanelHandler.cs +++ b/Assets/Scripts/TrajectoryPlanner/UI/EphysCopilot/DrivePanelHandler.cs @@ -197,7 +197,7 @@ public void CompleteMovement() // Boundary acknowledgements private bool _acknowledgeOutOfBounds; private bool _acknowledgeTestSpeeds; - private bool _acknowledgeHighSpeeds; + private bool _acknowledgeHighSpeeds = true; // Drive state private DriveState _driveState; @@ -246,7 +246,7 @@ private Vector4 _outsidePosition var targetAPMLDV = _duraAPMLDV; targetAPMLDV.z = ProbeManager.ProbeController.Insertion .World2TransformedAxisChange(InsertionSelectionPanelHandler.PRE_DEPTH_DRIVE_DV_OFFSET).z; - + // Convert to manipulator position return ProbeManager.ManipulatorBehaviorController.ConvertInsertionAPMLDVToManipulatorPosition( targetAPMLDV); @@ -275,7 +275,7 @@ private Vector4 _outsidePosition // Drive Speeds private float _driveBaseSpeed = DEPTH_DRIVE_BASE_SPEED; - private float _per1000Speed => _driveBaseSpeed < DEPTH_DRIVE_BASE_SPEED ? PER_1000_SPEED : PER_1000_SPEED_TEST; + private float _per1000Speed => _driveBaseSpeed <= DEPTH_DRIVE_BASE_SPEED ? PER_1000_SPEED : PER_1000_SPEED_TEST; private float _targetDriveSpeed => _driveBaseSpeed + _targetDriveDistance * _per1000Speed; private float _nearTargetDriveSpeed => _driveBaseSpeed * NEAR_TARGET_SPEED_MULTIPLIER; private float _exitDriveBaseSpeed => _driveBaseSpeed * EXIT_DRIVE_SPEED_MULTIPLIER; @@ -311,8 +311,8 @@ private void Start() public void OnSpeedChanged(float value) { // Updates speed text and snap slider - _driveSpeedText.text = "Speed: " + SpeedToString(value / 1000f); - _driveSpeedSlider.SetValueWithoutNotify((int)value); + // _driveSpeedText.text = "Speed: " + SpeedToString(value / 1000f); + // _driveSpeedSlider.SetValueWithoutNotify((int)value); // Warn if speed is too high if (!_acknowledgeHighSpeeds && value > 5) @@ -391,7 +391,8 @@ public void Drive() { case DriveState.DrivingToNearTarget: // Update status text - _statusText.text = "Driving to " + _drivePastTargetDistance + " µm past target..."; + _statusText.text = "Driving to " + _drivePastTargetDistance * 1000f + + " µm past target..."; // Replace drive buttons with stop _driveGroup.SetActive(false); @@ -407,7 +408,8 @@ public void Drive() break; case DriveState.DriveToPastTarget: // Update status text - _statusText.text = "Driving to " + _drivePastTargetDistance + " µm past target..."; + _statusText.text = "Driving to " + _drivePastTargetDistance * 1000f + + " µm past target..."; // Replace drive buttons with stop _driveGroup.SetActive(false); @@ -554,15 +556,17 @@ public void Exit() // Drive to outside position if (position.y < _outsidePosition.y) { - CommunicationManager.Instance.GotoPos(_manipulatorId, _outsidePosition, _outsideDriveSpeed, _=> CompleteOutside(), Debug.LogError); + CommunicationManager.Instance.GotoPos(_manipulatorId, _outsidePosition, + _outsideDriveSpeed, _ => CompleteOutside(), Debug.LogError); } // Drive to outside depth if DV movement is unavailable - else if (position.w > _outsideDepth) + else if (position.w > _outsideDepth) CommunicationManager.Instance.DriveToDepth(_manipulatorId, _outsideDepth, _outsideDriveSpeed, _ => CompleteOutside(), Debug.LogError); else // Already outside, so complete CompleteOutside(); + break; case DriveState.Outside: case DriveState.AtExitMargin: From 173897613ef96658670b1020058d6764e8c6e301 Mon Sep 17 00:00:00 2001 From: Kenneth Yang Date: Tue, 7 Nov 2023 10:16:12 -0800 Subject: [PATCH 49/78] Parsed data, creating UI --- .../UI/EphysCopilot/CopilotDemoPanel.prefab | 737 ++++++++++++++++++ .../EphysCopilot/CopilotDemoPanel.prefab.meta | 7 + .../UI/EphysCopilot/EphysCopilotPanel.prefab | 24 +- Assets/Prefabs/UI/MainCanvas.prefab | 223 +++++- Assets/Scenes/TrajectoryPlanner.unity | 120 +++ .../UI/EphysCopilot/CopilotDemoHandler.cs | 84 +- Assets/StreamingAssets/copilot_demo.json | 294 +++---- 7 files changed, 1317 insertions(+), 172 deletions(-) create mode 100644 Assets/Prefabs/UI/EphysCopilot/CopilotDemoPanel.prefab create mode 100644 Assets/Prefabs/UI/EphysCopilot/CopilotDemoPanel.prefab.meta diff --git a/Assets/Prefabs/UI/EphysCopilot/CopilotDemoPanel.prefab b/Assets/Prefabs/UI/EphysCopilot/CopilotDemoPanel.prefab new file mode 100644 index 00000000..9cd0c5e9 --- /dev/null +++ b/Assets/Prefabs/UI/EphysCopilot/CopilotDemoPanel.prefab @@ -0,0 +1,737 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!1 &389895556494180254 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 3965463384619871731} + - component: {fileID: 8561162464948953327} + - component: {fileID: 6192789025202254326} + - component: {fileID: 5513068339168230614} + m_Layer: 5 + m_Name: StartButton + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &3965463384619871731 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 389895556494180254} + 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: 6464820431473956226} + m_Father: {fileID: 6431889516307735811} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0.5, y: 0.5} + m_AnchorMax: {x: 0.5, y: 0.5} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 200, y: 50} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!222 &8561162464948953327 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 389895556494180254} + m_CullTransparentMesh: 1 +--- !u!114 &6192789025202254326 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 389895556494180254} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_RaycastTarget: 1 + m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} + m_Maskable: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_Sprite: {fileID: 10905, guid: 0000000000000000f000000000000000, type: 0} + m_Type: 1 + m_PreserveAspect: 0 + m_FillCenter: 1 + m_FillMethod: 4 + m_FillAmount: 1 + m_FillClockwise: 1 + m_FillOrigin: 0 + m_UseSpriteMesh: 0 + m_PixelsPerUnitMultiplier: 1 +--- !u!114 &5513068339168230614 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 389895556494180254} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 4e29b1a8efbd4b44bb3f3716e73f07ff, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Navigation: + m_Mode: 3 + m_WrapAround: 0 + m_SelectOnUp: {fileID: 0} + m_SelectOnDown: {fileID: 0} + m_SelectOnLeft: {fileID: 0} + m_SelectOnRight: {fileID: 0} + m_Transition: 1 + m_Colors: + m_NormalColor: {r: 1, g: 1, b: 1, a: 1} + m_HighlightedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1} + m_PressedColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 1} + m_SelectedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1} + m_DisabledColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 0.5019608} + m_ColorMultiplier: 1 + m_FadeDuration: 0.1 + m_SpriteState: + m_HighlightedSprite: {fileID: 0} + m_PressedSprite: {fileID: 0} + m_SelectedSprite: {fileID: 0} + m_DisabledSprite: {fileID: 0} + m_AnimationTriggers: + m_NormalTrigger: Normal + m_HighlightedTrigger: Highlighted + m_PressedTrigger: Pressed + m_SelectedTrigger: Selected + m_DisabledTrigger: Disabled + m_Interactable: 1 + m_TargetGraphic: {fileID: 6192789025202254326} + m_OnClick: + m_PersistentCalls: + m_Calls: [] +--- !u!1 &1445278465348587321 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1445278465348587320} + - component: {fileID: 1777920888481282050} + - component: {fileID: 6576630627422726958} + - component: {fileID: 8665673409680375596} + m_Layer: 5 + m_Name: CopilotDemoPanel + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &1445278465348587320 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1445278465348587321} + 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: 4505031865777792410} + - {fileID: 6431889516307735811} + m_Father: {fileID: 0} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0.5, y: 0} + m_AnchorMax: {x: 0.5, y: 0} + m_AnchoredPosition: {x: 0, y: 300} + m_SizeDelta: {x: 1800, y: 500} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!222 &1777920888481282050 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1445278465348587321} + m_CullTransparentMesh: 1 +--- !u!114 &6576630627422726958 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1445278465348587321} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 0.6666667, g: 0.6509804, b: 0.6156863, a: 1} + m_RaycastTarget: 1 + m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} + m_Maskable: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_Sprite: {fileID: 10907, guid: 0000000000000000f000000000000000, type: 0} + m_Type: 1 + m_PreserveAspect: 0 + m_FillCenter: 1 + m_FillMethod: 4 + m_FillAmount: 1 + m_FillClockwise: 1 + m_FillOrigin: 0 + m_UseSpriteMesh: 0 + m_PixelsPerUnitMultiplier: 1 +--- !u!114 &8665673409680375596 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1445278465348587321} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 59f8146938fff824cb5fd77236b75775, 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: 0 + m_ChildForceExpandWidth: 1 + m_ChildForceExpandHeight: 1 + m_ChildControlWidth: 1 + m_ChildControlHeight: 1 + m_ChildScaleWidth: 0 + m_ChildScaleHeight: 0 + m_ReverseArrangement: 0 +--- !u!1 &3897920513329603770 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 6464820431473956226} + - component: {fileID: 6759510068818208879} + - component: {fileID: 9221599780327977756} + m_Layer: 5 + m_Name: Text (TMP) + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &6464820431473956226 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 3897920513329603770} + 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: [] + m_Father: {fileID: 3965463384619871731} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 1, y: 1} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 0, y: 0} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!222 &6759510068818208879 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 3897920513329603770} + m_CullTransparentMesh: 1 +--- !u!114 &9221599780327977756 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 3897920513329603770} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: f4688fdb7df04437aeb418b961361dc5, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_RaycastTarget: 1 + m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} + m_Maskable: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_text: Start + m_isRightToLeft: 0 + m_fontAsset: {fileID: 11400000, guid: 8f586378b4e144a9851e7b34d9b748ee, type: 2} + m_sharedMaterial: {fileID: 2180264, guid: 8f586378b4e144a9851e7b34d9b748ee, type: 2} + m_fontSharedMaterials: [] + m_fontMaterial: {fileID: 0} + m_fontMaterials: [] + m_fontColor32: + serializedVersion: 2 + rgba: 4281479730 + m_fontColor: {r: 0.19607843, g: 0.19607843, b: 0.19607843, a: 1} + m_enableVertexGradient: 0 + m_colorMode: 3 + m_fontColorGradient: + topLeft: {r: 1, g: 1, b: 1, a: 1} + topRight: {r: 1, g: 1, b: 1, a: 1} + bottomLeft: {r: 1, g: 1, b: 1, a: 1} + bottomRight: {r: 1, g: 1, b: 1, a: 1} + m_fontColorGradientPreset: {fileID: 0} + m_spriteAsset: {fileID: 0} + m_tintAllSprites: 0 + m_StyleSheet: {fileID: 0} + m_TextStyleHashCode: -1183493901 + m_overrideHtmlColors: 0 + m_faceColor: + serializedVersion: 2 + rgba: 4294967295 + m_fontSize: 24 + m_fontSizeBase: 24 + m_fontWeight: 400 + m_enableAutoSizing: 0 + m_fontSizeMin: 18 + m_fontSizeMax: 72 + m_fontStyle: 0 + m_HorizontalAlignment: 2 + m_VerticalAlignment: 512 + m_textAlignment: 65535 + m_characterSpacing: 0 + m_wordSpacing: 0 + m_lineSpacing: 0 + m_lineSpacingMax: 0 + m_paragraphSpacing: 0 + m_charWidthMaxAdj: 0 + m_enableWordWrapping: 1 + m_wordWrappingRatios: 0.4 + m_overflowMode: 0 + m_linkedTextComponent: {fileID: 0} + parentLinkedComponent: {fileID: 0} + m_enableKerning: 1 + m_enableExtraPadding: 0 + checkPaddingRequired: 0 + m_isRichText: 1 + m_parseCtrlCharacters: 1 + m_isOrthographic: 1 + m_isCullingEnabled: 0 + m_horizontalMapping: 0 + m_verticalMapping: 0 + m_uvLineOffset: 0 + m_geometrySortingOrder: 0 + m_IsTextObjectScaleStatic: 0 + m_VertexBufferAutoSizeReduction: 0 + m_useMaxVisibleDescender: 1 + m_pageToDisplay: 1 + m_margin: {x: 0, y: 0, z: 0, w: 0} + m_isUsingLegacyAnimationComponent: 0 + m_isVolumetricText: 0 + m_hasFontAssetChanged: 0 + m_baseMaterial: {fileID: 0} + m_maskOffset: {x: 0, y: 0, z: 0, w: 0} +--- !u!1 &4898606774794570049 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 3510360387209528734} + - component: {fileID: 8115253745855056602} + - component: {fileID: 402407113449165050} + m_Layer: 5 + m_Name: Text (TMP) + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &3510360387209528734 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 4898606774794570049} + 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: [] + m_Father: {fileID: 3472467024927806868} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 1, y: 1} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 0, y: 0} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!222 &8115253745855056602 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 4898606774794570049} + m_CullTransparentMesh: 1 +--- !u!114 &402407113449165050 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 4898606774794570049} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: f4688fdb7df04437aeb418b961361dc5, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_RaycastTarget: 1 + m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} + m_Maskable: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_text: Stop + m_isRightToLeft: 0 + m_fontAsset: {fileID: 11400000, guid: 8f586378b4e144a9851e7b34d9b748ee, type: 2} + m_sharedMaterial: {fileID: 2180264, guid: 8f586378b4e144a9851e7b34d9b748ee, type: 2} + m_fontSharedMaterials: [] + m_fontMaterial: {fileID: 0} + m_fontMaterials: [] + m_fontColor32: + serializedVersion: 2 + rgba: 4281479730 + m_fontColor: {r: 0.19607843, g: 0.19607843, b: 0.19607843, a: 1} + m_enableVertexGradient: 0 + m_colorMode: 3 + m_fontColorGradient: + topLeft: {r: 1, g: 1, b: 1, a: 1} + topRight: {r: 1, g: 1, b: 1, a: 1} + bottomLeft: {r: 1, g: 1, b: 1, a: 1} + bottomRight: {r: 1, g: 1, b: 1, a: 1} + m_fontColorGradientPreset: {fileID: 0} + m_spriteAsset: {fileID: 0} + m_tintAllSprites: 0 + m_StyleSheet: {fileID: 0} + m_TextStyleHashCode: -1183493901 + m_overrideHtmlColors: 0 + m_faceColor: + serializedVersion: 2 + rgba: 4294967295 + m_fontSize: 24 + m_fontSizeBase: 24 + m_fontWeight: 400 + m_enableAutoSizing: 0 + m_fontSizeMin: 18 + m_fontSizeMax: 72 + m_fontStyle: 0 + m_HorizontalAlignment: 2 + m_VerticalAlignment: 512 + m_textAlignment: 65535 + m_characterSpacing: 0 + m_wordSpacing: 0 + m_lineSpacing: 0 + m_lineSpacingMax: 0 + m_paragraphSpacing: 0 + m_charWidthMaxAdj: 0 + m_enableWordWrapping: 1 + m_wordWrappingRatios: 0.4 + m_overflowMode: 0 + m_linkedTextComponent: {fileID: 0} + parentLinkedComponent: {fileID: 0} + m_enableKerning: 1 + m_enableExtraPadding: 0 + checkPaddingRequired: 0 + m_isRichText: 1 + m_parseCtrlCharacters: 1 + m_isOrthographic: 1 + m_isCullingEnabled: 0 + m_horizontalMapping: 0 + m_verticalMapping: 0 + m_uvLineOffset: 0 + m_geometrySortingOrder: 0 + m_IsTextObjectScaleStatic: 0 + m_VertexBufferAutoSizeReduction: 0 + m_useMaxVisibleDescender: 1 + m_pageToDisplay: 1 + m_margin: {x: 0, y: 0, z: 0, w: 0} + m_isUsingLegacyAnimationComponent: 0 + m_isVolumetricText: 0 + m_hasFontAssetChanged: 0 + m_baseMaterial: {fileID: 0} + m_maskOffset: {x: 0, y: 0, z: 0, w: 0} +--- !u!1 &5633408781004299327 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 4505031865777792410} + - component: {fileID: 1146937742330204303} + m_Layer: 5 + m_Name: StateGroup + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &4505031865777792410 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 5633408781004299327} + 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: [] + m_Father: {fileID: 1445278465348587320} + m_RootOrder: 0 + 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 &1146937742330204303 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 5633408781004299327} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 306cc8c2b49d7114eaa3623786fc2126, type: 3} + m_Name: + m_EditorClassIdentifier: + m_IgnoreLayout: 0 + m_MinWidth: -1 + m_MinHeight: -1 + m_PreferredWidth: -1 + m_PreferredHeight: -1 + m_FlexibleWidth: -1 + m_FlexibleHeight: 3 + m_LayoutPriority: 1 +--- !u!1 &6774747710933269036 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 6431889516307735811} + - component: {fileID: 279374195661084595} + m_Layer: 5 + m_Name: ButtonGroup + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &6431889516307735811 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 6774747710933269036} + 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: 3965463384619871731} + - {fileID: 3472467024927806868} + m_Father: {fileID: 1445278465348587320} + m_RootOrder: 1 + 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 &279374195661084595 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 6774747710933269036} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 306cc8c2b49d7114eaa3623786fc2126, type: 3} + m_Name: + m_EditorClassIdentifier: + m_IgnoreLayout: 0 + m_MinWidth: -1 + m_MinHeight: -1 + m_PreferredWidth: -1 + m_PreferredHeight: -1 + m_FlexibleWidth: -1 + m_FlexibleHeight: 1 + m_LayoutPriority: 1 +--- !u!1 &8185988774562960974 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 3472467024927806868} + - component: {fileID: 6478193579199548584} + - component: {fileID: 8615624641168382821} + - component: {fileID: 5666644119483412797} + m_Layer: 5 + m_Name: StopButton + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 0 +--- !u!224 &3472467024927806868 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 8185988774562960974} + 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: 3510360387209528734} + m_Father: {fileID: 6431889516307735811} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0.5, y: 0.5} + m_AnchorMax: {x: 0.5, y: 0.5} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 200, y: 50} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!222 &6478193579199548584 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 8185988774562960974} + m_CullTransparentMesh: 1 +--- !u!114 &8615624641168382821 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 8185988774562960974} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_RaycastTarget: 1 + m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} + m_Maskable: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_Sprite: {fileID: 10905, guid: 0000000000000000f000000000000000, type: 0} + m_Type: 1 + m_PreserveAspect: 0 + m_FillCenter: 1 + m_FillMethod: 4 + m_FillAmount: 1 + m_FillClockwise: 1 + m_FillOrigin: 0 + m_UseSpriteMesh: 0 + m_PixelsPerUnitMultiplier: 1 +--- !u!114 &5666644119483412797 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 8185988774562960974} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 4e29b1a8efbd4b44bb3f3716e73f07ff, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Navigation: + m_Mode: 3 + m_WrapAround: 0 + m_SelectOnUp: {fileID: 0} + m_SelectOnDown: {fileID: 0} + m_SelectOnLeft: {fileID: 0} + m_SelectOnRight: {fileID: 0} + m_Transition: 1 + m_Colors: + m_NormalColor: {r: 1, g: 1, b: 1, a: 1} + m_HighlightedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1} + m_PressedColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 1} + m_SelectedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1} + m_DisabledColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 0.5019608} + m_ColorMultiplier: 1 + m_FadeDuration: 0.1 + m_SpriteState: + m_HighlightedSprite: {fileID: 0} + m_PressedSprite: {fileID: 0} + m_SelectedSprite: {fileID: 0} + m_DisabledSprite: {fileID: 0} + m_AnimationTriggers: + m_NormalTrigger: Normal + m_HighlightedTrigger: Highlighted + m_PressedTrigger: Pressed + m_SelectedTrigger: Selected + m_DisabledTrigger: Disabled + m_Interactable: 1 + m_TargetGraphic: {fileID: 8615624641168382821} + m_OnClick: + m_PersistentCalls: + m_Calls: [] diff --git a/Assets/Prefabs/UI/EphysCopilot/CopilotDemoPanel.prefab.meta b/Assets/Prefabs/UI/EphysCopilot/CopilotDemoPanel.prefab.meta new file mode 100644 index 00000000..306de30e --- /dev/null +++ b/Assets/Prefabs/UI/EphysCopilot/CopilotDemoPanel.prefab.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: c61e26b987f076144a8c951a87349115 +PrefabImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Prefabs/UI/EphysCopilot/EphysCopilotPanel.prefab b/Assets/Prefabs/UI/EphysCopilot/EphysCopilotPanel.prefab index 288b604c..a9bff026 100644 --- a/Assets/Prefabs/UI/EphysCopilot/EphysCopilotPanel.prefab +++ b/Assets/Prefabs/UI/EphysCopilot/EphysCopilotPanel.prefab @@ -121,8 +121,8 @@ MonoBehaviour: m_TargetGraphic: {fileID: 8493615845065584824} m_HandleRect: {fileID: 8361295466311985757} m_Direction: 2 - m_Value: 0 - m_Size: 1 + m_Value: 1 + m_Size: 0.6180117 m_NumberOfSteps: 0 m_OnValueChanged: m_PersistentCalls: @@ -987,8 +987,8 @@ MonoBehaviour: m_TargetGraphic: {fileID: 5041640443237617115} m_HandleRect: {fileID: 3068108255336848725} m_Direction: 2 - m_Value: 0 - m_Size: 1 + m_Value: 1 + m_Size: 0.6180117 m_NumberOfSteps: 0 m_OnValueChanged: m_PersistentCalls: @@ -1783,7 +1783,7 @@ RectTransform: m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 1} m_AnchorMax: {x: 1, y: 1} - m_AnchoredPosition: {x: 0, y: -0.000024523586} + m_AnchoredPosition: {x: 0, y: -58.592503} m_SizeDelta: {x: 0, y: 0} m_Pivot: {x: 0, y: 1} --- !u!114 &5868928366586953604 @@ -2427,8 +2427,8 @@ MonoBehaviour: m_TargetGraphic: {fileID: 2824903185860898137} m_HandleRect: {fileID: 604587447986236897} m_Direction: 2 - m_Value: 0 - m_Size: 1 + m_Value: 1 + m_Size: 0.6180117 m_NumberOfSteps: 0 m_OnValueChanged: m_PersistentCalls: @@ -2544,7 +2544,7 @@ RectTransform: m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 1} m_AnchorMax: {x: 1, y: 1} - m_AnchoredPosition: {x: 0, y: -0.000024523586} + m_AnchoredPosition: {x: 0, y: -58.592503} m_SizeDelta: {x: 0, y: 0} m_Pivot: {x: 0, y: 1} --- !u!114 &4506754816824710980 @@ -2622,7 +2622,7 @@ RectTransform: m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 1} m_AnchorMax: {x: 1, y: 1} - m_AnchoredPosition: {x: 0, y: 0} + m_AnchoredPosition: {x: 0, y: -58.592472} m_SizeDelta: {x: 0, y: 0} m_Pivot: {x: 0, y: 1} --- !u!114 &5987856609131885523 @@ -3003,8 +3003,8 @@ MonoBehaviour: m_TargetGraphic: {fileID: 5713203697382717340} m_HandleRect: {fileID: 538386439288270413} m_Direction: 2 - m_Value: 0 - m_Size: 1 + m_Value: 1 + m_Size: 0.6180117 m_NumberOfSteps: 0 m_OnValueChanged: m_PersistentCalls: @@ -3170,7 +3170,7 @@ RectTransform: m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 1} m_AnchorMax: {x: 1, y: 1} - m_AnchoredPosition: {x: 0, y: -0.000024523586} + m_AnchoredPosition: {x: 0, y: -58.592503} m_SizeDelta: {x: 0, y: 0} m_Pivot: {x: 0, y: 1} --- !u!114 &2245757367060331119 diff --git a/Assets/Prefabs/UI/MainCanvas.prefab b/Assets/Prefabs/UI/MainCanvas.prefab index 83587896..b405ec49 100644 --- a/Assets/Prefabs/UI/MainCanvas.prefab +++ b/Assets/Prefabs/UI/MainCanvas.prefab @@ -44,6 +44,7 @@ RectTransform: - {fileID: 341190944882926340} - {fileID: 341190945112364105} - {fileID: 858666763888331269} + - {fileID: 6065941617704141803} - {fileID: 5977723730511622612} - {fileID: 9068794098842140863} - {fileID: 341190944649414362} @@ -216,7 +217,7 @@ PrefabInstance: objectReference: {fileID: 0} - target: {fileID: 4225364627726879432, guid: 2935bf57d75895c4b9ab6878851725ea, type: 3} propertyPath: m_RootOrder - value: 11 + value: 12 objectReference: {fileID: 0} - target: {fileID: 4225364627726879432, guid: 2935bf57d75895c4b9ab6878851725ea, type: 3} propertyPath: m_AnchorMax.x @@ -5250,7 +5251,7 @@ PrefabInstance: objectReference: {fileID: 0} - target: {fileID: 8061307773979316499, guid: b70534dfc2e4a52489c512aabd5dd59d, type: 3} propertyPath: m_RootOrder - value: 8 + value: 9 objectReference: {fileID: 0} - target: {fileID: 8061307773979316499, guid: b70534dfc2e4a52489c512aabd5dd59d, type: 3} propertyPath: m_AnchorMax.x @@ -5331,6 +5332,220 @@ RectTransform: m_CorrespondingSourceObject: {fileID: 8061307773979316499, guid: b70534dfc2e4a52489c512aabd5dd59d, type: 3} m_PrefabInstance: {fileID: 4407511908067877063} m_PrefabAsset: {fileID: 0} +--- !u!1001 &4620733729677790419 +PrefabInstance: + m_ObjectHideFlags: 0 + serializedVersion: 2 + m_Modification: + m_TransformParent: {fileID: 341190944083206654} + m_Modifications: + - target: {fileID: 316626772814739228, guid: c61e26b987f076144a8c951a87349115, type: 3} + propertyPath: m_Size + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 316626772814739228, guid: c61e26b987f076144a8c951a87349115, type: 3} + propertyPath: m_Value + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 538386439288270413, guid: c61e26b987f076144a8c951a87349115, type: 3} + propertyPath: m_AnchorMax.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 538386439288270413, guid: c61e26b987f076144a8c951a87349115, type: 3} + propertyPath: m_AnchorMax.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 538386439288270413, guid: c61e26b987f076144a8c951a87349115, type: 3} + propertyPath: m_AnchorMin.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 604587447986236897, guid: c61e26b987f076144a8c951a87349115, type: 3} + propertyPath: m_AnchorMax.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 604587447986236897, guid: c61e26b987f076144a8c951a87349115, type: 3} + propertyPath: m_AnchorMax.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 604587447986236897, guid: c61e26b987f076144a8c951a87349115, type: 3} + propertyPath: m_AnchorMin.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1023112252082091778, guid: c61e26b987f076144a8c951a87349115, type: 3} + propertyPath: m_SizeDelta.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1023112252082091778, guid: c61e26b987f076144a8c951a87349115, type: 3} + propertyPath: m_AnchoredPosition.y + value: 0.000045776367 + objectReference: {fileID: 0} + - target: {fileID: 1445278465348587320, guid: c61e26b987f076144a8c951a87349115, type: 3} + propertyPath: m_Pivot.x + value: 0.5 + objectReference: {fileID: 0} + - target: {fileID: 1445278465348587320, guid: c61e26b987f076144a8c951a87349115, type: 3} + propertyPath: m_Pivot.y + value: 0.5 + objectReference: {fileID: 0} + - target: {fileID: 1445278465348587320, guid: c61e26b987f076144a8c951a87349115, type: 3} + propertyPath: m_RootOrder + value: 8 + objectReference: {fileID: 0} + - target: {fileID: 1445278465348587320, guid: c61e26b987f076144a8c951a87349115, type: 3} + propertyPath: m_AnchorMax.x + value: 0.5 + objectReference: {fileID: 0} + - target: {fileID: 1445278465348587320, guid: c61e26b987f076144a8c951a87349115, type: 3} + propertyPath: m_AnchorMax.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1445278465348587320, guid: c61e26b987f076144a8c951a87349115, type: 3} + propertyPath: m_AnchorMin.x + value: 0.5 + objectReference: {fileID: 0} + - target: {fileID: 1445278465348587320, guid: c61e26b987f076144a8c951a87349115, type: 3} + propertyPath: m_AnchorMin.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1445278465348587320, guid: c61e26b987f076144a8c951a87349115, type: 3} + propertyPath: m_SizeDelta.x + value: 1800 + objectReference: {fileID: 0} + - target: {fileID: 1445278465348587320, guid: c61e26b987f076144a8c951a87349115, type: 3} + propertyPath: m_SizeDelta.y + value: 500 + objectReference: {fileID: 0} + - target: {fileID: 1445278465348587320, guid: c61e26b987f076144a8c951a87349115, type: 3} + propertyPath: m_LocalPosition.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1445278465348587320, guid: c61e26b987f076144a8c951a87349115, type: 3} + propertyPath: m_LocalPosition.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1445278465348587320, guid: c61e26b987f076144a8c951a87349115, type: 3} + propertyPath: m_LocalPosition.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1445278465348587320, guid: c61e26b987f076144a8c951a87349115, type: 3} + propertyPath: m_LocalRotation.w + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 1445278465348587320, guid: c61e26b987f076144a8c951a87349115, type: 3} + propertyPath: m_LocalRotation.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1445278465348587320, guid: c61e26b987f076144a8c951a87349115, type: 3} + propertyPath: m_LocalRotation.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1445278465348587320, guid: c61e26b987f076144a8c951a87349115, type: 3} + propertyPath: m_LocalRotation.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1445278465348587320, guid: c61e26b987f076144a8c951a87349115, type: 3} + propertyPath: m_AnchoredPosition.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1445278465348587320, guid: c61e26b987f076144a8c951a87349115, type: 3} + propertyPath: m_AnchoredPosition.y + value: 300 + objectReference: {fileID: 0} + - target: {fileID: 1445278465348587320, guid: c61e26b987f076144a8c951a87349115, type: 3} + propertyPath: m_LocalEulerAnglesHint.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1445278465348587320, guid: c61e26b987f076144a8c951a87349115, type: 3} + propertyPath: m_LocalEulerAnglesHint.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1445278465348587320, guid: c61e26b987f076144a8c951a87349115, type: 3} + propertyPath: m_LocalEulerAnglesHint.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1445278465348587321, guid: c61e26b987f076144a8c951a87349115, type: 3} + propertyPath: m_Name + value: CopilotDemoPanel + objectReference: {fileID: 0} + - target: {fileID: 2654698296376999678, guid: c61e26b987f076144a8c951a87349115, type: 3} + propertyPath: m_Size + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 2654698296376999678, guid: c61e26b987f076144a8c951a87349115, type: 3} + propertyPath: m_Value + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 3068108255336848725, guid: c61e26b987f076144a8c951a87349115, type: 3} + propertyPath: m_AnchorMax.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 3068108255336848725, guid: c61e26b987f076144a8c951a87349115, type: 3} + propertyPath: m_AnchorMax.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 3068108255336848725, guid: c61e26b987f076144a8c951a87349115, type: 3} + propertyPath: m_AnchorMin.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 4053970164101770309, guid: c61e26b987f076144a8c951a87349115, type: 3} + propertyPath: m_SizeDelta.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 4053970164101770309, guid: c61e26b987f076144a8c951a87349115, type: 3} + propertyPath: m_AnchoredPosition.y + value: 0.000015258789 + objectReference: {fileID: 0} + - target: {fileID: 6126481738209059470, guid: c61e26b987f076144a8c951a87349115, type: 3} + propertyPath: m_SizeDelta.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 6126481738209059470, guid: c61e26b987f076144a8c951a87349115, type: 3} + propertyPath: m_AnchoredPosition.y + value: 0.000015258789 + objectReference: {fileID: 0} + - target: {fileID: 6696808094185633579, guid: c61e26b987f076144a8c951a87349115, type: 3} + propertyPath: m_Size + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 6696808094185633579, guid: c61e26b987f076144a8c951a87349115, type: 3} + propertyPath: m_Value + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 7730571946973758776, guid: c61e26b987f076144a8c951a87349115, type: 3} + propertyPath: m_SizeDelta.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 7730571946973758776, guid: c61e26b987f076144a8c951a87349115, type: 3} + propertyPath: m_AnchoredPosition.y + value: 0.000015258789 + objectReference: {fileID: 0} + - target: {fileID: 8361295466311985757, guid: c61e26b987f076144a8c951a87349115, type: 3} + propertyPath: m_AnchorMax.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 8361295466311985757, guid: c61e26b987f076144a8c951a87349115, type: 3} + propertyPath: m_AnchorMax.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 8361295466311985757, guid: c61e26b987f076144a8c951a87349115, type: 3} + propertyPath: m_AnchorMin.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 8428055214211566965, guid: c61e26b987f076144a8c951a87349115, type: 3} + propertyPath: m_Size + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 8428055214211566965, guid: c61e26b987f076144a8c951a87349115, type: 3} + propertyPath: m_Value + value: 0 + objectReference: {fileID: 0} + m_RemovedComponents: [] + m_SourcePrefab: {fileID: 100100000, guid: c61e26b987f076144a8c951a87349115, type: 3} +--- !u!224 &6065941617704141803 stripped +RectTransform: + m_CorrespondingSourceObject: {fileID: 1445278465348587320, guid: c61e26b987f076144a8c951a87349115, type: 3} + m_PrefabInstance: {fileID: 4620733729677790419} + m_PrefabAsset: {fileID: 0} --- !u!1001 &5000858622118457398 PrefabInstance: m_ObjectHideFlags: 0 @@ -5396,7 +5611,7 @@ PrefabInstance: objectReference: {fileID: 0} - target: {fileID: 4745308775600715500, guid: 0bc497a41ae98c34996698f167fe12fc, type: 3} propertyPath: m_RootOrder - value: 10 + value: 11 objectReference: {fileID: 0} - target: {fileID: 4745308775600715500, guid: 0bc497a41ae98c34996698f167fe12fc, type: 3} propertyPath: m_AnchorMax.x @@ -5717,7 +5932,7 @@ PrefabInstance: objectReference: {fileID: 0} - target: {fileID: 3478975257933580973, guid: 2a3faed150327c041acb3d9ebce2d19b, type: 3} propertyPath: m_RootOrder - value: 9 + value: 10 objectReference: {fileID: 0} - target: {fileID: 3478975257933580973, guid: 2a3faed150327c041acb3d9ebce2d19b, type: 3} propertyPath: m_AnchorMax.x diff --git a/Assets/Scenes/TrajectoryPlanner.unity b/Assets/Scenes/TrajectoryPlanner.unity index de3ed8b5..0f4ee40c 100644 --- a/Assets/Scenes/TrajectoryPlanner.unity +++ b/Assets/Scenes/TrajectoryPlanner.unity @@ -4040,6 +4040,30 @@ PrefabInstance: propertyPath: _experimentDropdown value: objectReference: {fileID: 341190943874437990} + - target: {fileID: 1829180218217638352, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} + propertyPath: m_AnchorMax.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1829180218217638352, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} + propertyPath: m_AnchorMin.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1829180218217638352, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} + propertyPath: m_SizeDelta.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1829180218217638352, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} + propertyPath: m_SizeDelta.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1829180218217638352, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} + propertyPath: m_AnchoredPosition.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1829180218217638352, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} + propertyPath: m_AnchoredPosition.y + value: 0 + objectReference: {fileID: 0} - target: {fileID: 1890578862338769638, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} propertyPath: m_AnchorMax.y value: 0 @@ -4444,6 +4468,10 @@ PrefabInstance: propertyPath: m_text value: Please select path to HelloSGLX.exe objectReference: {fileID: 0} + - target: {fileID: 3127933432259463659, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} + propertyPath: m_SizeDelta.y + value: 0 + objectReference: {fileID: 0} - target: {fileID: 3162619661544978193, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} propertyPath: m_AnchorMax.y value: 1 @@ -5684,6 +5712,14 @@ PrefabInstance: propertyPath: m_AnchoredPosition.y value: -23.5 objectReference: {fileID: 0} + - target: {fileID: 5141034094933992094, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} + propertyPath: m_AnchorMax.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 5141034094933992094, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} + propertyPath: m_AnchorMax.y + value: 0 + objectReference: {fileID: 0} - target: {fileID: 5336434124739495000, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} propertyPath: m_OnValueChanged.m_PersistentCalls.m_Calls.Array.data[0].m_MethodName value: ChangeProbeExperiment @@ -5924,6 +5960,30 @@ PrefabInstance: propertyPath: m_OnValueChanged.m_PersistentCalls.m_Calls.Array.data[0].m_TargetAssemblyTypeName value: ChannelMapManager, trajectoryplanner.probe objectReference: {fileID: 0} + - target: {fileID: 6065941617837916594, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} + propertyPath: m_AnchorMax.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 6065941617837916594, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} + propertyPath: m_AnchorMin.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 6065941617837916594, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} + propertyPath: m_SizeDelta.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 6065941617837916594, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} + propertyPath: m_SizeDelta.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 6065941617837916594, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} + propertyPath: m_AnchoredPosition.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 6065941617837916594, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} + propertyPath: m_AnchoredPosition.y + value: 0 + objectReference: {fileID: 0} - target: {fileID: 6086612991605934339, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} propertyPath: m_AnchoredPosition.x value: 18.579987 @@ -6156,6 +6216,30 @@ PrefabInstance: propertyPath: m_AnchoredPosition.y value: 0 objectReference: {fileID: 0} + - target: {fileID: 6583406256186505069, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} + propertyPath: m_AnchorMax.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 6583406256186505069, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} + propertyPath: m_AnchorMin.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 6583406256186505069, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} + propertyPath: m_SizeDelta.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 6583406256186505069, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} + propertyPath: m_SizeDelta.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 6583406256186505069, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} + propertyPath: m_AnchoredPosition.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 6583406256186505069, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} + propertyPath: m_AnchoredPosition.y + value: 0 + objectReference: {fileID: 0} - target: {fileID: 6774864783474415589, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} propertyPath: LockEvent.m_PersistentCalls.m_Calls.Array.size value: 1 @@ -6552,6 +6636,18 @@ PrefabInstance: propertyPath: m_Value value: 1 objectReference: {fileID: 0} + - target: {fileID: 7721325591881651435, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} + propertyPath: m_AnchorMax.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 7721325591881651435, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} + propertyPath: m_AnchorMax.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 7721325591881651435, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} + propertyPath: m_SizeDelta.x + value: 0 + objectReference: {fileID: 0} - target: {fileID: 7747672015584633784, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} propertyPath: m_AnchorMax.y value: 0 @@ -7232,6 +7328,30 @@ PrefabInstance: propertyPath: m_IsActive value: 0 objectReference: {fileID: 0} + - target: {fileID: 9125755490035067209, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} + propertyPath: m_AnchorMax.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 9125755490035067209, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} + propertyPath: m_AnchorMin.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 9125755490035067209, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} + propertyPath: m_SizeDelta.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 9125755490035067209, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} + propertyPath: m_SizeDelta.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 9125755490035067209, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} + propertyPath: m_AnchoredPosition.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 9125755490035067209, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} + propertyPath: m_AnchoredPosition.y + value: 0 + objectReference: {fileID: 0} - target: {fileID: 9201160669940680994, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} propertyPath: m_AnchorMax.y value: 0 diff --git a/Assets/Scripts/TrajectoryPlanner/UI/EphysCopilot/CopilotDemoHandler.cs b/Assets/Scripts/TrajectoryPlanner/UI/EphysCopilot/CopilotDemoHandler.cs index 6cea9136..52b7f08d 100644 --- a/Assets/Scripts/TrajectoryPlanner/UI/EphysCopilot/CopilotDemoHandler.cs +++ b/Assets/Scripts/TrajectoryPlanner/UI/EphysCopilot/CopilotDemoHandler.cs @@ -1,16 +1,40 @@ using System; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; using System.IO; +using System.Linq; using UnityEngine; namespace TrajectoryPlanner.UI.EphysCopilot { [Serializable] - internal struct DemoData + [SuppressMessage("ReSharper", "InconsistentNaming")] + internal struct DemoDataJson { - public Vector3 angle; - public Vector3 idle; - public Vector4 insertion; + public List data; } + + [Serializable] + [SuppressMessage("ReSharper", "InconsistentNaming")] + internal struct ManipulatorDataJson + { + public List angle; + public List idle; + public List insertion; + } + + /// + /// Angle: Yaw, Pitch, Roll + /// Idle: AP, ML, DV + /// Insertion: AP, ML, DV, Depth + /// + internal struct ManipulatorData + { + public Vector3 Angle; + public Vector3 IdlePos; + public Vector4 InsertionPos; + } + public class CopilotDemoHandler : MonoBehaviour { #region Components @@ -20,13 +44,53 @@ public class CopilotDemoHandler : MonoBehaviour #endregion + #region Properties + + private Dictionary _demoManipulatorToData = new(); + + #endregion + private void Start() { - print(Application.streamingAssetsPath + "/copilot_demo.json"); - print(File.ReadAllText(Application.streamingAssetsPath + "/copilot_demo.json")); - // var data = JsonUtility.FromJson(Resources - // .Load(Application.streamingAssetsPath + "/copilot_demo.json").text); - // print(data); + // Parse JSON + var jsonString = File.ReadAllText(Application.streamingAssetsPath + "/copilot_demo.json"); + var data = JsonUtility.FromJson(jsonString); + + // Convert to ManipulatorData and match with manipulator + foreach (var manipulatorData in data.data) + { + // Convert data + var convertedData = new ManipulatorData + { + Angle = new Vector3(manipulatorData.angle[0], manipulatorData.angle[1], manipulatorData.angle[2]), + IdlePos = new Vector3(manipulatorData.idle[0], manipulatorData.idle[1], manipulatorData.idle[2]), + InsertionPos = new Vector4(manipulatorData.insertion[0], manipulatorData.insertion[1], + manipulatorData.insertion[2], manipulatorData.insertion[3]) + }; + + // Match to manipulator + var matchingManipulator = ProbeManager.Instances.FirstOrDefault( + manager => manager.IsEphysLinkControlled && + IsCoterminal(manager.ProbeController.Insertion.angles, convertedData.Angle)); + + // If there is a matching manipulator, keep track of it + if (matchingManipulator!= null) + { + _demoManipulatorToData.Add(matchingManipulator, convertedData); + } + } + + print("Matching manipulators: "+_demoManipulatorToData.Count); } + + #region Helper functions + + private static bool IsCoterminal(Vector3 first, Vector3 second) + { + return Mathf.Abs(first.x - second.x) % 360 < 0.01f && Mathf.Abs(first.y - second.y) % 360 < 0.01f && + Mathf.Abs(first.z - second.z) % 360 < 0.01f; + } + + #endregion } -} +} \ No newline at end of file diff --git a/Assets/StreamingAssets/copilot_demo.json b/Assets/StreamingAssets/copilot_demo.json index ce7b26d8..e5312f36 100644 --- a/Assets/StreamingAssets/copilot_demo.json +++ b/Assets/StreamingAssets/copilot_demo.json @@ -1,146 +1,148 @@ -[ - { - "angle": [ - 180, - 35, - 0 - ], - "idle": [ - 8693, - 0, - 5670 - ], - "insertion": [ - 3903, - -1000, - -1041, - 3612 - ] - }, - { - "angle": [ - 225, - 35, - 0 - ], - "idle": [ - 7513, - 7513, - 6152 - ], - "insertion": [ - 2346, - 2346, - -1281, - 3318 - ] - }, - { - "angle": [ - -90, - 35, - 0 - ], - "idle": [ - 0, - 9659, - 7411 - ], - "insertion": [ - -1000, - 2487, - -447, - 4336 - ] - }, - { - "angle": [ - -45, - 35, - 0 - ], - "idle": [ - -8879, - 8879, - 7635 - ], - "insertion": [ - -4174, - 2174, - -607, - 5361 - ] - }, - { - "angle": [ - 0, - 35, - 0 - ], - "idle": [ - -12557, - 1000, - 5635 - ], - "insertion": [ - -6400, - 0, - -999, - 3441 - ] - }, - { - "angle": [ - 45, - 35, - 0 - ], - "idle": [ - -7513, - -7513, - 9152 - ], - "insertion": [ - -4183, - -2183, - -610, - 2916 - ] - }, - { - "angle": [ - 90, - 35, - 0 - ], - "idle": [ - 0, - -8693, - 7670 - ], - "insertion": [ - -1000, - 3274, - -810, - 2852 - ] - }, - { - "angle": [ - 135, - 35, - 0 - ], - "idle": [ - 8196, - -8196, - 6894 - ], - "insertion": [ - 1785, - -2785, - -1393, - 3402 - ] - } -] \ No newline at end of file +{ + "data": [ + { + "angle": [ + 180, + 35, + 0 + ], + "idle": [ + 8693, + 0, + 5670 + ], + "insertion": [ + 3903, + -1000, + -1041, + 3612 + ] + }, + { + "angle": [ + 225, + 35, + 0 + ], + "idle": [ + 7513, + 7513, + 6152 + ], + "insertion": [ + 2346, + 2346, + -1281, + 3318 + ] + }, + { + "angle": [ + -90, + 35, + 0 + ], + "idle": [ + 0, + 9659, + 7411 + ], + "insertion": [ + -1000, + 2487, + -447, + 4336 + ] + }, + { + "angle": [ + -45, + 35, + 0 + ], + "idle": [ + -8879, + 8879, + 7635 + ], + "insertion": [ + -4174, + 2174, + -607, + 5361 + ] + }, + { + "angle": [ + 0, + 35, + 0 + ], + "idle": [ + -12557, + 1000, + 5635 + ], + "insertion": [ + -6400, + 0, + -999, + 3441 + ] + }, + { + "angle": [ + 45, + 35, + 0 + ], + "idle": [ + -7513, + -7513, + 9152 + ], + "insertion": [ + -4183, + -2183, + -610, + 2916 + ] + }, + { + "angle": [ + 90, + 35, + 0 + ], + "idle": [ + 0, + -8693, + 7670 + ], + "insertion": [ + -1000, + 3274, + -810, + 2852 + ] + }, + { + "angle": [ + 135, + 35, + 0 + ], + "idle": [ + 8196, + -8196, + 6894 + ], + "insertion": [ + 1785, + -2785, + -1393, + 3402 + ] + } + ] +} \ No newline at end of file From 8634fb2aa49621579d323472c7864ec545daffdc Mon Sep 17 00:00:00 2001 From: Kenneth Yang Date: Tue, 7 Nov 2023 10:26:14 -0800 Subject: [PATCH 50/78] Demo basic UI --- .../UI/EphysCopilot/CopilotDemoPanel.prefab | 794 +++++++++++++++++- Assets/Scenes/TrajectoryPlanner.unity | 189 ++++- 2 files changed, 920 insertions(+), 63 deletions(-) diff --git a/Assets/Prefabs/UI/EphysCopilot/CopilotDemoPanel.prefab b/Assets/Prefabs/UI/EphysCopilot/CopilotDemoPanel.prefab index 9cd0c5e9..1c6b600e 100644 --- a/Assets/Prefabs/UI/EphysCopilot/CopilotDemoPanel.prefab +++ b/Assets/Prefabs/UI/EphysCopilot/CopilotDemoPanel.prefab @@ -134,6 +134,7 @@ GameObject: - component: {fileID: 1777920888481282050} - component: {fileID: 6576630627422726958} - component: {fileID: 8665673409680375596} + - component: {fileID: 3584326755053723041} m_Layer: 5 m_Name: CopilotDemoPanel m_TagString: Untagged @@ -227,6 +228,294 @@ MonoBehaviour: m_ChildScaleWidth: 0 m_ChildScaleHeight: 0 m_ReverseArrangement: 0 +--- !u!114 &3584326755053723041 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1445278465348587321} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 78f91eb601d18cf4ca076cc899036bd8, type: 3} + m_Name: + m_EditorClassIdentifier: + _startButton: {fileID: 0} + _stopButton: {fileID: 0} +--- !u!1 &1701132444679105691 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1837604378854586354} + - component: {fileID: 365566555434057045} + - component: {fileID: 8946753609717924497} + m_Layer: 5 + m_Name: DuraText + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &1837604378854586354 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1701132444679105691} + 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: [] + m_Father: {fileID: 4505031865777792410} + m_RootOrder: 2 + 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!222 &365566555434057045 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1701132444679105691} + m_CullTransparentMesh: 1 +--- !u!114 &8946753609717924497 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1701132444679105691} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: f4688fdb7df04437aeb418b961361dc5, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_RaycastTarget: 1 + m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} + m_Maskable: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_text: '3. + + Dropping to the Dura' + m_isRightToLeft: 0 + m_fontAsset: {fileID: 11400000, guid: 8f586378b4e144a9851e7b34d9b748ee, type: 2} + m_sharedMaterial: {fileID: 2180264, guid: 8f586378b4e144a9851e7b34d9b748ee, type: 2} + m_fontSharedMaterials: [] + m_fontMaterial: {fileID: 0} + m_fontMaterials: [] + m_fontColor32: + serializedVersion: 2 + rgba: 4294967295 + m_fontColor: {r: 1, g: 1, b: 1, a: 1} + m_enableVertexGradient: 0 + m_colorMode: 3 + m_fontColorGradient: + topLeft: {r: 1, g: 1, b: 1, a: 1} + topRight: {r: 1, g: 1, b: 1, a: 1} + bottomLeft: {r: 1, g: 1, b: 1, a: 1} + bottomRight: {r: 1, g: 1, b: 1, a: 1} + m_fontColorGradientPreset: {fileID: 0} + m_spriteAsset: {fileID: 0} + m_tintAllSprites: 0 + m_StyleSheet: {fileID: 0} + m_TextStyleHashCode: -1183493901 + m_overrideHtmlColors: 0 + m_faceColor: + serializedVersion: 2 + rgba: 4294967295 + m_fontSize: 40 + m_fontSizeBase: 40 + m_fontWeight: 400 + m_enableAutoSizing: 0 + m_fontSizeMin: 18 + m_fontSizeMax: 72 + m_fontStyle: 0 + m_HorizontalAlignment: 2 + m_VerticalAlignment: 512 + m_textAlignment: 65535 + m_characterSpacing: 0 + m_wordSpacing: 0 + m_lineSpacing: 0 + m_lineSpacingMax: 0 + m_paragraphSpacing: 0 + m_charWidthMaxAdj: 0 + m_enableWordWrapping: 1 + m_wordWrappingRatios: 0.4 + m_overflowMode: 0 + m_linkedTextComponent: {fileID: 0} + parentLinkedComponent: {fileID: 0} + m_enableKerning: 1 + m_enableExtraPadding: 0 + checkPaddingRequired: 0 + m_isRichText: 1 + m_parseCtrlCharacters: 1 + m_isOrthographic: 1 + m_isCullingEnabled: 0 + m_horizontalMapping: 0 + m_verticalMapping: 0 + m_uvLineOffset: 0 + m_geometrySortingOrder: 0 + m_IsTextObjectScaleStatic: 0 + m_VertexBufferAutoSizeReduction: 0 + m_useMaxVisibleDescender: 1 + m_pageToDisplay: 1 + m_margin: {x: 0, y: 0, z: 0, w: 0} + m_isUsingLegacyAnimationComponent: 0 + m_isVolumetricText: 0 + m_hasFontAssetChanged: 0 + m_baseMaterial: {fileID: 0} + m_maskOffset: {x: 0, y: 0, z: 0, w: 0} +--- !u!1 &1847626008195611453 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 5147399233535029241} + - component: {fileID: 1609113828977374500} + - component: {fileID: 4426603608457220660} + m_Layer: 5 + m_Name: EntryCoordText + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &5147399233535029241 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1847626008195611453} + 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: [] + m_Father: {fileID: 4505031865777792410} + m_RootOrder: 1 + 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!222 &1609113828977374500 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1847626008195611453} + m_CullTransparentMesh: 1 +--- !u!114 &4426603608457220660 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1847626008195611453} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: f4688fdb7df04437aeb418b961361dc5, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_RaycastTarget: 1 + m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} + m_Maskable: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_text: '2. + + Moving to Entry Coordinate' + m_isRightToLeft: 0 + m_fontAsset: {fileID: 11400000, guid: 8f586378b4e144a9851e7b34d9b748ee, type: 2} + m_sharedMaterial: {fileID: 2180264, guid: 8f586378b4e144a9851e7b34d9b748ee, type: 2} + m_fontSharedMaterials: [] + m_fontMaterial: {fileID: 0} + m_fontMaterials: [] + m_fontColor32: + serializedVersion: 2 + rgba: 4294967295 + m_fontColor: {r: 1, g: 1, b: 1, a: 1} + m_enableVertexGradient: 0 + m_colorMode: 3 + m_fontColorGradient: + topLeft: {r: 1, g: 1, b: 1, a: 1} + topRight: {r: 1, g: 1, b: 1, a: 1} + bottomLeft: {r: 1, g: 1, b: 1, a: 1} + bottomRight: {r: 1, g: 1, b: 1, a: 1} + m_fontColorGradientPreset: {fileID: 0} + m_spriteAsset: {fileID: 0} + m_tintAllSprites: 0 + m_StyleSheet: {fileID: 0} + m_TextStyleHashCode: -1183493901 + m_overrideHtmlColors: 0 + m_faceColor: + serializedVersion: 2 + rgba: 4294967295 + m_fontSize: 40 + m_fontSizeBase: 40 + m_fontWeight: 400 + m_enableAutoSizing: 0 + m_fontSizeMin: 18 + m_fontSizeMax: 72 + m_fontStyle: 0 + m_HorizontalAlignment: 2 + m_VerticalAlignment: 512 + m_textAlignment: 65535 + m_characterSpacing: 0 + m_wordSpacing: 0 + m_lineSpacing: 0 + m_lineSpacingMax: 0 + m_paragraphSpacing: 0 + m_charWidthMaxAdj: 0 + m_enableWordWrapping: 1 + m_wordWrappingRatios: 0.4 + m_overflowMode: 0 + m_linkedTextComponent: {fileID: 0} + parentLinkedComponent: {fileID: 0} + m_enableKerning: 1 + m_enableExtraPadding: 0 + checkPaddingRequired: 0 + m_isRichText: 1 + m_parseCtrlCharacters: 1 + m_isOrthographic: 1 + m_isCullingEnabled: 0 + m_horizontalMapping: 0 + m_verticalMapping: 0 + m_uvLineOffset: 0 + m_geometrySortingOrder: 0 + m_IsTextObjectScaleStatic: 0 + m_VertexBufferAutoSizeReduction: 0 + m_useMaxVisibleDescender: 1 + m_pageToDisplay: 1 + m_margin: {x: 0, y: 0, z: 0, w: 0} + m_isUsingLegacyAnimationComponent: 0 + m_isVolumetricText: 0 + m_hasFontAssetChanged: 0 + m_baseMaterial: {fileID: 0} + m_maskOffset: {x: 0, y: 0, z: 0, w: 0} --- !u!1 &3897920513329603770 GameObject: m_ObjectHideFlags: 0 @@ -235,9 +524,281 @@ GameObject: m_PrefabAsset: {fileID: 0} serializedVersion: 6 m_Component: - - component: {fileID: 6464820431473956226} - - component: {fileID: 6759510068818208879} - - component: {fileID: 9221599780327977756} + - component: {fileID: 6464820431473956226} + - component: {fileID: 6759510068818208879} + - component: {fileID: 9221599780327977756} + m_Layer: 5 + m_Name: Text (TMP) + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &6464820431473956226 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 3897920513329603770} + 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: [] + m_Father: {fileID: 3965463384619871731} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 1, y: 1} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 0, y: 0} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!222 &6759510068818208879 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 3897920513329603770} + m_CullTransparentMesh: 1 +--- !u!114 &9221599780327977756 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 3897920513329603770} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: f4688fdb7df04437aeb418b961361dc5, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_RaycastTarget: 1 + m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} + m_Maskable: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_text: Start + m_isRightToLeft: 0 + m_fontAsset: {fileID: 11400000, guid: 8f586378b4e144a9851e7b34d9b748ee, type: 2} + m_sharedMaterial: {fileID: 2180264, guid: 8f586378b4e144a9851e7b34d9b748ee, type: 2} + m_fontSharedMaterials: [] + m_fontMaterial: {fileID: 0} + m_fontMaterials: [] + m_fontColor32: + serializedVersion: 2 + rgba: 4281479730 + m_fontColor: {r: 0.19607843, g: 0.19607843, b: 0.19607843, a: 1} + m_enableVertexGradient: 0 + m_colorMode: 3 + m_fontColorGradient: + topLeft: {r: 1, g: 1, b: 1, a: 1} + topRight: {r: 1, g: 1, b: 1, a: 1} + bottomLeft: {r: 1, g: 1, b: 1, a: 1} + bottomRight: {r: 1, g: 1, b: 1, a: 1} + m_fontColorGradientPreset: {fileID: 0} + m_spriteAsset: {fileID: 0} + m_tintAllSprites: 0 + m_StyleSheet: {fileID: 0} + m_TextStyleHashCode: -1183493901 + m_overrideHtmlColors: 0 + m_faceColor: + serializedVersion: 2 + rgba: 4294967295 + m_fontSize: 24 + m_fontSizeBase: 24 + m_fontWeight: 400 + m_enableAutoSizing: 0 + m_fontSizeMin: 18 + m_fontSizeMax: 72 + m_fontStyle: 0 + m_HorizontalAlignment: 2 + m_VerticalAlignment: 512 + m_textAlignment: 65535 + m_characterSpacing: 0 + m_wordSpacing: 0 + m_lineSpacing: 0 + m_lineSpacingMax: 0 + m_paragraphSpacing: 0 + m_charWidthMaxAdj: 0 + m_enableWordWrapping: 1 + m_wordWrappingRatios: 0.4 + m_overflowMode: 0 + m_linkedTextComponent: {fileID: 0} + parentLinkedComponent: {fileID: 0} + m_enableKerning: 1 + m_enableExtraPadding: 0 + checkPaddingRequired: 0 + m_isRichText: 1 + m_parseCtrlCharacters: 1 + m_isOrthographic: 1 + m_isCullingEnabled: 0 + m_horizontalMapping: 0 + m_verticalMapping: 0 + m_uvLineOffset: 0 + m_geometrySortingOrder: 0 + m_IsTextObjectScaleStatic: 0 + m_VertexBufferAutoSizeReduction: 0 + m_useMaxVisibleDescender: 1 + m_pageToDisplay: 1 + m_margin: {x: 0, y: 0, z: 0, w: 0} + m_isUsingLegacyAnimationComponent: 0 + m_isVolumetricText: 0 + m_hasFontAssetChanged: 0 + m_baseMaterial: {fileID: 0} + m_maskOffset: {x: 0, y: 0, z: 0, w: 0} +--- !u!1 &4505895459128153241 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 8837604975544357713} + - component: {fileID: 3403719918129872281} + - component: {fileID: 733609914218382619} + m_Layer: 5 + m_Name: CalibrationText + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &8837604975544357713 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 4505895459128153241} + 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: [] + m_Father: {fileID: 4505031865777792410} + m_RootOrder: 0 + 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!222 &3403719918129872281 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 4505895459128153241} + m_CullTransparentMesh: 1 +--- !u!114 &733609914218382619 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 4505895459128153241} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: f4688fdb7df04437aeb418b961361dc5, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_RaycastTarget: 1 + m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} + m_Maskable: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_text: '1. + + Calibrating to Bregma' + m_isRightToLeft: 0 + m_fontAsset: {fileID: 11400000, guid: 8f586378b4e144a9851e7b34d9b748ee, type: 2} + m_sharedMaterial: {fileID: 2180264, guid: 8f586378b4e144a9851e7b34d9b748ee, type: 2} + m_fontSharedMaterials: [] + m_fontMaterial: {fileID: 0} + m_fontMaterials: [] + m_fontColor32: + serializedVersion: 2 + rgba: 4294967295 + m_fontColor: {r: 1, g: 1, b: 1, a: 1} + m_enableVertexGradient: 0 + m_colorMode: 3 + m_fontColorGradient: + topLeft: {r: 1, g: 1, b: 1, a: 1} + topRight: {r: 1, g: 1, b: 1, a: 1} + bottomLeft: {r: 1, g: 1, b: 1, a: 1} + bottomRight: {r: 1, g: 1, b: 1, a: 1} + m_fontColorGradientPreset: {fileID: 0} + m_spriteAsset: {fileID: 0} + m_tintAllSprites: 0 + m_StyleSheet: {fileID: 0} + m_TextStyleHashCode: -1183493901 + m_overrideHtmlColors: 0 + m_faceColor: + serializedVersion: 2 + rgba: 4294967295 + m_fontSize: 40 + m_fontSizeBase: 40 + m_fontWeight: 400 + m_enableAutoSizing: 0 + m_fontSizeMin: 18 + m_fontSizeMax: 72 + m_fontStyle: 0 + m_HorizontalAlignment: 2 + m_VerticalAlignment: 512 + m_textAlignment: 65535 + m_characterSpacing: 0 + m_wordSpacing: 0 + m_lineSpacing: 0 + m_lineSpacingMax: 0 + m_paragraphSpacing: 0 + m_charWidthMaxAdj: 0 + m_enableWordWrapping: 1 + m_wordWrappingRatios: 0.4 + m_overflowMode: 0 + m_linkedTextComponent: {fileID: 0} + parentLinkedComponent: {fileID: 0} + m_enableKerning: 1 + m_enableExtraPadding: 0 + checkPaddingRequired: 0 + m_isRichText: 1 + m_parseCtrlCharacters: 1 + m_isOrthographic: 1 + m_isCullingEnabled: 0 + m_horizontalMapping: 0 + m_verticalMapping: 0 + m_uvLineOffset: 0 + m_geometrySortingOrder: 0 + m_IsTextObjectScaleStatic: 0 + m_VertexBufferAutoSizeReduction: 0 + m_useMaxVisibleDescender: 1 + m_pageToDisplay: 1 + m_margin: {x: 0, y: 0, z: 0, w: 0} + m_isUsingLegacyAnimationComponent: 0 + m_isVolumetricText: 0 + m_hasFontAssetChanged: 0 + m_baseMaterial: {fileID: 0} + m_maskOffset: {x: 0, y: 0, z: 0, w: 0} +--- !u!1 &4898606774794570049 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 3510360387209528734} + - component: {fileID: 8115253745855056602} + - component: {fileID: 402407113449165050} m_Layer: 5 m_Name: Text (TMP) m_TagString: Untagged @@ -245,19 +806,19 @@ GameObject: m_NavMeshLayer: 0 m_StaticEditorFlags: 0 m_IsActive: 1 ---- !u!224 &6464820431473956226 +--- !u!224 &3510360387209528734 RectTransform: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 3897920513329603770} + m_GameObject: {fileID: 4898606774794570049} 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: [] - m_Father: {fileID: 3965463384619871731} + m_Father: {fileID: 3472467024927806868} m_RootOrder: 0 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 0} @@ -265,21 +826,21 @@ RectTransform: m_AnchoredPosition: {x: 0, y: 0} m_SizeDelta: {x: 0, y: 0} m_Pivot: {x: 0.5, y: 0.5} ---- !u!222 &6759510068818208879 +--- !u!222 &8115253745855056602 CanvasRenderer: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 3897920513329603770} + m_GameObject: {fileID: 4898606774794570049} m_CullTransparentMesh: 1 ---- !u!114 &9221599780327977756 +--- !u!114 &402407113449165050 MonoBehaviour: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 3897920513329603770} + m_GameObject: {fileID: 4898606774794570049} m_Enabled: 1 m_EditorHideFlags: 0 m_Script: {fileID: 11500000, guid: f4688fdb7df04437aeb418b961361dc5, type: 3} @@ -293,7 +854,7 @@ MonoBehaviour: m_OnCullStateChanged: m_PersistentCalls: m_Calls: [] - m_text: Start + m_text: Stop m_isRightToLeft: 0 m_fontAsset: {fileID: 11400000, guid: 8f586378b4e144a9851e7b34d9b748ee, type: 2} m_sharedMaterial: {fileID: 2180264, guid: 8f586378b4e144a9851e7b34d9b748ee, type: 2} @@ -362,7 +923,7 @@ MonoBehaviour: m_hasFontAssetChanged: 0 m_baseMaterial: {fileID: 0} m_maskOffset: {x: 0, y: 0, z: 0, w: 0} ---- !u!1 &4898606774794570049 +--- !u!1 &5472673494481345907 GameObject: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} @@ -370,51 +931,51 @@ GameObject: m_PrefabAsset: {fileID: 0} serializedVersion: 6 m_Component: - - component: {fileID: 3510360387209528734} - - component: {fileID: 8115253745855056602} - - component: {fileID: 402407113449165050} + - component: {fileID: 18247630272671149} + - component: {fileID: 6734786462441173058} + - component: {fileID: 7893861323076657493} m_Layer: 5 - m_Name: Text (TMP) + m_Name: RetractingText m_TagString: Untagged m_Icon: {fileID: 0} m_NavMeshLayer: 0 m_StaticEditorFlags: 0 m_IsActive: 1 ---- !u!224 &3510360387209528734 +--- !u!224 &18247630272671149 RectTransform: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 4898606774794570049} + m_GameObject: {fileID: 5472673494481345907} 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: [] - m_Father: {fileID: 3472467024927806868} - m_RootOrder: 0 + m_Father: {fileID: 4505031865777792410} + m_RootOrder: 4 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 0} - m_AnchorMax: {x: 1, y: 1} + 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!222 &8115253745855056602 +--- !u!222 &6734786462441173058 CanvasRenderer: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 4898606774794570049} + m_GameObject: {fileID: 5472673494481345907} m_CullTransparentMesh: 1 ---- !u!114 &402407113449165050 +--- !u!114 &7893861323076657493 MonoBehaviour: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 4898606774794570049} + m_GameObject: {fileID: 5472673494481345907} m_Enabled: 1 m_EditorHideFlags: 0 m_Script: {fileID: 11500000, guid: f4688fdb7df04437aeb418b961361dc5, type: 3} @@ -428,7 +989,9 @@ MonoBehaviour: m_OnCullStateChanged: m_PersistentCalls: m_Calls: [] - m_text: Stop + m_text: '5. + + Retracting Probes' m_isRightToLeft: 0 m_fontAsset: {fileID: 11400000, guid: 8f586378b4e144a9851e7b34d9b748ee, type: 2} m_sharedMaterial: {fileID: 2180264, guid: 8f586378b4e144a9851e7b34d9b748ee, type: 2} @@ -437,8 +1000,8 @@ MonoBehaviour: m_fontMaterials: [] m_fontColor32: serializedVersion: 2 - rgba: 4281479730 - m_fontColor: {r: 0.19607843, g: 0.19607843, b: 0.19607843, a: 1} + rgba: 4294967295 + m_fontColor: {r: 1, g: 1, b: 1, a: 1} m_enableVertexGradient: 0 m_colorMode: 3 m_fontColorGradient: @@ -455,8 +1018,8 @@ MonoBehaviour: m_faceColor: serializedVersion: 2 rgba: 4294967295 - m_fontSize: 24 - m_fontSizeBase: 24 + m_fontSize: 40 + m_fontSizeBase: 40 m_fontWeight: 400 m_enableAutoSizing: 0 m_fontSizeMin: 18 @@ -507,6 +1070,7 @@ GameObject: m_Component: - component: {fileID: 4505031865777792410} - component: {fileID: 1146937742330204303} + - component: {fileID: 2953077092811180941} m_Layer: 5 m_Name: StateGroup m_TagString: Untagged @@ -525,7 +1089,12 @@ RectTransform: m_LocalPosition: {x: 0, y: 0, z: 0} m_LocalScale: {x: 1, y: 1, z: 1} m_ConstrainProportionsScale: 0 - m_Children: [] + m_Children: + - {fileID: 8837604975544357713} + - {fileID: 5147399233535029241} + - {fileID: 1837604378854586354} + - {fileID: 3451964772010717910} + - {fileID: 18247630272671149} m_Father: {fileID: 1445278465348587320} m_RootOrder: 0 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} @@ -554,6 +1123,32 @@ MonoBehaviour: m_FlexibleWidth: -1 m_FlexibleHeight: 3 m_LayoutPriority: 1 +--- !u!114 &2953077092811180941 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 5633408781004299327} + 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: 4 + m_Spacing: 50 + m_ChildForceExpandWidth: 1 + m_ChildForceExpandHeight: 1 + m_ChildControlWidth: 1 + m_ChildControlHeight: 1 + m_ChildScaleWidth: 0 + m_ChildScaleHeight: 0 + m_ReverseArrangement: 0 --- !u!1 &6774747710933269036 GameObject: m_ObjectHideFlags: 0 @@ -735,3 +1330,140 @@ MonoBehaviour: m_OnClick: m_PersistentCalls: m_Calls: [] +--- !u!1 &9184979835841969781 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 3451964772010717910} + - component: {fileID: 9204129830624818436} + - component: {fileID: 3295570320582879773} + m_Layer: 5 + m_Name: InsertionText + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &3451964772010717910 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 9184979835841969781} + 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: [] + m_Father: {fileID: 4505031865777792410} + m_RootOrder: 3 + 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!222 &9204129830624818436 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 9184979835841969781} + m_CullTransparentMesh: 1 +--- !u!114 &3295570320582879773 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 9184979835841969781} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: f4688fdb7df04437aeb418b961361dc5, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_RaycastTarget: 1 + m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} + m_Maskable: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_text: '4. + + Inserting Probes' + m_isRightToLeft: 0 + m_fontAsset: {fileID: 11400000, guid: 8f586378b4e144a9851e7b34d9b748ee, type: 2} + m_sharedMaterial: {fileID: 2180264, guid: 8f586378b4e144a9851e7b34d9b748ee, type: 2} + m_fontSharedMaterials: [] + m_fontMaterial: {fileID: 0} + m_fontMaterials: [] + m_fontColor32: + serializedVersion: 2 + rgba: 4294967295 + m_fontColor: {r: 1, g: 1, b: 1, a: 1} + m_enableVertexGradient: 0 + m_colorMode: 3 + m_fontColorGradient: + topLeft: {r: 1, g: 1, b: 1, a: 1} + topRight: {r: 1, g: 1, b: 1, a: 1} + bottomLeft: {r: 1, g: 1, b: 1, a: 1} + bottomRight: {r: 1, g: 1, b: 1, a: 1} + m_fontColorGradientPreset: {fileID: 0} + m_spriteAsset: {fileID: 0} + m_tintAllSprites: 0 + m_StyleSheet: {fileID: 0} + m_TextStyleHashCode: -1183493901 + m_overrideHtmlColors: 0 + m_faceColor: + serializedVersion: 2 + rgba: 4294967295 + m_fontSize: 40 + m_fontSizeBase: 40 + m_fontWeight: 400 + m_enableAutoSizing: 0 + m_fontSizeMin: 18 + m_fontSizeMax: 72 + m_fontStyle: 0 + m_HorizontalAlignment: 2 + m_VerticalAlignment: 512 + m_textAlignment: 65535 + m_characterSpacing: 0 + m_wordSpacing: 0 + m_lineSpacing: 0 + m_lineSpacingMax: 0 + m_paragraphSpacing: 0 + m_charWidthMaxAdj: 0 + m_enableWordWrapping: 1 + m_wordWrappingRatios: 0.4 + m_overflowMode: 0 + m_linkedTextComponent: {fileID: 0} + parentLinkedComponent: {fileID: 0} + m_enableKerning: 1 + m_enableExtraPadding: 0 + checkPaddingRequired: 0 + m_isRichText: 1 + m_parseCtrlCharacters: 1 + m_isOrthographic: 1 + m_isCullingEnabled: 0 + m_horizontalMapping: 0 + m_verticalMapping: 0 + m_uvLineOffset: 0 + m_geometrySortingOrder: 0 + m_IsTextObjectScaleStatic: 0 + m_VertexBufferAutoSizeReduction: 0 + m_useMaxVisibleDescender: 1 + m_pageToDisplay: 1 + m_margin: {x: 0, y: 0, z: 0, w: 0} + m_isUsingLegacyAnimationComponent: 0 + m_isVolumetricText: 0 + m_hasFontAssetChanged: 0 + m_baseMaterial: {fileID: 0} + m_maskOffset: {x: 0, y: 0, z: 0, w: 0} diff --git a/Assets/Scenes/TrajectoryPlanner.unity b/Assets/Scenes/TrajectoryPlanner.unity index 0f4ee40c..1f76f089 100644 --- a/Assets/Scenes/TrajectoryPlanner.unity +++ b/Assets/Scenes/TrajectoryPlanner.unity @@ -581,11 +581,6 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: 674c3dd0800387342aa2d83aa5da1843, type: 3} m_Name: m_EditorClassIdentifier: ---- !u!1 &728289668 stripped -GameObject: - m_CorrespondingSourceObject: {fileID: 7852855776637929136, guid: 3d86af372ed9f2e41b42b525846d962f, type: 3} - m_PrefabInstance: {fileID: 46940034} - m_PrefabAsset: {fileID: 0} --- !u!1 &745816212 GameObject: m_ObjectHideFlags: 0 @@ -1867,26 +1862,12 @@ MonoBehaviour: m_CorrespondingSourceObject: {fileID: 6854367561162462583, guid: 3d86af372ed9f2e41b42b525846d962f, type: 3} m_PrefabInstance: {fileID: 46940034} m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 728289668} + m_GameObject: {fileID: 0} m_Enabled: 1 m_EditorHideFlags: 0 m_Script: {fileID: 11500000, guid: 1d1472904c7237a449b283ca843dc7a2, type: 3} m_Name: m_EditorClassIdentifier: ---- !u!114 &1572420111 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 728289668} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: 78f91eb601d18cf4ca076cc899036bd8, type: 3} - m_Name: - m_EditorClassIdentifier: - _startButton: {fileID: 0} - _stopButton: {fileID: 0} --- !u!114 &1593103045 stripped MonoBehaviour: m_CorrespondingSourceObject: {fileID: 2443417254122746566, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} @@ -3580,6 +3561,30 @@ PrefabInstance: propertyPath: m_AnchoredPosition.x value: -55.600006 objectReference: {fileID: 0} + - target: {fileID: 526666674236384042, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} + propertyPath: m_AnchorMax.y + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 526666674236384042, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} + propertyPath: m_AnchorMin.y + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 526666674236384042, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} + propertyPath: m_SizeDelta.x + value: 391.04404 + objectReference: {fileID: 0} + - target: {fileID: 526666674236384042, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} + propertyPath: m_SizeDelta.y + value: 409.16998 + objectReference: {fileID: 0} + - target: {fileID: 526666674236384042, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} + propertyPath: m_AnchoredPosition.x + value: 559.25446 + objectReference: {fileID: 0} + - target: {fileID: 526666674236384042, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} + propertyPath: m_AnchoredPosition.y + value: -204.58499 + objectReference: {fileID: 0} - target: {fileID: 568637148373482672, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} propertyPath: m_AnchorMax.y value: 1 @@ -4042,27 +4047,27 @@ PrefabInstance: objectReference: {fileID: 341190943874437990} - target: {fileID: 1829180218217638352, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} propertyPath: m_AnchorMax.y - value: 0 + value: 1 objectReference: {fileID: 0} - target: {fileID: 1829180218217638352, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} propertyPath: m_AnchorMin.y - value: 0 + value: 1 objectReference: {fileID: 0} - target: {fileID: 1829180218217638352, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} propertyPath: m_SizeDelta.x - value: 0 + value: 1700 objectReference: {fileID: 0} - target: {fileID: 1829180218217638352, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} propertyPath: m_SizeDelta.y - value: 0 + value: 90.83 objectReference: {fileID: 0} - target: {fileID: 1829180218217638352, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} propertyPath: m_AnchoredPosition.x - value: 0 + value: 850 objectReference: {fileID: 0} - target: {fileID: 1829180218217638352, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} propertyPath: m_AnchoredPosition.y - value: 0 + value: -454.585 objectReference: {fileID: 0} - target: {fileID: 1890578862338769638, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} propertyPath: m_AnchorMax.y @@ -4264,6 +4269,22 @@ PrefabInstance: propertyPath: m_AnchoredPosition.y value: -222.64752 objectReference: {fileID: 0} + - target: {fileID: 2480998461177579480, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} + propertyPath: m_AnchorMax.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 2480998461177579480, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} + propertyPath: m_AnchorMin.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 2480998461177579480, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} + propertyPath: m_AnchoredPosition.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 2480998461177579480, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} + propertyPath: m_AnchoredPosition.y + value: 0 + objectReference: {fileID: 0} - target: {fileID: 2510918406663091935, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} propertyPath: m_AnchorMax.x value: 0 @@ -5144,6 +5165,30 @@ PrefabInstance: propertyPath: m_AnchorMin.y value: 1 objectReference: {fileID: 0} + - target: {fileID: 4216880249697705858, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} + propertyPath: m_AnchorMax.y + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 4216880249697705858, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} + propertyPath: m_AnchorMin.y + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 4216880249697705858, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} + propertyPath: m_SizeDelta.x + value: 313.73242 + objectReference: {fileID: 0} + - target: {fileID: 4216880249697705858, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} + propertyPath: m_SizeDelta.y + value: 409.16998 + objectReference: {fileID: 0} + - target: {fileID: 4216880249697705858, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} + propertyPath: m_AnchoredPosition.x + value: 156.86621 + objectReference: {fileID: 0} + - target: {fileID: 4216880249697705858, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} + propertyPath: m_AnchoredPosition.y + value: -204.58499 + objectReference: {fileID: 0} - target: {fileID: 4218167276952692149, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} propertyPath: m_AnchoredPosition.x value: -48.700012 @@ -5448,6 +5493,30 @@ PrefabInstance: propertyPath: m_SizeDelta.x value: -17 objectReference: {fileID: 0} + - target: {fileID: 4638972357698478462, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} + propertyPath: m_AnchorMax.y + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 4638972357698478462, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} + propertyPath: m_AnchorMin.y + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 4638972357698478462, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} + propertyPath: m_SizeDelta.x + value: 258.94788 + objectReference: {fileID: 0} + - target: {fileID: 4638972357698478462, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} + propertyPath: m_SizeDelta.y + value: 409.16998 + objectReference: {fileID: 0} + - target: {fileID: 4638972357698478462, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} + propertyPath: m_AnchoredPosition.x + value: 1570.5261 + objectReference: {fileID: 0} + - target: {fileID: 4638972357698478462, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} + propertyPath: m_AnchoredPosition.y + value: -204.58499 + objectReference: {fileID: 0} - target: {fileID: 4724898486047142119, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} propertyPath: m_AnchorMax.y value: 1 @@ -5960,6 +6029,14 @@ PrefabInstance: propertyPath: m_OnValueChanged.m_PersistentCalls.m_Calls.Array.data[0].m_TargetAssemblyTypeName value: ChannelMapManager, trajectoryplanner.probe objectReference: {fileID: 0} + - target: {fileID: 6065941617704141802, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} + propertyPath: m_IsActive + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 6065941617704141803, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} + propertyPath: m_SizeDelta.x + value: 1700 + objectReference: {fileID: 0} - target: {fileID: 6065941617837916594, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} propertyPath: m_AnchorMax.y value: 0 @@ -6176,6 +6253,30 @@ PrefabInstance: propertyPath: m_OnClick.m_PersistentCalls.m_Calls.Array.data[0].m_Arguments.m_ObjectArgumentAssemblyTypeName value: UnityEngine.Object, UnityEngine objectReference: {fileID: 0} + - target: {fileID: 6458267049939974945, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} + propertyPath: m_AnchorMax.y + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 6458267049939974945, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} + propertyPath: m_AnchorMin.y + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 6458267049939974945, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} + propertyPath: m_SizeDelta.x + value: 300.59705 + objectReference: {fileID: 0} + - target: {fileID: 6458267049939974945, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} + propertyPath: m_SizeDelta.y + value: 409.16998 + objectReference: {fileID: 0} + - target: {fileID: 6458267049939974945, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} + propertyPath: m_AnchoredPosition.x + value: 955.075 + objectReference: {fileID: 0} + - target: {fileID: 6458267049939974945, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} + propertyPath: m_AnchoredPosition.y + value: -204.58499 + objectReference: {fileID: 0} - target: {fileID: 6514980532054408230, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} propertyPath: m_AnchorMax.y value: 0 @@ -6812,6 +6913,30 @@ PrefabInstance: propertyPath: m_AnchoredPosition.y value: 0 objectReference: {fileID: 0} + - target: {fileID: 8054674137374801413, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} + propertyPath: m_AnchorMax.y + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 8054674137374801413, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} + propertyPath: m_AnchorMin.y + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 8054674137374801413, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} + propertyPath: m_SizeDelta.x + value: 235.67854 + objectReference: {fileID: 0} + - target: {fileID: 8054674137374801413, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} + propertyPath: m_SizeDelta.y + value: 409.16998 + objectReference: {fileID: 0} + - target: {fileID: 8054674137374801413, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} + propertyPath: m_AnchoredPosition.x + value: 1273.2128 + objectReference: {fileID: 0} + - target: {fileID: 8054674137374801413, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} + propertyPath: m_AnchoredPosition.y + value: -204.58499 + objectReference: {fileID: 0} - target: {fileID: 8122223018216829504, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} propertyPath: m_AnchorMax.y value: 1 @@ -7330,27 +7455,27 @@ PrefabInstance: objectReference: {fileID: 0} - target: {fileID: 9125755490035067209, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} propertyPath: m_AnchorMax.y - value: 0 + value: 1 objectReference: {fileID: 0} - target: {fileID: 9125755490035067209, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} propertyPath: m_AnchorMin.y - value: 0 + value: 1 objectReference: {fileID: 0} - target: {fileID: 9125755490035067209, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} propertyPath: m_SizeDelta.x - value: 0 + value: 1700 objectReference: {fileID: 0} - target: {fileID: 9125755490035067209, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} propertyPath: m_SizeDelta.y - value: 0 + value: 409.16998 objectReference: {fileID: 0} - target: {fileID: 9125755490035067209, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} propertyPath: m_AnchoredPosition.x - value: 0 + value: 850 objectReference: {fileID: 0} - target: {fileID: 9125755490035067209, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} propertyPath: m_AnchoredPosition.y - value: 0 + value: -204.58499 objectReference: {fileID: 0} - target: {fileID: 9201160669940680994, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} propertyPath: m_AnchorMax.y From 34a6f3f6e046e5c09db70b25329784c13360419e Mon Sep 17 00:00:00 2001 From: Kenneth Yang Date: Tue, 7 Nov 2023 10:42:50 -0800 Subject: [PATCH 51/78] Validate connection and show start --- .../UI/EphysCopilot/CopilotDemoPanel.prefab | 4 +-- .../SettingsMenu/Menus/EphysLinkMenu.prefab | 3 +- Assets/Scenes/TrajectoryPlanner.unity | 31 ++++++++++++------- .../UI/EphysCopilot/CopilotDemoHandler.cs | 22 ++++++------- .../UI/EphysLinkSettings/EphysLinkSettings.cs | 8 +++++ .../Scripts/TrajectoryPlanner/UI/UIManager.cs | 6 ++++ 6 files changed, 48 insertions(+), 26 deletions(-) diff --git a/Assets/Prefabs/UI/EphysCopilot/CopilotDemoPanel.prefab b/Assets/Prefabs/UI/EphysCopilot/CopilotDemoPanel.prefab index 1c6b600e..eb60ec1b 100644 --- a/Assets/Prefabs/UI/EphysCopilot/CopilotDemoPanel.prefab +++ b/Assets/Prefabs/UI/EphysCopilot/CopilotDemoPanel.prefab @@ -240,8 +240,8 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: 78f91eb601d18cf4ca076cc899036bd8, type: 3} m_Name: m_EditorClassIdentifier: - _startButton: {fileID: 0} - _stopButton: {fileID: 0} + _startButton: {fileID: 389895556494180254} + _stopButton: {fileID: 8185988774562960974} --- !u!1 &1701132444679105691 GameObject: m_ObjectHideFlags: 0 diff --git a/Assets/Prefabs/UI/SettingsMenu/Menus/EphysLinkMenu.prefab b/Assets/Prefabs/UI/SettingsMenu/Menus/EphysLinkMenu.prefab index 24cfe853..28151490 100644 --- a/Assets/Prefabs/UI/SettingsMenu/Menus/EphysLinkMenu.prefab +++ b/Assets/Prefabs/UI/SettingsMenu/Menus/EphysLinkMenu.prefab @@ -2546,6 +2546,7 @@ MonoBehaviour: _manipulatorList: {fileID: 7994738088484906322} _manipulatorConnectionPanelPrefab: {fileID: 8830734852478451222, guid: 19384593a545a404bbe8bd298659df46, type: 3} _copilotToggle: {fileID: 6762999849811435235} + _copilotDemoToggle: {fileID: 282356076181514970} --- !u!114 &7858764217905313557 MonoBehaviour: m_ObjectHideFlags: 0 @@ -2966,7 +2967,7 @@ MonoBehaviour: - m_Target: {fileID: 4412914667077470364} m_TargetAssemblyTypeName: TrajectoryPlanner.UI.EphysLinkSettings.EphysLinkSettings, trajectoryplanner.ui.ephyslinksettings - m_MethodName: ToggleCopilotPanel + m_MethodName: ToggleCopilotDemoPanel m_Mode: 0 m_Arguments: m_ObjectArgument: {fileID: 0} diff --git a/Assets/Scenes/TrajectoryPlanner.unity b/Assets/Scenes/TrajectoryPlanner.unity index 1f76f089..08d666d3 100644 --- a/Assets/Scenes/TrajectoryPlanner.unity +++ b/Assets/Scenes/TrajectoryPlanner.unity @@ -2387,15 +2387,15 @@ PrefabInstance: objectReference: {fileID: 1703646459} - target: {fileID: 341190943836035196, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} propertyPath: m_AnchorMax.y - value: 1 + value: 0 objectReference: {fileID: 0} - target: {fileID: 341190943836035196, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} propertyPath: m_AnchorMin.y - value: 1 + value: 0 objectReference: {fileID: 0} - target: {fileID: 341190943836035196, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} propertyPath: m_AnchoredPosition.x - value: 169.88 + value: 0 objectReference: {fileID: 0} - target: {fileID: 341190943836276264, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} propertyPath: onValueChanged.m_PersistentCalls.m_Calls.Array.data[0].m_Target @@ -2535,19 +2535,19 @@ PrefabInstance: objectReference: {fileID: 1445581475} - target: {fileID: 341190944034978748, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} propertyPath: m_AnchorMax.y - value: 1 + value: 0 objectReference: {fileID: 0} - target: {fileID: 341190944034978748, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} propertyPath: m_AnchorMin.y - value: 1 + value: 0 objectReference: {fileID: 0} - target: {fileID: 341190944034978748, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} propertyPath: m_AnchoredPosition.x - value: 354.84 + value: 0 objectReference: {fileID: 0} - target: {fileID: 341190944034978748, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} propertyPath: m_AnchoredPosition.y - value: -15 + value: 0 objectReference: {fileID: 0} - target: {fileID: 341190944071593138, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} propertyPath: m_AnchorMax.x @@ -2815,19 +2815,19 @@ PrefabInstance: objectReference: {fileID: 0} - target: {fileID: 341190944410943211, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} propertyPath: m_AnchorMax.y - value: 1 + value: 0 objectReference: {fileID: 0} - target: {fileID: 341190944410943211, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} propertyPath: m_AnchorMin.y - value: 1 + value: 0 objectReference: {fileID: 0} - target: {fileID: 341190944410943211, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} propertyPath: m_AnchoredPosition.x - value: 384.91998 + value: 0 objectReference: {fileID: 0} - target: {fileID: 341190944410943211, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} propertyPath: m_AnchoredPosition.y - value: -15 + value: 0 objectReference: {fileID: 0} - target: {fileID: 341190944411999430, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} propertyPath: m_AnchorMax.y @@ -4629,6 +4629,10 @@ PrefabInstance: propertyPath: _whiteUIText.Array.data[2] value: objectReference: {fileID: 382584097} + - target: {fileID: 3336044886673126097, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} + propertyPath: _copilotDemoPanelGameObject + value: + objectReference: {fileID: 341190943874437992} - target: {fileID: 3336044886673126097, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} propertyPath: _ephysCopilotPanelGameObject value: @@ -7539,6 +7543,11 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: 7b743370ac3e4ec2a1668f5455a8ef8a, type: 3} m_Name: m_EditorClassIdentifier: +--- !u!1 &341190943874437992 stripped +GameObject: + m_CorrespondingSourceObject: {fileID: 6065941617704141802, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} + m_PrefabInstance: {fileID: 341190943874437988} + m_PrefabAsset: {fileID: 0} --- !u!1001 &1302158968208938923 PrefabInstance: m_ObjectHideFlags: 0 diff --git a/Assets/Scripts/TrajectoryPlanner/UI/EphysCopilot/CopilotDemoHandler.cs b/Assets/Scripts/TrajectoryPlanner/UI/EphysCopilot/CopilotDemoHandler.cs index 52b7f08d..9f346320 100644 --- a/Assets/Scripts/TrajectoryPlanner/UI/EphysCopilot/CopilotDemoHandler.cs +++ b/Assets/Scripts/TrajectoryPlanner/UI/EphysCopilot/CopilotDemoHandler.cs @@ -24,9 +24,9 @@ internal struct ManipulatorDataJson } /// - /// Angle: Yaw, Pitch, Roll - /// Idle: AP, ML, DV - /// Insertion: AP, ML, DV, Depth + /// Angle: Yaw, Pitch, Roll + /// Idle: AP, ML, DV + /// Insertion: AP, ML, DV, Depth /// internal struct ManipulatorData { @@ -45,12 +45,12 @@ public class CopilotDemoHandler : MonoBehaviour #endregion #region Properties - - private Dictionary _demoManipulatorToData = new(); + + private readonly Dictionary _demoManipulatorToData = new(); #endregion - private void Start() + private void OnEnable() { // Parse JSON var jsonString = File.ReadAllText(Application.streamingAssetsPath + "/copilot_demo.json"); @@ -67,20 +67,18 @@ private void Start() InsertionPos = new Vector4(manipulatorData.insertion[0], manipulatorData.insertion[1], manipulatorData.insertion[2], manipulatorData.insertion[3]) }; - + // Match to manipulator var matchingManipulator = ProbeManager.Instances.FirstOrDefault( manager => manager.IsEphysLinkControlled && IsCoterminal(manager.ProbeController.Insertion.angles, convertedData.Angle)); // If there is a matching manipulator, keep track of it - if (matchingManipulator!= null) - { - _demoManipulatorToData.Add(matchingManipulator, convertedData); - } + if (matchingManipulator != null) _demoManipulatorToData.Add(matchingManipulator, convertedData); } - print("Matching manipulators: "+_demoManipulatorToData.Count); + // Show start button if there are manipulators to control + _startButton.SetActive(_demoManipulatorToData.Count > 0); } #region Helper functions diff --git a/Assets/Scripts/TrajectoryPlanner/UI/EphysLinkSettings/EphysLinkSettings.cs b/Assets/Scripts/TrajectoryPlanner/UI/EphysLinkSettings/EphysLinkSettings.cs index f7359f94..384e00bd 100644 --- a/Assets/Scripts/TrajectoryPlanner/UI/EphysLinkSettings/EphysLinkSettings.cs +++ b/Assets/Scripts/TrajectoryPlanner/UI/EphysLinkSettings/EphysLinkSettings.cs @@ -26,6 +26,7 @@ public class EphysLinkSettings : MonoBehaviour [SerializeField] private GameObject _manipulatorList; [SerializeField] private GameObject _manipulatorConnectionPanelPrefab; [SerializeField] private Toggle _copilotToggle; + [SerializeField] private Toggle _copilotDemoToggle; private UIManager _uiManager; @@ -86,6 +87,7 @@ private void UpdateManipulatorPanels() { // Default Copilot to be disabled unless the right manipulator type is found _copilotToggle.interactable = false; + _copilotDemoToggle.interactable = false; if (CommunicationManager.Instance.IsConnected) { @@ -93,6 +95,7 @@ private void UpdateManipulatorPanels() { // Enable Copilot button if using Sensapex or New Scale _copilotToggle.interactable = numAxes > 0; + _copilotDemoToggle.interactable = numAxes > 0; // Keep track of handled manipulator panels var handledManipulatorIds = new HashSet(); @@ -215,6 +218,11 @@ public void ToggleCopilotPanel(bool isEnabled) _uiManager.EnableEphysCopilotPanel(isEnabled); } + public void ToggleCopilotDemoPanel(bool isEnabled) + { + _uiManager.EnableCopilotDemoPanel(isEnabled); + } + public void InvokeShouldUpdateProbesListEvent() { ShouldUpdateProbesListEvent.Invoke(); diff --git a/Assets/Scripts/TrajectoryPlanner/UI/UIManager.cs b/Assets/Scripts/TrajectoryPlanner/UI/UIManager.cs index 8a8e6921..12360a45 100644 --- a/Assets/Scripts/TrajectoryPlanner/UI/UIManager.cs +++ b/Assets/Scripts/TrajectoryPlanner/UI/UIManager.cs @@ -18,6 +18,7 @@ public class UIManager : MonoBehaviour [SerializeField] private List _whiteUIText; [SerializeField] private GameObject _ephysCopilotPanelGameObject; + [SerializeField] private GameObject _copilotDemoPanelGameObject; [SerializeField] private GameObject _settingsPanel; #endregion @@ -58,6 +59,11 @@ public void EnableEphysCopilotPanel(bool enable = true) _ephysCopilotPanelGameObject.transform.localScale = enable ? Vector3.one : Vector3.zero; } + public void EnableCopilotDemoPanel(bool enable = true) + { + _copilotDemoPanelGameObject.SetActive(enable); + } + public void SetBackgroundWhite(bool state) { if (state) From 4db6b7494e273515a45ffccd76dade12e45a70be Mon Sep 17 00:00:00 2001 From: Kenneth Yang Date: Tue, 7 Nov 2023 12:32:22 -0800 Subject: [PATCH 52/78] Move to idle --- .../UI/EphysCopilot/CopilotDemoPanel.prefab | 15 +- .../UI/EphysCopilot/CopilotDemoHandler.cs | 202 ++++++++++++++++-- 2 files changed, 203 insertions(+), 14 deletions(-) diff --git a/Assets/Prefabs/UI/EphysCopilot/CopilotDemoPanel.prefab b/Assets/Prefabs/UI/EphysCopilot/CopilotDemoPanel.prefab index eb60ec1b..16e20134 100644 --- a/Assets/Prefabs/UI/EphysCopilot/CopilotDemoPanel.prefab +++ b/Assets/Prefabs/UI/EphysCopilot/CopilotDemoPanel.prefab @@ -121,7 +121,20 @@ MonoBehaviour: m_TargetGraphic: {fileID: 6192789025202254326} m_OnClick: m_PersistentCalls: - m_Calls: [] + m_Calls: + - m_Target: {fileID: 3584326755053723041} + m_TargetAssemblyTypeName: TrajectoryPlanner.UI.EphysCopilot.CopilotDemoHandler, + trajectoryplanner.ui.ephyscopilot + m_MethodName: OnStartPressed + m_Mode: 1 + m_Arguments: + m_ObjectArgument: {fileID: 0} + m_ObjectArgumentAssemblyTypeName: UnityEngine.Object, UnityEngine + m_IntArgument: 0 + m_FloatArgument: 0 + m_StringArgument: + m_BoolArgument: 0 + m_CallState: 2 --- !u!1 &1445278465348587321 GameObject: m_ObjectHideFlags: 0 diff --git a/Assets/Scripts/TrajectoryPlanner/UI/EphysCopilot/CopilotDemoHandler.cs b/Assets/Scripts/TrajectoryPlanner/UI/EphysCopilot/CopilotDemoHandler.cs index 9f346320..5cd600a9 100644 --- a/Assets/Scripts/TrajectoryPlanner/UI/EphysCopilot/CopilotDemoHandler.cs +++ b/Assets/Scripts/TrajectoryPlanner/UI/EphysCopilot/CopilotDemoHandler.cs @@ -1,12 +1,18 @@ using System; using System.Collections.Generic; +using System.Diagnostics; using System.Diagnostics.CodeAnalysis; using System.IO; using System.Linq; +using EphysLink; +using TrajectoryPlanner.Probes; using UnityEngine; +using Debug = UnityEngine.Debug; namespace TrajectoryPlanner.UI.EphysCopilot { + #region Structures + [Serializable] [SuppressMessage("ReSharper", "InconsistentNaming")] internal struct DemoDataJson @@ -31,12 +37,33 @@ internal struct ManipulatorDataJson internal struct ManipulatorData { public Vector3 Angle; - public Vector3 IdlePos; - public Vector4 InsertionPos; + public Vector4 IdlePos; + public Vector4 DuraPos; + public float Depth; } + internal enum ManipulatorState + { + Idle, + Calibrated, + AtEntryCoordinate, + AtDura, + Inserted, + Retracted, + Traveling + } + + #endregion + + public class CopilotDemoHandler : MonoBehaviour { + #region Constants + + private const long PAUSE_TIME = 1000; + + #endregion + #region Components [SerializeField] private GameObject _startButton; @@ -47,9 +74,12 @@ public class CopilotDemoHandler : MonoBehaviour #region Properties private readonly Dictionary _demoManipulatorToData = new(); + private readonly Dictionary _manipulatorToStates = new(); #endregion + #region Unity + private void OnEnable() { // Parse JSON @@ -59,36 +89,182 @@ private void OnEnable() // Convert to ManipulatorData and match with manipulator foreach (var manipulatorData in data.data) { + var convertedAngle = new Vector3(manipulatorData.angle[0], manipulatorData.angle[1], + manipulatorData.angle[2]); + + // Match to manipulator + var matchingManipulator = ProbeManager.Instances.FirstOrDefault( + manager => manager.IsEphysLinkControlled && + IsCoterminal(manager.ProbeController.Insertion.angles, convertedAngle)); + + // Skip if there are no matching manipulators + if (matchingManipulator == null) continue; + // Convert data var convertedData = new ManipulatorData { - Angle = new Vector3(manipulatorData.angle[0], manipulatorData.angle[1], manipulatorData.angle[2]), - IdlePos = new Vector3(manipulatorData.idle[0], manipulatorData.idle[1], manipulatorData.idle[2]), - InsertionPos = new Vector4(manipulatorData.insertion[0], manipulatorData.insertion[1], - manipulatorData.insertion[2], manipulatorData.insertion[3]) + Angle = convertedAngle, + IdlePos = + matchingManipulator.ManipulatorBehaviorController.ConvertInsertionAPMLDVToManipulatorPosition( + new Vector3(manipulatorData.idle[0], manipulatorData.idle[1], manipulatorData.idle[2]) / + 1000f), + DuraPos = + matchingManipulator.ManipulatorBehaviorController.ConvertInsertionAPMLDVToManipulatorPosition( + new Vector3(manipulatorData.insertion[0], manipulatorData.insertion[1], + manipulatorData.insertion[2]) / 1000f), + Depth = manipulatorData.insertion[3] / 1000f }; - // Match to manipulator - var matchingManipulator = ProbeManager.Instances.FirstOrDefault( - manager => manager.IsEphysLinkControlled && - IsCoterminal(manager.ProbeController.Insertion.angles, convertedData.Angle)); + _demoManipulatorToData.Add(matchingManipulator, convertedData); - // If there is a matching manipulator, keep track of it - if (matchingManipulator != null) _demoManipulatorToData.Add(matchingManipulator, convertedData); + // Default to traveling state on setup (will be moving to Idle soon) + _manipulatorToStates.Add(matchingManipulator, ManipulatorState.Traveling); } - + // Show start button if there are manipulators to control _startButton.SetActive(_demoManipulatorToData.Count > 0); } + private void Update() + { + if (_manipulatorToStates.Values.All(state => state == ManipulatorState.Idle)) + { + // Chill for a bit + SpinTimer(); + + // Run Calibration + Calibrate(); + } + } + + #endregion + + #region UI Functions + + public void OnStartPressed() + { + // Set all manipulators to can write + var manipulatorIndex = 0; + SetCanWrite(_demoManipulatorToData.Keys.ToList()[manipulatorIndex]); + return; + + void SetCanWrite(ProbeManager manipulator) + { + CommunicationManager.Instance.SetCanWrite(manipulator.ManipulatorBehaviorController.ManipulatorID, true, + 100, + _ => + { + if (++manipulatorIndex < _demoManipulatorToData.Count) + SetCanWrite(_demoManipulatorToData.Keys.ToList()[manipulatorIndex]); + else + ActuallyStart(); + }); + } + + void ActuallyStart() + { + // Swap start and stop buttons + _startButton.SetActive(false); + _stopButton.SetActive(true); + + // Move to idle position + foreach (var manipulatorToData in _demoManipulatorToData) + { + print(manipulatorToData.Key.name + " is traveling to Idle"); + _manipulatorToStates[manipulatorToData.Key] = ManipulatorState.Traveling; + CommunicationManager.Instance.GotoPos( + manipulatorToData.Key.ManipulatorBehaviorController.ManipulatorID, + manipulatorToData.Value.IdlePos, ManipulatorBehaviorController.AUTOMATIC_MOVEMENT_SPEED, + _ => _manipulatorToStates[manipulatorToData.Key] = ManipulatorState.Idle, Debug.LogError); + } + } + } + + public void OnStopPressed() + { + CommunicationManager.Instance.Stop(_ => print("Stopped")); + } + + #endregion + + #region Movement Functions + + private void Calibrate() + { + SetAllToTraveling(); + + var manipulatorIndex = 0; + CalibrateManipulator(_demoManipulatorToData.Keys.ToList()[manipulatorIndex]); + return; + + void CalibrateManipulator(ProbeManager manipulator) + { + var manipulatorBehaviorController = manipulator.ManipulatorBehaviorController; + + // Goto bregma + CommunicationManager.Instance.GotoPos(manipulatorBehaviorController.ManipulatorID, + manipulatorBehaviorController.ZeroCoordinateOffset, + ManipulatorBehaviorController.AUTOMATIC_MOVEMENT_SPEED, + _ => + { + SpinTimer(); + + // Come back to idle + CommunicationManager.Instance.GotoPos(manipulatorBehaviorController.ManipulatorID, + _demoManipulatorToData[manipulator].IdlePos, + ManipulatorBehaviorController.AUTOMATIC_MOVEMENT_SPEED, + _ => + { + SpinTimer(); + + // Complete and start next manipulator + _manipulatorToStates[manipulator] = ManipulatorState.Calibrated; + if (++manipulatorIndex < _demoManipulatorToData.Count) + CalibrateManipulator(_demoManipulatorToData.Keys.ToList()[manipulatorIndex]); + }, Debug.LogError); + }, Debug.LogError); + } + } + + #endregion + #region Helper functions + /// + /// Determine if two Vector3 angles are coterminal + /// + /// one Vector3 angle + /// another Vector3 angle + /// private static bool IsCoterminal(Vector3 first, Vector3 second) { return Mathf.Abs(first.x - second.x) % 360 < 0.01f && Mathf.Abs(first.y - second.y) % 360 < 0.01f && Mathf.Abs(first.z - second.z) % 360 < 0.01f; } + /// + /// Basic spin timer + /// + /// Timer length in milliseconds + private static void SpinTimer(long durationMilliseconds = PAUSE_TIME) + { + var stopwatch = new Stopwatch(); + stopwatch.Start(); + while (stopwatch.ElapsedMilliseconds < durationMilliseconds) + { + // Spin + } + } + + /// + /// Set all manipulator states to Traveling + /// + private void SetAllToTraveling() + { + foreach (var manipulatorData in _demoManipulatorToData) + _manipulatorToStates[manipulatorData.Key] = ManipulatorState.Traveling; + } + #endregion } } \ No newline at end of file From 5343666431040b4d8544fa683822d90796047158 Mon Sep 17 00:00:00 2001 From: Kenneth Yang Date: Tue, 7 Nov 2023 12:59:46 -0800 Subject: [PATCH 53/78] Runs calibration, stop button does something --- .../UI/EphysCopilot/CopilotDemoPanel.prefab | 17 ++++++++++++-- Assets/Scenes/TrajectoryPlanner.unity | 22 +++++++++---------- .../UI/EphysCopilot/CopilotDemoHandler.cs | 12 +++++++--- 3 files changed, 35 insertions(+), 16 deletions(-) diff --git a/Assets/Prefabs/UI/EphysCopilot/CopilotDemoPanel.prefab b/Assets/Prefabs/UI/EphysCopilot/CopilotDemoPanel.prefab index 16e20134..db9ffd9e 100644 --- a/Assets/Prefabs/UI/EphysCopilot/CopilotDemoPanel.prefab +++ b/Assets/Prefabs/UI/EphysCopilot/CopilotDemoPanel.prefab @@ -18,7 +18,7 @@ GameObject: m_Icon: {fileID: 0} m_NavMeshLayer: 0 m_StaticEditorFlags: 0 - m_IsActive: 1 + m_IsActive: 0 --- !u!224 &3965463384619871731 RectTransform: m_ObjectHideFlags: 0 @@ -1342,7 +1342,20 @@ MonoBehaviour: m_TargetGraphic: {fileID: 8615624641168382821} m_OnClick: m_PersistentCalls: - m_Calls: [] + m_Calls: + - m_Target: {fileID: 3584326755053723041} + m_TargetAssemblyTypeName: TrajectoryPlanner.UI.EphysCopilot.CopilotDemoHandler, + trajectoryplanner.ui.ephyscopilot + m_MethodName: OnStopPressed + m_Mode: 1 + m_Arguments: + m_ObjectArgument: {fileID: 0} + m_ObjectArgumentAssemblyTypeName: UnityEngine.Object, UnityEngine + m_IntArgument: 0 + m_FloatArgument: 0 + m_StringArgument: + m_BoolArgument: 0 + m_CallState: 2 --- !u!1 &9184979835841969781 GameObject: m_ObjectHideFlags: 0 diff --git a/Assets/Scenes/TrajectoryPlanner.unity b/Assets/Scenes/TrajectoryPlanner.unity index 08d666d3..19443c93 100644 --- a/Assets/Scenes/TrajectoryPlanner.unity +++ b/Assets/Scenes/TrajectoryPlanner.unity @@ -2387,15 +2387,15 @@ PrefabInstance: objectReference: {fileID: 1703646459} - target: {fileID: 341190943836035196, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} propertyPath: m_AnchorMax.y - value: 0 + value: 1 objectReference: {fileID: 0} - target: {fileID: 341190943836035196, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} propertyPath: m_AnchorMin.y - value: 0 + value: 1 objectReference: {fileID: 0} - target: {fileID: 341190943836035196, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} propertyPath: m_AnchoredPosition.x - value: 0 + value: 169.88 objectReference: {fileID: 0} - target: {fileID: 341190943836276264, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} propertyPath: onValueChanged.m_PersistentCalls.m_Calls.Array.data[0].m_Target @@ -2535,19 +2535,19 @@ PrefabInstance: objectReference: {fileID: 1445581475} - target: {fileID: 341190944034978748, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} propertyPath: m_AnchorMax.y - value: 0 + value: 1 objectReference: {fileID: 0} - target: {fileID: 341190944034978748, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} propertyPath: m_AnchorMin.y - value: 0 + value: 1 objectReference: {fileID: 0} - target: {fileID: 341190944034978748, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} propertyPath: m_AnchoredPosition.x - value: 0 + value: 354.84 objectReference: {fileID: 0} - target: {fileID: 341190944034978748, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} propertyPath: m_AnchoredPosition.y - value: 0 + value: -15 objectReference: {fileID: 0} - target: {fileID: 341190944071593138, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} propertyPath: m_AnchorMax.x @@ -2815,19 +2815,19 @@ PrefabInstance: objectReference: {fileID: 0} - target: {fileID: 341190944410943211, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} propertyPath: m_AnchorMax.y - value: 0 + value: 1 objectReference: {fileID: 0} - target: {fileID: 341190944410943211, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} propertyPath: m_AnchorMin.y - value: 0 + value: 1 objectReference: {fileID: 0} - target: {fileID: 341190944410943211, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} propertyPath: m_AnchoredPosition.x - value: 0 + value: 384.91998 objectReference: {fileID: 0} - target: {fileID: 341190944410943211, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} propertyPath: m_AnchoredPosition.y - value: 0 + value: -15 objectReference: {fileID: 0} - target: {fileID: 341190944411999430, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} propertyPath: m_AnchorMax.y diff --git a/Assets/Scripts/TrajectoryPlanner/UI/EphysCopilot/CopilotDemoHandler.cs b/Assets/Scripts/TrajectoryPlanner/UI/EphysCopilot/CopilotDemoHandler.cs index 5cd600a9..1cc6b84d 100644 --- a/Assets/Scripts/TrajectoryPlanner/UI/EphysCopilot/CopilotDemoHandler.cs +++ b/Assets/Scripts/TrajectoryPlanner/UI/EphysCopilot/CopilotDemoHandler.cs @@ -60,6 +60,7 @@ public class CopilotDemoHandler : MonoBehaviour { #region Constants + private const float OUTSIDE_MOVEMENT_SPEED = 1f; private const long PAUSE_TIME = 1000; #endregion @@ -129,6 +130,7 @@ private void Update() { if (_manipulatorToStates.Values.All(state => state == ManipulatorState.Idle)) { + print("All manipulators are at idle"); // Chill for a bit SpinTimer(); @@ -174,7 +176,7 @@ void ActuallyStart() _manipulatorToStates[manipulatorToData.Key] = ManipulatorState.Traveling; CommunicationManager.Instance.GotoPos( manipulatorToData.Key.ManipulatorBehaviorController.ManipulatorID, - manipulatorToData.Value.IdlePos, ManipulatorBehaviorController.AUTOMATIC_MOVEMENT_SPEED, + manipulatorToData.Value.IdlePos, OUTSIDE_MOVEMENT_SPEED, _ => _manipulatorToStates[manipulatorToData.Key] = ManipulatorState.Idle, Debug.LogError); } } @@ -183,6 +185,10 @@ void ActuallyStart() public void OnStopPressed() { CommunicationManager.Instance.Stop(_ => print("Stopped")); + + // Swap start and stop buttons + _startButton.SetActive(true); + _stopButton.SetActive(false); } #endregion @@ -204,7 +210,7 @@ void CalibrateManipulator(ProbeManager manipulator) // Goto bregma CommunicationManager.Instance.GotoPos(manipulatorBehaviorController.ManipulatorID, manipulatorBehaviorController.ZeroCoordinateOffset, - ManipulatorBehaviorController.AUTOMATIC_MOVEMENT_SPEED, + OUTSIDE_MOVEMENT_SPEED, _ => { SpinTimer(); @@ -212,7 +218,7 @@ void CalibrateManipulator(ProbeManager manipulator) // Come back to idle CommunicationManager.Instance.GotoPos(manipulatorBehaviorController.ManipulatorID, _demoManipulatorToData[manipulator].IdlePos, - ManipulatorBehaviorController.AUTOMATIC_MOVEMENT_SPEED, + OUTSIDE_MOVEMENT_SPEED, _ => { SpinTimer(); From fedab4e0dbee160e5cb42858efe48ed6234fe3c0 Mon Sep 17 00:00:00 2001 From: Kenneth Yang Date: Tue, 7 Nov 2023 13:16:22 -0800 Subject: [PATCH 54/78] Driven to entry coordinate --- .../UI/EphysCopilot/CopilotDemoHandler.cs | 43 ++++++++++++++++--- 1 file changed, 38 insertions(+), 5 deletions(-) diff --git a/Assets/Scripts/TrajectoryPlanner/UI/EphysCopilot/CopilotDemoHandler.cs b/Assets/Scripts/TrajectoryPlanner/UI/EphysCopilot/CopilotDemoHandler.cs index 1cc6b84d..b25add5f 100644 --- a/Assets/Scripts/TrajectoryPlanner/UI/EphysCopilot/CopilotDemoHandler.cs +++ b/Assets/Scripts/TrajectoryPlanner/UI/EphysCopilot/CopilotDemoHandler.cs @@ -5,7 +5,6 @@ using System.IO; using System.Linq; using EphysLink; -using TrajectoryPlanner.Probes; using UnityEngine; using Debug = UnityEngine.Debug; @@ -38,6 +37,7 @@ internal struct ManipulatorData { public Vector3 Angle; public Vector4 IdlePos; + public Vector4 EntryCoordinatePos; public Vector4 DuraPos; public float Depth; } @@ -60,7 +60,13 @@ public class CopilotDemoHandler : MonoBehaviour { #region Constants + // Manipulator movement speed when outside in mm/s private const float OUTSIDE_MOVEMENT_SPEED = 1f; + + // DV ceiling in um + private const float DV_CEILING = 3500f; + + // Pause time in milliseconds private const long PAUSE_TIME = 1000; #endregion @@ -109,6 +115,10 @@ private void OnEnable() matchingManipulator.ManipulatorBehaviorController.ConvertInsertionAPMLDVToManipulatorPosition( new Vector3(manipulatorData.idle[0], manipulatorData.idle[1], manipulatorData.idle[2]) / 1000f), + EntryCoordinatePos = + matchingManipulator.ManipulatorBehaviorController.ConvertInsertionAPMLDVToManipulatorPosition( + new Vector3(manipulatorData.insertion[0], manipulatorData.insertion[1], DV_CEILING) / + 1000f), DuraPos = matchingManipulator.ManipulatorBehaviorController.ConvertInsertionAPMLDVToManipulatorPosition( new Vector3(manipulatorData.insertion[0], manipulatorData.insertion[1], @@ -131,12 +141,23 @@ private void Update() if (_manipulatorToStates.Values.All(state => state == ManipulatorState.Idle)) { print("All manipulators are at idle"); + // Chill for a bit SpinTimer(); // Run Calibration Calibrate(); } + else if (_manipulatorToStates.Values.All(state => state == ManipulatorState.Calibrated)) + { + print("All manipulators are calibrated"); + + // Chill for a bit + SpinTimer(); + + // Drive to entry coordinate + GoToEntryCoordinate(); + } } #endregion @@ -153,8 +174,7 @@ public void OnStartPressed() void SetCanWrite(ProbeManager manipulator) { CommunicationManager.Instance.SetCanWrite(manipulator.ManipulatorBehaviorController.ManipulatorID, true, - 100, - _ => + 100, _ => { if (++manipulatorIndex < _demoManipulatorToData.Count) SetCanWrite(_demoManipulatorToData.Keys.ToList()[manipulatorIndex]); @@ -172,7 +192,6 @@ void ActuallyStart() // Move to idle position foreach (var manipulatorToData in _demoManipulatorToData) { - print(manipulatorToData.Key.name + " is traveling to Idle"); _manipulatorToStates[manipulatorToData.Key] = ManipulatorState.Traveling; CommunicationManager.Instance.GotoPos( manipulatorToData.Key.ManipulatorBehaviorController.ManipulatorID, @@ -185,7 +204,7 @@ void ActuallyStart() public void OnStopPressed() { CommunicationManager.Instance.Stop(_ => print("Stopped")); - + // Swap start and stop buttons _startButton.SetActive(true); _stopButton.SetActive(false); @@ -232,6 +251,20 @@ void CalibrateManipulator(ProbeManager manipulator) } } + private void GoToEntryCoordinate() + { + SetAllToTraveling(); + + foreach (var manipulatorData in _demoManipulatorToData) + { + _manipulatorToStates[manipulatorData.Key] = ManipulatorState.Traveling; + CommunicationManager.Instance.GotoPos(manipulatorData.Key.ManipulatorBehaviorController.ManipulatorID, + manipulatorData.Value.EntryCoordinatePos, OUTSIDE_MOVEMENT_SPEED, + _ => _manipulatorToStates[manipulatorData.Key] = ManipulatorState.AtEntryCoordinate, + Debug.LogError); + } + } + #endregion #region Helper functions From 10fd3fc147d174934e72c0228b049b268d006bfb Mon Sep 17 00:00:00 2001 From: Kenneth Yang Date: Tue, 7 Nov 2023 13:20:31 -0800 Subject: [PATCH 55/78] Fixed entry coordinate in data --- Assets/StreamingAssets/copilot_demo.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Assets/StreamingAssets/copilot_demo.json b/Assets/StreamingAssets/copilot_demo.json index e5312f36..203ea19f 100644 --- a/Assets/StreamingAssets/copilot_demo.json +++ b/Assets/StreamingAssets/copilot_demo.json @@ -121,7 +121,7 @@ ], "insertion": [ -1000, - 3274, + -3274, -810, 2852 ] From 92d3c24965a4db9aa8f0bb1859fd98dda37c436b Mon Sep 17 00:00:00 2001 From: Kenneth Yang Date: Tue, 7 Nov 2023 14:28:54 -0800 Subject: [PATCH 56/78] Untested dura and insertion --- .../UI/EphysCopilot/CopilotDemoHandler.cs | 82 +++++++++++++++++-- 1 file changed, 75 insertions(+), 7 deletions(-) diff --git a/Assets/Scripts/TrajectoryPlanner/UI/EphysCopilot/CopilotDemoHandler.cs b/Assets/Scripts/TrajectoryPlanner/UI/EphysCopilot/CopilotDemoHandler.cs index b25add5f..007221ca 100644 --- a/Assets/Scripts/TrajectoryPlanner/UI/EphysCopilot/CopilotDemoHandler.cs +++ b/Assets/Scripts/TrajectoryPlanner/UI/EphysCopilot/CopilotDemoHandler.cs @@ -63,9 +63,24 @@ public class CopilotDemoHandler : MonoBehaviour // Manipulator movement speed when outside in mm/s private const float OUTSIDE_MOVEMENT_SPEED = 1f; + // Manipulator movement speed when inside in mm/s + private const float INSIDE_MOVEMENT_SPEED = 0.5f; + + // Manipulator movement speed when close to target in mm/s + private const float CLOSE_MOVEMENT_SPEED = 0.2f; + // DV ceiling in um private const float DV_CEILING = 3500f; + // Close to target distance (mm) + private const float CLOSE_TO_TARGET_DISTANCE = 0.1f; + + // Exit margin depth (mm) + private const float EXIT_MARGIN_DEPTH = 0.1f; + + // Go past distance (mm) + private const float GO_PAST_DISTANCE = 0.05f; + // Pause time in milliseconds private const long PAUSE_TIME = 1000; @@ -155,9 +170,37 @@ private void Update() // Chill for a bit SpinTimer(); - // Drive to entry coordinate + // Go to entry coordinate GoToEntryCoordinate(); } + else if (_manipulatorToStates.Values.All(state => state == ManipulatorState.AtEntryCoordinate)) + { + print("All manipulators are at entry coordinate"); + + // Chill for a bit + SpinTimer(); + + // Go to dura + GoToDura(); + } + else if (_manipulatorToStates.Values.All(state => state == ManipulatorState.AtDura)) + { + print("All manipulators are at dura"); + + // Chill for a bit + SpinTimer(); + + // Go to target insertion + GoToTargetInsertion(); + } + else if (_manipulatorToStates.Values.All(state => state == ManipulatorState.Inserted)) + { + print("All manipulators are inserted"); + + // Chill for a bit + + // Bring them back out + } } #endregion @@ -190,14 +233,12 @@ void ActuallyStart() _stopButton.SetActive(true); // Move to idle position + SetAllToTraveling(); foreach (var manipulatorToData in _demoManipulatorToData) - { - _manipulatorToStates[manipulatorToData.Key] = ManipulatorState.Traveling; CommunicationManager.Instance.GotoPos( manipulatorToData.Key.ManipulatorBehaviorController.ManipulatorID, manipulatorToData.Value.IdlePos, OUTSIDE_MOVEMENT_SPEED, _ => _manipulatorToStates[manipulatorToData.Key] = ManipulatorState.Idle, Debug.LogError); - } } } @@ -256,13 +297,40 @@ private void GoToEntryCoordinate() SetAllToTraveling(); foreach (var manipulatorData in _demoManipulatorToData) - { - _manipulatorToStates[manipulatorData.Key] = ManipulatorState.Traveling; CommunicationManager.Instance.GotoPos(manipulatorData.Key.ManipulatorBehaviorController.ManipulatorID, manipulatorData.Value.EntryCoordinatePos, OUTSIDE_MOVEMENT_SPEED, _ => _manipulatorToStates[manipulatorData.Key] = ManipulatorState.AtEntryCoordinate, Debug.LogError); - } + } + + private void GoToDura() + { + SetAllToTraveling(); + + foreach (var manipulatorData in _demoManipulatorToData) + CommunicationManager.Instance.GotoPos(manipulatorData.Key.ManipulatorBehaviorController.ManipulatorID, + manipulatorData.Value.DuraPos, OUTSIDE_MOVEMENT_SPEED, + _ => _manipulatorToStates[manipulatorData.Key] = ManipulatorState.Inserted, Debug.LogError); + } + + private void GoToTargetInsertion() + { + SetAllToTraveling(); + + foreach (var manipulatorData in _demoManipulatorToData) + CommunicationManager.Instance.DriveToDepth( + manipulatorData.Key.ManipulatorBehaviorController.ManipulatorID, + manipulatorData.Value.Depth - CLOSE_TO_TARGET_DISTANCE, + INSIDE_MOVEMENT_SPEED, + _ => CommunicationManager.Instance.DriveToDepth( + manipulatorData.Key.ManipulatorBehaviorController.ManipulatorID, + manipulatorData.Value.Depth + GO_PAST_DISTANCE, CLOSE_MOVEMENT_SPEED, + _ => CommunicationManager.Instance.DriveToDepth( + manipulatorData.Key.ManipulatorBehaviorController.ManipulatorID, + manipulatorData.Value.Depth, CLOSE_MOVEMENT_SPEED, + _ => _manipulatorToStates[manipulatorData.Key] = ManipulatorState.Inserted, Debug.LogError), + Debug.LogError), + Debug.LogError); } #endregion From c892cd1e93efea904b00863c81dd1cec1423b6f4 Mon Sep 17 00:00:00 2001 From: Kenneth Yang Date: Tue, 7 Nov 2023 14:40:46 -0800 Subject: [PATCH 57/78] Incorrect drive, but others work --- .../UI/EphysCopilot/CopilotDemoHandler.cs | 63 +++++++++++++++---- 1 file changed, 50 insertions(+), 13 deletions(-) diff --git a/Assets/Scripts/TrajectoryPlanner/UI/EphysCopilot/CopilotDemoHandler.cs b/Assets/Scripts/TrajectoryPlanner/UI/EphysCopilot/CopilotDemoHandler.cs index 007221ca..fb7be5af 100644 --- a/Assets/Scripts/TrajectoryPlanner/UI/EphysCopilot/CopilotDemoHandler.cs +++ b/Assets/Scripts/TrajectoryPlanner/UI/EphysCopilot/CopilotDemoHandler.cs @@ -61,13 +61,13 @@ public class CopilotDemoHandler : MonoBehaviour #region Constants // Manipulator movement speed when outside in mm/s - private const float OUTSIDE_MOVEMENT_SPEED = 1f; + private const float OUTSIDE_MOVEMENT_SPEED = 1.5f; // Manipulator movement speed when inside in mm/s - private const float INSIDE_MOVEMENT_SPEED = 0.5f; + private const float INSIDE_MOVEMENT_SPEED = .75f; // Manipulator movement speed when close to target in mm/s - private const float CLOSE_MOVEMENT_SPEED = 0.2f; + private const float CLOSE_MOVEMENT_SPEED = 0.3f; // DV ceiling in um private const float DV_CEILING = 3500f; @@ -191,15 +191,27 @@ private void Update() SpinTimer(); // Go to target insertion - GoToTargetInsertion(); + Insert(); } else if (_manipulatorToStates.Values.All(state => state == ManipulatorState.Inserted)) { print("All manipulators are inserted"); - + // Chill for a bit - + SpinTimer(); + // Bring them back out + Retract(); + } + else if (_manipulatorToStates.Values.All(state => state == ManipulatorState.Retracted)) + { + print("All manipulators are retracted"); + + // Chill for a bit + SpinTimer(); + + // Go back to idle + GoToIdle(); } } @@ -233,12 +245,7 @@ void ActuallyStart() _stopButton.SetActive(true); // Move to idle position - SetAllToTraveling(); - foreach (var manipulatorToData in _demoManipulatorToData) - CommunicationManager.Instance.GotoPos( - manipulatorToData.Key.ManipulatorBehaviorController.ManipulatorID, - manipulatorToData.Value.IdlePos, OUTSIDE_MOVEMENT_SPEED, - _ => _manipulatorToStates[manipulatorToData.Key] = ManipulatorState.Idle, Debug.LogError); + GoToIdle(); } } @@ -255,6 +262,16 @@ public void OnStopPressed() #region Movement Functions + private void GoToIdle() + { + SetAllToTraveling(); + foreach (var manipulatorToData in _demoManipulatorToData) + CommunicationManager.Instance.GotoPos( + manipulatorToData.Key.ManipulatorBehaviorController.ManipulatorID, + manipulatorToData.Value.IdlePos, OUTSIDE_MOVEMENT_SPEED, + _ => _manipulatorToStates[manipulatorToData.Key] = ManipulatorState.Idle, Debug.LogError); + } + private void Calibrate() { SetAllToTraveling(); @@ -313,7 +330,7 @@ private void GoToDura() _ => _manipulatorToStates[manipulatorData.Key] = ManipulatorState.Inserted, Debug.LogError); } - private void GoToTargetInsertion() + private void Insert() { SetAllToTraveling(); @@ -333,6 +350,26 @@ private void GoToTargetInsertion() Debug.LogError); } + private void Retract() + { + SetAllToTraveling(); + + foreach (var manipulatorData in _demoManipulatorToData) + CommunicationManager.Instance.DriveToDepth( + manipulatorData.Key.ManipulatorBehaviorController.ManipulatorID, + manipulatorData.Value.Depth - CLOSE_TO_TARGET_DISTANCE, CLOSE_MOVEMENT_SPEED, + _ => CommunicationManager.Instance.DriveToDepth( + manipulatorData.Key.ManipulatorBehaviorController.ManipulatorID, + manipulatorData.Value.DuraPos.w - EXIT_MARGIN_DEPTH, INSIDE_MOVEMENT_SPEED, + _ => CommunicationManager.Instance.GotoPos( + manipulatorData.Key.ManipulatorBehaviorController.ManipulatorID, + manipulatorData.Value.EntryCoordinatePos, OUTSIDE_MOVEMENT_SPEED, + _ => _manipulatorToStates[manipulatorData.Key] = ManipulatorState.Retracted, + Debug.LogError), + Debug.LogError), + Debug.LogError); + } + #endregion #region Helper functions From f73800c8c159b1e768e657aca161792be628fa0f Mon Sep 17 00:00:00 2001 From: Kenneth Yang Date: Tue, 7 Nov 2023 14:52:45 -0800 Subject: [PATCH 58/78] Fixed depth coordinate --- .../TrajectoryPlanner/UI/EphysCopilot/CopilotDemoHandler.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Assets/Scripts/TrajectoryPlanner/UI/EphysCopilot/CopilotDemoHandler.cs b/Assets/Scripts/TrajectoryPlanner/UI/EphysCopilot/CopilotDemoHandler.cs index fb7be5af..75876fd7 100644 --- a/Assets/Scripts/TrajectoryPlanner/UI/EphysCopilot/CopilotDemoHandler.cs +++ b/Assets/Scripts/TrajectoryPlanner/UI/EphysCopilot/CopilotDemoHandler.cs @@ -137,9 +137,9 @@ private void OnEnable() DuraPos = matchingManipulator.ManipulatorBehaviorController.ConvertInsertionAPMLDVToManipulatorPosition( new Vector3(manipulatorData.insertion[0], manipulatorData.insertion[1], - manipulatorData.insertion[2]) / 1000f), - Depth = manipulatorData.insertion[3] / 1000f + manipulatorData.insertion[2]) / 1000f) }; + convertedData.Depth = convertedData.DuraPos.w + manipulatorData.insertion[3] / 1000f; _demoManipulatorToData.Add(matchingManipulator, convertedData); From 4f5a592c8cc58905b5c5bfd23a982948f9650a59 Mon Sep 17 00:00:00 2001 From: Kenneth Yang Date: Tue, 7 Nov 2023 15:06:12 -0800 Subject: [PATCH 59/78] Full loop --- .../Prefabs/UI/EphysCopilot/CopilotDemoPanel.prefab | 5 +++++ .../UI/EphysCopilot/CopilotDemoHandler.cs | 13 ++++++++++--- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/Assets/Prefabs/UI/EphysCopilot/CopilotDemoPanel.prefab b/Assets/Prefabs/UI/EphysCopilot/CopilotDemoPanel.prefab index db9ffd9e..7a160959 100644 --- a/Assets/Prefabs/UI/EphysCopilot/CopilotDemoPanel.prefab +++ b/Assets/Prefabs/UI/EphysCopilot/CopilotDemoPanel.prefab @@ -253,6 +253,11 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: 78f91eb601d18cf4ca076cc899036bd8, type: 3} m_Name: m_EditorClassIdentifier: + _calibratingToBregmaText: {fileID: 733609914218382619} + _goingToEntryCoordinateText: {fileID: 4426603608457220660} + _goingToDuraText: {fileID: 8946753609717924497} + _insertingText: {fileID: 3295570320582879773} + _retractingText: {fileID: 7893861323076657493} _startButton: {fileID: 389895556494180254} _stopButton: {fileID: 8185988774562960974} --- !u!1 &1701132444679105691 diff --git a/Assets/Scripts/TrajectoryPlanner/UI/EphysCopilot/CopilotDemoHandler.cs b/Assets/Scripts/TrajectoryPlanner/UI/EphysCopilot/CopilotDemoHandler.cs index 75876fd7..af90870b 100644 --- a/Assets/Scripts/TrajectoryPlanner/UI/EphysCopilot/CopilotDemoHandler.cs +++ b/Assets/Scripts/TrajectoryPlanner/UI/EphysCopilot/CopilotDemoHandler.cs @@ -5,6 +5,7 @@ using System.IO; using System.Linq; using EphysLink; +using TMPro; using UnityEngine; using Debug = UnityEngine.Debug; @@ -88,6 +89,12 @@ public class CopilotDemoHandler : MonoBehaviour #region Components + [SerializeField] private TMP_Text _calibratingToBregmaText; + [SerializeField] private TMP_Text _goingToEntryCoordinateText; + [SerializeField] private TMP_Text _goingToDuraText; + [SerializeField] private TMP_Text _insertingText; + [SerializeField] private TMP_Text _retractingText; + [SerializeField] private GameObject _startButton; [SerializeField] private GameObject _stopButton; @@ -206,10 +213,10 @@ private void Update() else if (_manipulatorToStates.Values.All(state => state == ManipulatorState.Retracted)) { print("All manipulators are retracted"); - + // Chill for a bit SpinTimer(); - + // Go back to idle GoToIdle(); } @@ -327,7 +334,7 @@ private void GoToDura() foreach (var manipulatorData in _demoManipulatorToData) CommunicationManager.Instance.GotoPos(manipulatorData.Key.ManipulatorBehaviorController.ManipulatorID, manipulatorData.Value.DuraPos, OUTSIDE_MOVEMENT_SPEED, - _ => _manipulatorToStates[manipulatorData.Key] = ManipulatorState.Inserted, Debug.LogError); + _ => _manipulatorToStates[manipulatorData.Key] = ManipulatorState.AtDura, Debug.LogError); } private void Insert() From a3b8cd2da6c1ec50028e9205e549343d48a14b67 Mon Sep 17 00:00:00 2001 From: Kenneth Yang Date: Tue, 7 Nov 2023 16:08:35 -0800 Subject: [PATCH 60/78] Fixed bregma calibration step --- .../UI/EphysCopilot/CopilotDemoHandler.cs | 39 +++++++++++-------- 1 file changed, 22 insertions(+), 17 deletions(-) diff --git a/Assets/Scripts/TrajectoryPlanner/UI/EphysCopilot/CopilotDemoHandler.cs b/Assets/Scripts/TrajectoryPlanner/UI/EphysCopilot/CopilotDemoHandler.cs index af90870b..271f7c89 100644 --- a/Assets/Scripts/TrajectoryPlanner/UI/EphysCopilot/CopilotDemoHandler.cs +++ b/Assets/Scripts/TrajectoryPlanner/UI/EphysCopilot/CopilotDemoHandler.cs @@ -213,10 +213,10 @@ private void Update() else if (_manipulatorToStates.Values.All(state => state == ManipulatorState.Retracted)) { print("All manipulators are retracted"); - + // Chill for a bit SpinTimer(); - + // Go back to idle GoToIdle(); } @@ -291,28 +291,33 @@ void CalibrateManipulator(ProbeManager manipulator) { var manipulatorBehaviorController = manipulator.ManipulatorBehaviorController; - // Goto bregma + // Goto above bregma then down to bregma CommunicationManager.Instance.GotoPos(manipulatorBehaviorController.ManipulatorID, - manipulatorBehaviorController.ZeroCoordinateOffset, - OUTSIDE_MOVEMENT_SPEED, - _ => - { - SpinTimer(); - - // Come back to idle + manipulatorBehaviorController.ZeroCoordinateOffset + new Vector4(0, DV_CEILING / 1000f, 0, 0), + OUTSIDE_MOVEMENT_SPEED, _ => CommunicationManager.Instance.GotoPos(manipulatorBehaviorController.ManipulatorID, - _demoManipulatorToData[manipulator].IdlePos, + manipulatorBehaviorController.ZeroCoordinateOffset, OUTSIDE_MOVEMENT_SPEED, _ => { SpinTimer(); - // Complete and start next manipulator - _manipulatorToStates[manipulator] = ManipulatorState.Calibrated; - if (++manipulatorIndex < _demoManipulatorToData.Count) - CalibrateManipulator(_demoManipulatorToData.Keys.ToList()[manipulatorIndex]); - }, Debug.LogError); - }, Debug.LogError); + // Come back to idle + CommunicationManager.Instance.GotoPos(manipulatorBehaviorController.ManipulatorID, + _demoManipulatorToData[manipulator].IdlePos, + OUTSIDE_MOVEMENT_SPEED, + _ => + { + SpinTimer(); + + // Complete and start next manipulator + _manipulatorToStates[manipulator] = ManipulatorState.Calibrated; + if (++manipulatorIndex < _demoManipulatorToData.Count) + CalibrateManipulator( + _demoManipulatorToData.Keys.ToList()[manipulatorIndex]); + }, Debug.LogError); + }, Debug.LogError), + Debug.LogError); } } From 8fefd125b08f6fea64fff463a21fbdb0c25aa793 Mon Sep 17 00:00:00 2001 From: Kenneth Yang Date: Tue, 7 Nov 2023 16:51:34 -0800 Subject: [PATCH 61/78] Change color to show progress --- .../UI/EphysCopilot/CopilotDemoPanel.prefab | 151 ++++++++++++++--- Assets/Scenes/TrajectoryPlanner.unity | 152 +++++++++++++----- .../UI/EphysCopilot/CopilotDemoHandler.cs | 55 +++++++ 3 files changed, 298 insertions(+), 60 deletions(-) diff --git a/Assets/Prefabs/UI/EphysCopilot/CopilotDemoPanel.prefab b/Assets/Prefabs/UI/EphysCopilot/CopilotDemoPanel.prefab index 7a160959..18dcc80f 100644 --- a/Assets/Prefabs/UI/EphysCopilot/CopilotDemoPanel.prefab +++ b/Assets/Prefabs/UI/EphysCopilot/CopilotDemoPanel.prefab @@ -1,5 +1,41 @@ %YAML 1.1 %TAG !u! tag:unity3d.com,2011: +--- !u!1 &174171303184526020 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 7152201362120970733} + m_Layer: 5 + m_Name: Spacer + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &7152201362120970733 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 174171303184526020} + 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: [] + m_Father: {fileID: 1445278465348587320} + m_RootOrder: 2 + 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!1 &389895556494180254 GameObject: m_ObjectHideFlags: 0 @@ -18,7 +54,7 @@ GameObject: m_Icon: {fileID: 0} m_NavMeshLayer: 0 m_StaticEditorFlags: 0 - m_IsActive: 0 + m_IsActive: 1 --- !u!224 &3965463384619871731 RectTransform: m_ObjectHideFlags: 0 @@ -169,13 +205,14 @@ RectTransform: m_Children: - {fileID: 4505031865777792410} - {fileID: 6431889516307735811} + - {fileID: 7152201362120970733} m_Father: {fileID: 0} m_RootOrder: 0 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0.5, y: 0} m_AnchorMax: {x: 0.5, y: 0} - m_AnchoredPosition: {x: 0, y: 300} - m_SizeDelta: {x: 1800, y: 500} + m_AnchoredPosition: {x: -33.06543, y: 183.8446} + m_SizeDelta: {x: 1111.5574, y: 267.6892} m_Pivot: {x: 0.5, y: 0.5} --- !u!222 &1777920888481282050 CanvasRenderer: @@ -260,6 +297,42 @@ MonoBehaviour: _retractingText: {fileID: 7893861323076657493} _startButton: {fileID: 389895556494180254} _stopButton: {fileID: 8185988774562960974} +--- !u!1 &1557486313130502640 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 8065443785537931581} + m_Layer: 5 + m_Name: Spacer + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &8065443785537931581 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1557486313130502640} + 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: [] + m_Father: {fileID: 4505031865777792410} + m_RootOrder: 0 + 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!1 &1701132444679105691 GameObject: m_ObjectHideFlags: 0 @@ -291,7 +364,7 @@ RectTransform: m_ConstrainProportionsScale: 0 m_Children: [] m_Father: {fileID: 4505031865777792410} - m_RootOrder: 2 + m_RootOrder: 3 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 0} m_AnchorMax: {x: 0, y: 0} @@ -355,8 +428,8 @@ MonoBehaviour: m_faceColor: serializedVersion: 2 rgba: 4294967295 - m_fontSize: 40 - m_fontSizeBase: 40 + m_fontSize: 30 + m_fontSizeBase: 30 m_fontWeight: 400 m_enableAutoSizing: 0 m_fontSizeMin: 18 @@ -428,7 +501,7 @@ RectTransform: m_ConstrainProportionsScale: 0 m_Children: [] m_Father: {fileID: 4505031865777792410} - m_RootOrder: 1 + m_RootOrder: 2 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 0} m_AnchorMax: {x: 0, y: 0} @@ -492,8 +565,8 @@ MonoBehaviour: m_faceColor: serializedVersion: 2 rgba: 4294967295 - m_fontSize: 40 - m_fontSizeBase: 40 + m_fontSize: 30 + m_fontSizeBase: 30 m_fontWeight: 400 m_enableAutoSizing: 0 m_fontSizeMin: 18 @@ -700,7 +773,7 @@ RectTransform: m_ConstrainProportionsScale: 0 m_Children: [] m_Father: {fileID: 4505031865777792410} - m_RootOrder: 0 + m_RootOrder: 1 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 0} m_AnchorMax: {x: 0, y: 0} @@ -764,8 +837,8 @@ MonoBehaviour: m_faceColor: serializedVersion: 2 rgba: 4294967295 - m_fontSize: 40 - m_fontSizeBase: 40 + m_fontSize: 30 + m_fontSizeBase: 30 m_fontWeight: 400 m_enableAutoSizing: 0 m_fontSizeMin: 18 @@ -806,6 +879,42 @@ MonoBehaviour: m_hasFontAssetChanged: 0 m_baseMaterial: {fileID: 0} m_maskOffset: {x: 0, y: 0, z: 0, w: 0} +--- !u!1 &4839783753841082054 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 2299560051176766834} + m_Layer: 5 + m_Name: Spacer (1) + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &2299560051176766834 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 4839783753841082054} + 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: [] + m_Father: {fileID: 4505031865777792410} + m_RootOrder: 6 + 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!1 &4898606774794570049 GameObject: m_ObjectHideFlags: 0 @@ -972,7 +1081,7 @@ RectTransform: m_ConstrainProportionsScale: 0 m_Children: [] m_Father: {fileID: 4505031865777792410} - m_RootOrder: 4 + m_RootOrder: 5 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 0} m_AnchorMax: {x: 0, y: 0} @@ -1036,8 +1145,8 @@ MonoBehaviour: m_faceColor: serializedVersion: 2 rgba: 4294967295 - m_fontSize: 40 - m_fontSizeBase: 40 + m_fontSize: 30 + m_fontSizeBase: 30 m_fontWeight: 400 m_enableAutoSizing: 0 m_fontSizeMin: 18 @@ -1108,11 +1217,13 @@ RectTransform: m_LocalScale: {x: 1, y: 1, z: 1} m_ConstrainProportionsScale: 0 m_Children: + - {fileID: 8065443785537931581} - {fileID: 8837604975544357713} - {fileID: 5147399233535029241} - {fileID: 1837604378854586354} - {fileID: 3451964772010717910} - {fileID: 18247630272671149} + - {fileID: 2299560051176766834} m_Father: {fileID: 1445278465348587320} m_RootOrder: 0 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} @@ -1139,7 +1250,7 @@ MonoBehaviour: m_PreferredWidth: -1 m_PreferredHeight: -1 m_FlexibleWidth: -1 - m_FlexibleHeight: 3 + m_FlexibleHeight: 2 m_LayoutPriority: 1 --- !u!114 &2953077092811180941 MonoBehaviour: @@ -1224,7 +1335,7 @@ MonoBehaviour: m_PreferredWidth: -1 m_PreferredHeight: -1 m_FlexibleWidth: -1 - m_FlexibleHeight: 1 + m_FlexibleHeight: 2.5 m_LayoutPriority: 1 --- !u!1 &8185988774562960974 GameObject: @@ -1392,7 +1503,7 @@ RectTransform: m_ConstrainProportionsScale: 0 m_Children: [] m_Father: {fileID: 4505031865777792410} - m_RootOrder: 3 + m_RootOrder: 4 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 0} m_AnchorMax: {x: 0, y: 0} @@ -1456,8 +1567,8 @@ MonoBehaviour: m_faceColor: serializedVersion: 2 rgba: 4294967295 - m_fontSize: 40 - m_fontSizeBase: 40 + m_fontSize: 30 + m_fontSizeBase: 30 m_fontWeight: 400 m_enableAutoSizing: 0 m_fontSizeMin: 18 diff --git a/Assets/Scenes/TrajectoryPlanner.unity b/Assets/Scenes/TrajectoryPlanner.unity index 19443c93..f8441898 100644 --- a/Assets/Scenes/TrajectoryPlanner.unity +++ b/Assets/Scenes/TrajectoryPlanner.unity @@ -2387,15 +2387,15 @@ PrefabInstance: objectReference: {fileID: 1703646459} - target: {fileID: 341190943836035196, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} propertyPath: m_AnchorMax.y - value: 1 + value: 0 objectReference: {fileID: 0} - target: {fileID: 341190943836035196, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} propertyPath: m_AnchorMin.y - value: 1 + value: 0 objectReference: {fileID: 0} - target: {fileID: 341190943836035196, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} propertyPath: m_AnchoredPosition.x - value: 169.88 + value: 0 objectReference: {fileID: 0} - target: {fileID: 341190943836276264, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} propertyPath: onValueChanged.m_PersistentCalls.m_Calls.Array.data[0].m_Target @@ -2535,19 +2535,19 @@ PrefabInstance: objectReference: {fileID: 1445581475} - target: {fileID: 341190944034978748, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} propertyPath: m_AnchorMax.y - value: 1 + value: 0 objectReference: {fileID: 0} - target: {fileID: 341190944034978748, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} propertyPath: m_AnchorMin.y - value: 1 + value: 0 objectReference: {fileID: 0} - target: {fileID: 341190944034978748, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} propertyPath: m_AnchoredPosition.x - value: 354.84 + value: 0 objectReference: {fileID: 0} - target: {fileID: 341190944034978748, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} propertyPath: m_AnchoredPosition.y - value: -15 + value: 0 objectReference: {fileID: 0} - target: {fileID: 341190944071593138, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} propertyPath: m_AnchorMax.x @@ -2815,19 +2815,19 @@ PrefabInstance: objectReference: {fileID: 0} - target: {fileID: 341190944410943211, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} propertyPath: m_AnchorMax.y - value: 1 + value: 0 objectReference: {fileID: 0} - target: {fileID: 341190944410943211, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} propertyPath: m_AnchorMin.y - value: 1 + value: 0 objectReference: {fileID: 0} - target: {fileID: 341190944410943211, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} propertyPath: m_AnchoredPosition.x - value: 384.91998 + value: 0 objectReference: {fileID: 0} - target: {fileID: 341190944410943211, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} propertyPath: m_AnchoredPosition.y - value: -15 + value: 0 objectReference: {fileID: 0} - target: {fileID: 341190944411999430, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} propertyPath: m_AnchorMax.y @@ -3571,19 +3571,19 @@ PrefabInstance: objectReference: {fileID: 0} - target: {fileID: 526666674236384042, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} propertyPath: m_SizeDelta.x - value: 391.04404 + value: 208.55618 objectReference: {fileID: 0} - target: {fileID: 526666674236384042, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} propertyPath: m_SizeDelta.y - value: 409.16998 + value: 148.87 objectReference: {fileID: 0} - target: {fileID: 526666674236384042, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} propertyPath: m_AnchoredPosition.x - value: 559.25446 + value: 371.60382 objectReference: {fileID: 0} - target: {fileID: 526666674236384042, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} propertyPath: m_AnchoredPosition.y - value: -204.58499 + value: -74.435 objectReference: {fileID: 0} - target: {fileID: 568637148373482672, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} propertyPath: m_AnchorMax.y @@ -4055,19 +4055,19 @@ PrefabInstance: objectReference: {fileID: 0} - target: {fileID: 1829180218217638352, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} propertyPath: m_SizeDelta.x - value: 1700 + value: 1100 objectReference: {fileID: 0} - target: {fileID: 1829180218217638352, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} propertyPath: m_SizeDelta.y - value: 90.83 + value: 57.95 objectReference: {fileID: 0} - target: {fileID: 1829180218217638352, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} propertyPath: m_AnchoredPosition.x - value: 850 + value: 550 objectReference: {fileID: 0} - target: {fileID: 1829180218217638352, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} propertyPath: m_AnchoredPosition.y - value: -454.585 + value: -177.845 objectReference: {fileID: 0} - target: {fileID: 1890578862338769638, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} propertyPath: m_AnchorMax.y @@ -4381,6 +4381,30 @@ PrefabInstance: propertyPath: m_AnchoredPosition.y value: -5 objectReference: {fileID: 0} + - target: {fileID: 2549492478463270206, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} + propertyPath: m_AnchorMax.y + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 2549492478463270206, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} + propertyPath: m_AnchorMin.y + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 2549492478463270206, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} + propertyPath: m_SizeDelta.x + value: 1100 + objectReference: {fileID: 0} + - target: {fileID: 2549492478463270206, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} + propertyPath: m_SizeDelta.y + value: 23.18 + objectReference: {fileID: 0} + - target: {fileID: 2549492478463270206, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} + propertyPath: m_AnchoredPosition.x + value: 550 + objectReference: {fileID: 0} + - target: {fileID: 2549492478463270206, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} + propertyPath: m_AnchoredPosition.y + value: -218.40999 + objectReference: {fileID: 0} - target: {fileID: 2576245173555294759, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} propertyPath: m_AnchorMax.y value: 1 @@ -4781,6 +4805,26 @@ PrefabInstance: propertyPath: _editorFocusableInputFields.Array.data[0] value: objectReference: {fileID: 0} + - target: {fileID: 3444711362033518062, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} + propertyPath: m_AnchorMax.y + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 3444711362033518062, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} + propertyPath: m_AnchorMin.y + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 3444711362033518062, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} + propertyPath: m_SizeDelta.y + value: 148.87 + objectReference: {fileID: 0} + - target: {fileID: 3444711362033518062, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} + propertyPath: m_AnchoredPosition.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 3444711362033518062, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} + propertyPath: m_AnchoredPosition.y + value: -74.435 + objectReference: {fileID: 0} - target: {fileID: 3477886918378625307, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} propertyPath: m_AnchorMax.x value: 1 @@ -5179,19 +5223,19 @@ PrefabInstance: objectReference: {fileID: 0} - target: {fileID: 4216880249697705858, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} propertyPath: m_SizeDelta.x - value: 313.73242 + value: 167.32576 objectReference: {fileID: 0} - target: {fileID: 4216880249697705858, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} propertyPath: m_SizeDelta.y - value: 409.16998 + value: 148.87 objectReference: {fileID: 0} - target: {fileID: 4216880249697705858, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} propertyPath: m_AnchoredPosition.x - value: 156.86621 + value: 133.66287 objectReference: {fileID: 0} - target: {fileID: 4216880249697705858, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} propertyPath: m_AnchoredPosition.y - value: -204.58499 + value: -74.435 objectReference: {fileID: 0} - target: {fileID: 4218167276952692149, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} propertyPath: m_AnchoredPosition.x @@ -5507,19 +5551,19 @@ PrefabInstance: objectReference: {fileID: 0} - target: {fileID: 4638972357698478462, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} propertyPath: m_SizeDelta.x - value: 258.94788 + value: 138.10414 objectReference: {fileID: 0} - target: {fileID: 4638972357698478462, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} propertyPath: m_SizeDelta.y - value: 409.16998 + value: 148.87 objectReference: {fileID: 0} - target: {fileID: 4638972357698478462, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} propertyPath: m_AnchoredPosition.x - value: 1570.5261 + value: 980.94794 objectReference: {fileID: 0} - target: {fileID: 4638972357698478462, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} propertyPath: m_AnchoredPosition.y - value: -204.58499 + value: -74.435 objectReference: {fileID: 0} - target: {fileID: 4724898486047142119, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} propertyPath: m_AnchorMax.y @@ -6039,7 +6083,15 @@ PrefabInstance: objectReference: {fileID: 0} - target: {fileID: 6065941617704141803, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} propertyPath: m_SizeDelta.x - value: 1700 + value: 1100 + objectReference: {fileID: 0} + - target: {fileID: 6065941617704141803, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} + propertyPath: m_SizeDelta.y + value: 230 + objectReference: {fileID: 0} + - target: {fileID: 6065941617704141803, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} + propertyPath: m_AnchoredPosition.y + value: 150 objectReference: {fileID: 0} - target: {fileID: 6065941617837916594, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} propertyPath: m_AnchorMax.y @@ -6267,19 +6319,19 @@ PrefabInstance: objectReference: {fileID: 0} - target: {fileID: 6458267049939974945, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} propertyPath: m_SizeDelta.x - value: 300.59705 + value: 160.32016 objectReference: {fileID: 0} - target: {fileID: 6458267049939974945, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} propertyPath: m_SizeDelta.y - value: 409.16998 + value: 148.87 objectReference: {fileID: 0} - target: {fileID: 6458267049939974945, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} propertyPath: m_AnchoredPosition.x - value: 955.075 + value: 606.04205 objectReference: {fileID: 0} - target: {fileID: 6458267049939974945, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} propertyPath: m_AnchoredPosition.y - value: -204.58499 + value: -74.435 objectReference: {fileID: 0} - target: {fileID: 6514980532054408230, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} propertyPath: m_AnchorMax.y @@ -6401,6 +6453,26 @@ PrefabInstance: propertyPath: m_SizeDelta.x value: -17 objectReference: {fileID: 0} + - target: {fileID: 6902199046925824417, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} + propertyPath: m_AnchorMax.y + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 6902199046925824417, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} + propertyPath: m_AnchorMin.y + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 6902199046925824417, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} + propertyPath: m_SizeDelta.y + value: 148.87 + objectReference: {fileID: 0} + - target: {fileID: 6902199046925824417, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} + propertyPath: m_AnchoredPosition.x + value: 1100 + objectReference: {fileID: 0} + - target: {fileID: 6902199046925824417, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} + propertyPath: m_AnchoredPosition.y + value: -74.435 + objectReference: {fileID: 0} - target: {fileID: 6932418094552038715, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} propertyPath: m_OnClick.m_PersistentCalls.m_Calls.Array.size value: 1 @@ -6927,19 +6999,19 @@ PrefabInstance: objectReference: {fileID: 0} - target: {fileID: 8054674137374801413, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} propertyPath: m_SizeDelta.x - value: 235.67854 + value: 125.6937 objectReference: {fileID: 0} - target: {fileID: 8054674137374801413, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} propertyPath: m_SizeDelta.y - value: 409.16998 + value: 148.87 objectReference: {fileID: 0} - target: {fileID: 8054674137374801413, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} propertyPath: m_AnchoredPosition.x - value: 1273.2128 + value: 799.049 objectReference: {fileID: 0} - target: {fileID: 8054674137374801413, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} propertyPath: m_AnchoredPosition.y - value: -204.58499 + value: -74.435 objectReference: {fileID: 0} - target: {fileID: 8122223018216829504, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} propertyPath: m_AnchorMax.y @@ -7467,19 +7539,19 @@ PrefabInstance: objectReference: {fileID: 0} - target: {fileID: 9125755490035067209, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} propertyPath: m_SizeDelta.x - value: 1700 + value: 1100 objectReference: {fileID: 0} - target: {fileID: 9125755490035067209, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} propertyPath: m_SizeDelta.y - value: 409.16998 + value: 148.87 objectReference: {fileID: 0} - target: {fileID: 9125755490035067209, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} propertyPath: m_AnchoredPosition.x - value: 850 + value: 550 objectReference: {fileID: 0} - target: {fileID: 9125755490035067209, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} propertyPath: m_AnchoredPosition.y - value: -204.58499 + value: -74.435 objectReference: {fileID: 0} - target: {fileID: 9201160669940680994, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} propertyPath: m_AnchorMax.y diff --git a/Assets/Scripts/TrajectoryPlanner/UI/EphysCopilot/CopilotDemoHandler.cs b/Assets/Scripts/TrajectoryPlanner/UI/EphysCopilot/CopilotDemoHandler.cs index 271f7c89..9ce0f974 100644 --- a/Assets/Scripts/TrajectoryPlanner/UI/EphysCopilot/CopilotDemoHandler.cs +++ b/Assets/Scripts/TrajectoryPlanner/UI/EphysCopilot/CopilotDemoHandler.cs @@ -105,6 +105,12 @@ public class CopilotDemoHandler : MonoBehaviour private readonly Dictionary _demoManipulatorToData = new(); private readonly Dictionary _manipulatorToStates = new(); + + // Text progress colors + private static Color WaitingColor => ProbeProperties.ProbeColors[15]; + private static Color InProgressColor => ProbeProperties.ProbeColors[3]; + private static Color CompletedColor => ProbeProperties.ProbeColors[5]; + #endregion #region Unity @@ -164,6 +170,13 @@ private void Update() { print("All manipulators are at idle"); + // Set text colors + _calibratingToBregmaText.color = InProgressColor; + _goingToEntryCoordinateText.color = WaitingColor; + _goingToDuraText.color = WaitingColor; + _insertingText.color = WaitingColor; + _retractingText.color = WaitingColor; + // Chill for a bit SpinTimer(); @@ -174,6 +187,13 @@ private void Update() { print("All manipulators are calibrated"); + // Set text colors + _calibratingToBregmaText.color = CompletedColor; + _goingToEntryCoordinateText.color = InProgressColor; + _goingToDuraText.color = WaitingColor; + _insertingText.color = WaitingColor; + _retractingText.color = WaitingColor; + // Chill for a bit SpinTimer(); @@ -184,6 +204,13 @@ private void Update() { print("All manipulators are at entry coordinate"); + // Set text colors + _calibratingToBregmaText.color = CompletedColor; + _goingToEntryCoordinateText.color = CompletedColor; + _goingToDuraText.color = InProgressColor; + _insertingText.color = WaitingColor; + _retractingText.color = WaitingColor; + // Chill for a bit SpinTimer(); @@ -194,6 +221,13 @@ private void Update() { print("All manipulators are at dura"); + // Set text colors + _calibratingToBregmaText.color = CompletedColor; + _goingToEntryCoordinateText.color = CompletedColor; + _goingToDuraText.color = CompletedColor; + _insertingText.color = InProgressColor; + _retractingText.color = WaitingColor; + // Chill for a bit SpinTimer(); @@ -204,6 +238,13 @@ private void Update() { print("All manipulators are inserted"); + // Set text colors + _calibratingToBregmaText.color = CompletedColor; + _goingToEntryCoordinateText.color = CompletedColor; + _goingToDuraText.color = CompletedColor; + _insertingText.color = CompletedColor; + _retractingText.color = InProgressColor; + // Chill for a bit SpinTimer(); @@ -214,6 +255,13 @@ private void Update() { print("All manipulators are retracted"); + // Set text colors + _calibratingToBregmaText.color = CompletedColor; + _goingToEntryCoordinateText.color = CompletedColor; + _goingToDuraText.color = CompletedColor; + _insertingText.color = CompletedColor; + _retractingText.color = CompletedColor; + // Chill for a bit SpinTimer(); @@ -251,6 +299,13 @@ void ActuallyStart() _startButton.SetActive(false); _stopButton.SetActive(true); + // Reset state colors + _calibratingToBregmaText.color = WaitingColor; + _goingToEntryCoordinateText.color = WaitingColor; + _goingToDuraText.color = WaitingColor; + _insertingText.color = WaitingColor; + _retractingText.color = WaitingColor; + // Move to idle position GoToIdle(); } From 3fd15f24418301a25ce367b3e7a09758c033f1be Mon Sep 17 00:00:00 2001 From: Kenneth Yang Date: Tue, 7 Nov 2023 17:13:05 -0800 Subject: [PATCH 62/78] Spin brain --- Assets/Scenes/TrajectoryPlanner.unity | 4 ++++ .../UI/EphysCopilot/CopilotDemoHandler.cs | 7 +++++++ .../EphysCopilot/trajectoryplanner.ui.ephyscopilot.asmdef | 3 ++- 3 files changed, 13 insertions(+), 1 deletion(-) diff --git a/Assets/Scenes/TrajectoryPlanner.unity b/Assets/Scenes/TrajectoryPlanner.unity index f8441898..edc4b791 100644 --- a/Assets/Scenes/TrajectoryPlanner.unity +++ b/Assets/Scenes/TrajectoryPlanner.unity @@ -7025,6 +7025,10 @@ PrefabInstance: propertyPath: m_AnchoredPosition.y value: -22.5 objectReference: {fileID: 0} + - target: {fileID: 8187037149434712434, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} + propertyPath: _brainCameraController + value: + objectReference: {fileID: 1445581475} - target: {fileID: 8213848463360117488, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} propertyPath: m_AnchorMax.y value: 1 diff --git a/Assets/Scripts/TrajectoryPlanner/UI/EphysCopilot/CopilotDemoHandler.cs b/Assets/Scripts/TrajectoryPlanner/UI/EphysCopilot/CopilotDemoHandler.cs index 9ce0f974..45e61951 100644 --- a/Assets/Scripts/TrajectoryPlanner/UI/EphysCopilot/CopilotDemoHandler.cs +++ b/Assets/Scripts/TrajectoryPlanner/UI/EphysCopilot/CopilotDemoHandler.cs @@ -97,6 +97,7 @@ public class CopilotDemoHandler : MonoBehaviour [SerializeField] private GameObject _startButton; [SerializeField] private GameObject _stopButton; + [SerializeField] private BrainCameraController _brainCameraController; #endregion @@ -305,6 +306,9 @@ void ActuallyStart() _goingToDuraText.color = WaitingColor; _insertingText.color = WaitingColor; _retractingText.color = WaitingColor; + + // Start brain rotation + _brainCameraController.SetCameraContinuousRotation(true); // Move to idle position GoToIdle(); @@ -318,6 +322,9 @@ public void OnStopPressed() // Swap start and stop buttons _startButton.SetActive(true); _stopButton.SetActive(false); + + // Stop brain rotation + _brainCameraController.SetCameraContinuousRotation(false); } #endregion diff --git a/Assets/Scripts/TrajectoryPlanner/UI/EphysCopilot/trajectoryplanner.ui.ephyscopilot.asmdef b/Assets/Scripts/TrajectoryPlanner/UI/EphysCopilot/trajectoryplanner.ui.ephyscopilot.asmdef index dde71b5b..f5b41eb1 100644 --- a/Assets/Scripts/TrajectoryPlanner/UI/EphysCopilot/trajectoryplanner.ui.ephyscopilot.asmdef +++ b/Assets/Scripts/TrajectoryPlanner/UI/EphysCopilot/trajectoryplanner.ui.ephyscopilot.asmdef @@ -9,7 +9,8 @@ "GUID:bcfae4c7cb9968e45808db945035df54", "GUID:025d8743921d928489cc31aa3f24d884", "GUID:eff99741200a0ca47a1364af79d8741c", - "GUID:160da71e82fca504abe6ab7833979cdb" + "GUID:160da71e82fca504abe6ab7833979cdb", + "GUID:f79fe5250a39d8440b0d2a8ac418f14f" ], "includePlatforms": [], "excludePlatforms": [], From 7775a22d04fd6bca8b6ba7060c34cda9e56cd904 Mon Sep 17 00:00:00 2001 From: Kenneth Yang Date: Tue, 7 Nov 2023 17:26:14 -0800 Subject: [PATCH 63/78] Coroutine based timer --- .../UI/EphysCopilot/CopilotDemoHandler.cs | 116 ++++++++---------- 1 file changed, 51 insertions(+), 65 deletions(-) diff --git a/Assets/Scripts/TrajectoryPlanner/UI/EphysCopilot/CopilotDemoHandler.cs b/Assets/Scripts/TrajectoryPlanner/UI/EphysCopilot/CopilotDemoHandler.cs index 45e61951..76df60ed 100644 --- a/Assets/Scripts/TrajectoryPlanner/UI/EphysCopilot/CopilotDemoHandler.cs +++ b/Assets/Scripts/TrajectoryPlanner/UI/EphysCopilot/CopilotDemoHandler.cs @@ -1,13 +1,12 @@ using System; +using System.Collections; using System.Collections.Generic; -using System.Diagnostics; using System.Diagnostics.CodeAnalysis; using System.IO; using System.Linq; using EphysLink; using TMPro; using UnityEngine; -using Debug = UnityEngine.Debug; namespace TrajectoryPlanner.UI.EphysCopilot { @@ -82,8 +81,8 @@ public class CopilotDemoHandler : MonoBehaviour // Go past distance (mm) private const float GO_PAST_DISTANCE = 0.05f; - // Pause time in milliseconds - private const long PAUSE_TIME = 1000; + // Pause time in seconds + private const long PAUSE_TIME = 1; #endregion @@ -177,12 +176,12 @@ private void Update() _goingToDuraText.color = WaitingColor; _insertingText.color = WaitingColor; _retractingText.color = WaitingColor; + + // Set state to traveling + SetAllToTraveling(); - // Chill for a bit - SpinTimer(); - - // Run Calibration - Calibrate(); + // Chill for a bit then calibrate + StartCoroutine(Pause(Calibrate)); } else if (_manipulatorToStates.Values.All(state => state == ManipulatorState.Calibrated)) { @@ -195,11 +194,11 @@ private void Update() _insertingText.color = WaitingColor; _retractingText.color = WaitingColor; - // Chill for a bit - SpinTimer(); - - // Go to entry coordinate - GoToEntryCoordinate(); + // Set state to traveling + SetAllToTraveling(); + + // Chill for a bit then go to entry coordinate + StartCoroutine(Pause(GoToEntryCoordinate)); } else if (_manipulatorToStates.Values.All(state => state == ManipulatorState.AtEntryCoordinate)) { @@ -211,12 +210,12 @@ private void Update() _goingToDuraText.color = InProgressColor; _insertingText.color = WaitingColor; _retractingText.color = WaitingColor; + + // Set state to traveling + SetAllToTraveling(); - // Chill for a bit - SpinTimer(); - - // Go to dura - GoToDura(); + // Chill for a bit then go to dura + StartCoroutine(Pause(GoToDura)); } else if (_manipulatorToStates.Values.All(state => state == ManipulatorState.AtDura)) { @@ -228,12 +227,12 @@ private void Update() _goingToDuraText.color = CompletedColor; _insertingText.color = InProgressColor; _retractingText.color = WaitingColor; + + // Set state to traveling + SetAllToTraveling(); - // Chill for a bit - SpinTimer(); - - // Go to target insertion - Insert(); + // Chill for a bit then go to target insertion + StartCoroutine(Pause(Insert)); } else if (_manipulatorToStates.Values.All(state => state == ManipulatorState.Inserted)) { @@ -245,12 +244,12 @@ private void Update() _goingToDuraText.color = CompletedColor; _insertingText.color = CompletedColor; _retractingText.color = InProgressColor; + + // Set state to traveling + SetAllToTraveling(); - // Chill for a bit - SpinTimer(); - - // Bring them back out - Retract(); + // Chill for a bit then bring them back out + StartCoroutine(Pause(Retract)); } else if (_manipulatorToStates.Values.All(state => state == ManipulatorState.Retracted)) { @@ -262,12 +261,12 @@ private void Update() _goingToDuraText.color = CompletedColor; _insertingText.color = CompletedColor; _retractingText.color = CompletedColor; + + // Set state to traveling + SetAllToTraveling(); - // Chill for a bit - SpinTimer(); - - // Go back to idle - GoToIdle(); + // Chill for a bit then go back to idle + StartCoroutine(Pause(GoToIdle)); } } @@ -306,11 +305,12 @@ void ActuallyStart() _goingToDuraText.color = WaitingColor; _insertingText.color = WaitingColor; _retractingText.color = WaitingColor; - + // Start brain rotation _brainCameraController.SetCameraContinuousRotation(true); // Move to idle position + SetAllToTraveling(); GoToIdle(); } } @@ -322,7 +322,7 @@ public void OnStopPressed() // Swap start and stop buttons _startButton.SetActive(true); _stopButton.SetActive(false); - + // Stop brain rotation _brainCameraController.SetCameraContinuousRotation(false); } @@ -333,7 +333,6 @@ public void OnStopPressed() private void GoToIdle() { - SetAllToTraveling(); foreach (var manipulatorToData in _demoManipulatorToData) CommunicationManager.Instance.GotoPos( manipulatorToData.Key.ManipulatorBehaviorController.ManipulatorID, @@ -343,8 +342,6 @@ private void GoToIdle() private void Calibrate() { - SetAllToTraveling(); - var manipulatorIndex = 0; CalibrateManipulator(_demoManipulatorToData.Keys.ToList()[manipulatorIndex]); return; @@ -362,22 +359,22 @@ void CalibrateManipulator(ProbeManager manipulator) OUTSIDE_MOVEMENT_SPEED, _ => { - SpinTimer(); - // Come back to idle - CommunicationManager.Instance.GotoPos(manipulatorBehaviorController.ManipulatorID, + StartCoroutine(Pause(() => CommunicationManager.Instance.GotoPos( + manipulatorBehaviorController.ManipulatorID, _demoManipulatorToData[manipulator].IdlePos, OUTSIDE_MOVEMENT_SPEED, _ => { - SpinTimer(); - // Complete and start next manipulator - _manipulatorToStates[manipulator] = ManipulatorState.Calibrated; - if (++manipulatorIndex < _demoManipulatorToData.Count) - CalibrateManipulator( - _demoManipulatorToData.Keys.ToList()[manipulatorIndex]); - }, Debug.LogError); + StartCoroutine(Pause(() => + { + _manipulatorToStates[manipulator] = ManipulatorState.Calibrated; + if (++manipulatorIndex < _demoManipulatorToData.Count) + CalibrateManipulator( + _demoManipulatorToData.Keys.ToList()[manipulatorIndex]); + })); + }, Debug.LogError))); }, Debug.LogError), Debug.LogError); } @@ -385,8 +382,6 @@ void CalibrateManipulator(ProbeManager manipulator) private void GoToEntryCoordinate() { - SetAllToTraveling(); - foreach (var manipulatorData in _demoManipulatorToData) CommunicationManager.Instance.GotoPos(manipulatorData.Key.ManipulatorBehaviorController.ManipulatorID, manipulatorData.Value.EntryCoordinatePos, OUTSIDE_MOVEMENT_SPEED, @@ -396,8 +391,6 @@ private void GoToEntryCoordinate() private void GoToDura() { - SetAllToTraveling(); - foreach (var manipulatorData in _demoManipulatorToData) CommunicationManager.Instance.GotoPos(manipulatorData.Key.ManipulatorBehaviorController.ManipulatorID, manipulatorData.Value.DuraPos, OUTSIDE_MOVEMENT_SPEED, @@ -406,8 +399,6 @@ private void GoToDura() private void Insert() { - SetAllToTraveling(); - foreach (var manipulatorData in _demoManipulatorToData) CommunicationManager.Instance.DriveToDepth( manipulatorData.Key.ManipulatorBehaviorController.ManipulatorID, @@ -426,8 +417,6 @@ private void Insert() private void Retract() { - SetAllToTraveling(); - foreach (var manipulatorData in _demoManipulatorToData) CommunicationManager.Instance.DriveToDepth( manipulatorData.Key.ManipulatorBehaviorController.ManipulatorID, @@ -463,15 +452,12 @@ private static bool IsCoterminal(Vector3 first, Vector3 second) /// /// Basic spin timer /// - /// Timer length in milliseconds - private static void SpinTimer(long durationMilliseconds = PAUSE_TIME) + /// Callback after timer ends + /// Timer length in milliseconds + private static IEnumerator Pause(Action doAfter, long duration = PAUSE_TIME) { - var stopwatch = new Stopwatch(); - stopwatch.Start(); - while (stopwatch.ElapsedMilliseconds < durationMilliseconds) - { - // Spin - } + yield return new WaitForSeconds(duration / 1000f); + doAfter(); } /// From 01871c8e879bd9bf1fe9c44b17bb39405b6add12 Mon Sep 17 00:00:00 2001 From: Kenneth Yang Date: Thu, 9 Nov 2023 14:53:38 -0800 Subject: [PATCH 64/78] Stop demo when there are no manipulators --- .../UI/EphysCopilot/CopilotDemoHandler.cs | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/Assets/Scripts/TrajectoryPlanner/UI/EphysCopilot/CopilotDemoHandler.cs b/Assets/Scripts/TrajectoryPlanner/UI/EphysCopilot/CopilotDemoHandler.cs index 76df60ed..e04794d6 100644 --- a/Assets/Scripts/TrajectoryPlanner/UI/EphysCopilot/CopilotDemoHandler.cs +++ b/Assets/Scripts/TrajectoryPlanner/UI/EphysCopilot/CopilotDemoHandler.cs @@ -166,6 +166,9 @@ private void OnEnable() private void Update() { + // Cancel if there are no manipulators to control + if (_manipulatorToStates.Count == 0) return; + if (_manipulatorToStates.Values.All(state => state == ManipulatorState.Idle)) { print("All manipulators are at idle"); @@ -176,7 +179,7 @@ private void Update() _goingToDuraText.color = WaitingColor; _insertingText.color = WaitingColor; _retractingText.color = WaitingColor; - + // Set state to traveling SetAllToTraveling(); @@ -196,7 +199,7 @@ private void Update() // Set state to traveling SetAllToTraveling(); - + // Chill for a bit then go to entry coordinate StartCoroutine(Pause(GoToEntryCoordinate)); } @@ -210,7 +213,7 @@ private void Update() _goingToDuraText.color = InProgressColor; _insertingText.color = WaitingColor; _retractingText.color = WaitingColor; - + // Set state to traveling SetAllToTraveling(); @@ -227,7 +230,7 @@ private void Update() _goingToDuraText.color = CompletedColor; _insertingText.color = InProgressColor; _retractingText.color = WaitingColor; - + // Set state to traveling SetAllToTraveling(); @@ -244,7 +247,7 @@ private void Update() _goingToDuraText.color = CompletedColor; _insertingText.color = CompletedColor; _retractingText.color = InProgressColor; - + // Set state to traveling SetAllToTraveling(); @@ -261,7 +264,7 @@ private void Update() _goingToDuraText.color = CompletedColor; _insertingText.color = CompletedColor; _retractingText.color = CompletedColor; - + // Set state to traveling SetAllToTraveling(); From 0cdf5b0837f511d72a76450206e600c98ea67c4a Mon Sep 17 00:00:00 2001 From: Kenneth Yang Date: Thu, 9 Nov 2023 15:32:25 -0800 Subject: [PATCH 65/78] WIP debugging depth --- .../UI/EphysCopilot/CopilotDemoHandler.cs | 28 ++++++++++++------- Assets/StreamingAssets/copilot_demo.json | 4 +-- 2 files changed, 20 insertions(+), 12 deletions(-) diff --git a/Assets/Scripts/TrajectoryPlanner/UI/EphysCopilot/CopilotDemoHandler.cs b/Assets/Scripts/TrajectoryPlanner/UI/EphysCopilot/CopilotDemoHandler.cs index e04794d6..5c04a84f 100644 --- a/Assets/Scripts/TrajectoryPlanner/UI/EphysCopilot/CopilotDemoHandler.cs +++ b/Assets/Scripts/TrajectoryPlanner/UI/EphysCopilot/CopilotDemoHandler.cs @@ -168,7 +168,7 @@ private void Update() { // Cancel if there are no manipulators to control if (_manipulatorToStates.Count == 0) return; - + if (_manipulatorToStates.Values.All(state => state == ManipulatorState.Idle)) { print("All manipulators are at idle"); @@ -424,15 +424,23 @@ private void Retract() CommunicationManager.Instance.DriveToDepth( manipulatorData.Key.ManipulatorBehaviorController.ManipulatorID, manipulatorData.Value.Depth - CLOSE_TO_TARGET_DISTANCE, CLOSE_MOVEMENT_SPEED, - _ => CommunicationManager.Instance.DriveToDepth( - manipulatorData.Key.ManipulatorBehaviorController.ManipulatorID, - manipulatorData.Value.DuraPos.w - EXIT_MARGIN_DEPTH, INSIDE_MOVEMENT_SPEED, - _ => CommunicationManager.Instance.GotoPos( + _ => + { + print("At close distance"); + CommunicationManager.Instance.DriveToDepth( manipulatorData.Key.ManipulatorBehaviorController.ManipulatorID, - manipulatorData.Value.EntryCoordinatePos, OUTSIDE_MOVEMENT_SPEED, - _ => _manipulatorToStates[manipulatorData.Key] = ManipulatorState.Retracted, - Debug.LogError), - Debug.LogError), + manipulatorData.Value.DuraPos.w - EXIT_MARGIN_DEPTH, INSIDE_MOVEMENT_SPEED, + _ => + { + print("At exit margin depth"); + StartCoroutine(Pause(() => CommunicationManager.Instance.GotoPos( + manipulatorData.Key.ManipulatorBehaviorController.ManipulatorID, + manipulatorData.Value.EntryCoordinatePos, OUTSIDE_MOVEMENT_SPEED, + _ => _manipulatorToStates[manipulatorData.Key] = ManipulatorState.Retracted, + Debug.LogError), 2)); + }, + Debug.LogError); + }, Debug.LogError); } @@ -459,7 +467,7 @@ private static bool IsCoterminal(Vector3 first, Vector3 second) /// Timer length in milliseconds private static IEnumerator Pause(Action doAfter, long duration = PAUSE_TIME) { - yield return new WaitForSeconds(duration / 1000f); + yield return new WaitForSeconds(duration); doAfter(); } diff --git a/Assets/StreamingAssets/copilot_demo.json b/Assets/StreamingAssets/copilot_demo.json index 203ea19f..b2e290bf 100644 --- a/Assets/StreamingAssets/copilot_demo.json +++ b/Assets/StreamingAssets/copilot_demo.json @@ -116,8 +116,8 @@ ], "idle": [ 0, - -8693, - 7670 + -7556, + 6916 ], "insertion": [ -1000, From 04ce3c7cb2effb6ff4dd42f11c56c251eb3e0d5e Mon Sep 17 00:00:00 2001 From: Kenneth Yang Date: Thu, 9 Nov 2023 16:05:57 -0800 Subject: [PATCH 66/78] Fixed demo retraction --- Assets/Scenes/TrajectoryPlanner.unity | 24 ++++++++--------- .../UI/EphysCopilot/CopilotDemoHandler.cs | 27 +++++++++---------- 2 files changed, 24 insertions(+), 27 deletions(-) diff --git a/Assets/Scenes/TrajectoryPlanner.unity b/Assets/Scenes/TrajectoryPlanner.unity index edc4b791..aea7beeb 100644 --- a/Assets/Scenes/TrajectoryPlanner.unity +++ b/Assets/Scenes/TrajectoryPlanner.unity @@ -2387,15 +2387,15 @@ PrefabInstance: objectReference: {fileID: 1703646459} - target: {fileID: 341190943836035196, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} propertyPath: m_AnchorMax.y - value: 0 + value: 1 objectReference: {fileID: 0} - target: {fileID: 341190943836035196, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} propertyPath: m_AnchorMin.y - value: 0 + value: 1 objectReference: {fileID: 0} - target: {fileID: 341190943836035196, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} propertyPath: m_AnchoredPosition.x - value: 0 + value: 169.88 objectReference: {fileID: 0} - target: {fileID: 341190943836276264, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} propertyPath: onValueChanged.m_PersistentCalls.m_Calls.Array.data[0].m_Target @@ -2535,19 +2535,19 @@ PrefabInstance: objectReference: {fileID: 1445581475} - target: {fileID: 341190944034978748, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} propertyPath: m_AnchorMax.y - value: 0 + value: 1 objectReference: {fileID: 0} - target: {fileID: 341190944034978748, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} propertyPath: m_AnchorMin.y - value: 0 + value: 1 objectReference: {fileID: 0} - target: {fileID: 341190944034978748, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} propertyPath: m_AnchoredPosition.x - value: 0 + value: 354.84 objectReference: {fileID: 0} - target: {fileID: 341190944034978748, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} propertyPath: m_AnchoredPosition.y - value: 0 + value: -15 objectReference: {fileID: 0} - target: {fileID: 341190944071593138, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} propertyPath: m_AnchorMax.x @@ -2815,19 +2815,19 @@ PrefabInstance: objectReference: {fileID: 0} - target: {fileID: 341190944410943211, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} propertyPath: m_AnchorMax.y - value: 0 + value: 1 objectReference: {fileID: 0} - target: {fileID: 341190944410943211, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} propertyPath: m_AnchorMin.y - value: 0 + value: 1 objectReference: {fileID: 0} - target: {fileID: 341190944410943211, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} propertyPath: m_AnchoredPosition.x - value: 0 + value: 384.91998 objectReference: {fileID: 0} - target: {fileID: 341190944410943211, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} propertyPath: m_AnchoredPosition.y - value: 0 + value: -15 objectReference: {fileID: 0} - target: {fileID: 341190944411999430, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} propertyPath: m_AnchorMax.y @@ -8655,7 +8655,7 @@ PrefabInstance: objectReference: {fileID: 0} - target: {fileID: 8016510558008620337, guid: 482bfae3ba88b424e96d7fcd669f7b73, type: 3} propertyPath: APIUpdateRateEvent.m_PersistentCalls.m_Calls.Array.size - value: 1 + value: 0 objectReference: {fileID: 0} - target: {fileID: 8016510558008620337, guid: 482bfae3ba88b424e96d7fcd669f7b73, type: 3} propertyPath: OpenEphysDataToggle.m_PersistentCalls.m_Calls.Array.size diff --git a/Assets/Scripts/TrajectoryPlanner/UI/EphysCopilot/CopilotDemoHandler.cs b/Assets/Scripts/TrajectoryPlanner/UI/EphysCopilot/CopilotDemoHandler.cs index 5c04a84f..536973b6 100644 --- a/Assets/Scripts/TrajectoryPlanner/UI/EphysCopilot/CopilotDemoHandler.cs +++ b/Assets/Scripts/TrajectoryPlanner/UI/EphysCopilot/CopilotDemoHandler.cs @@ -425,22 +425,19 @@ private void Retract() manipulatorData.Key.ManipulatorBehaviorController.ManipulatorID, manipulatorData.Value.Depth - CLOSE_TO_TARGET_DISTANCE, CLOSE_MOVEMENT_SPEED, _ => - { - print("At close distance"); - CommunicationManager.Instance.DriveToDepth( + CommunicationManager.Instance.GotoPos( manipulatorData.Key.ManipulatorBehaviorController.ManipulatorID, - manipulatorData.Value.DuraPos.w - EXIT_MARGIN_DEPTH, INSIDE_MOVEMENT_SPEED, - _ => - { - print("At exit margin depth"); - StartCoroutine(Pause(() => CommunicationManager.Instance.GotoPos( - manipulatorData.Key.ManipulatorBehaviorController.ManipulatorID, - manipulatorData.Value.EntryCoordinatePos, OUTSIDE_MOVEMENT_SPEED, - _ => _manipulatorToStates[manipulatorData.Key] = ManipulatorState.Retracted, - Debug.LogError), 2)); - }, - Debug.LogError); - }, + manipulatorData.Value.DuraPos, INSIDE_MOVEMENT_SPEED, + duraPos => CommunicationManager.Instance.DriveToDepth( + manipulatorData.Key.ManipulatorBehaviorController.ManipulatorID, + duraPos.w - EXIT_MARGIN_DEPTH, INSIDE_MOVEMENT_SPEED, _ => + CommunicationManager.Instance.GotoPos( + manipulatorData.Key.ManipulatorBehaviorController.ManipulatorID, + manipulatorData.Value.EntryCoordinatePos, OUTSIDE_MOVEMENT_SPEED, + _ => _manipulatorToStates[manipulatorData.Key] = ManipulatorState.Retracted, + Debug.LogError), + Debug.LogError), + Debug.LogError), Debug.LogError); } From 16166eb13d27bbb6486505dc38a5c8fca723386c Mon Sep 17 00:00:00 2001 From: Kenneth Yang Date: Tue, 21 Nov 2023 15:12:48 -0800 Subject: [PATCH 67/78] Upgrade rider --- Packages/manifest.json | 2 +- Packages/packages-lock.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Packages/manifest.json b/Packages/manifest.json index ed48d508..702c1248 100644 --- a/Packages/manifest.json +++ b/Packages/manifest.json @@ -3,7 +3,7 @@ "com.unity.addressables": "1.21.18", "com.unity.ai.navigation": "1.1.5", "com.unity.animation.rigging": "1.2.1", - "com.unity.ide.rider": "3.0.25", + "com.unity.ide.rider": "3.0.26", "com.unity.ide.visualstudio": "2.0.21", "com.unity.ide.vscode": "1.2.5", "com.unity.inputsystem": "1.7.0", diff --git a/Packages/packages-lock.json b/Packages/packages-lock.json index f9a6dc0c..9ed5aa4b 100644 --- a/Packages/packages-lock.json +++ b/Packages/packages-lock.json @@ -57,7 +57,7 @@ "url": "https://packages.unity.com" }, "com.unity.ide.rider": { - "version": "3.0.25", + "version": "3.0.26", "depth": 0, "source": "registry", "dependencies": { From ae3f0e22a05d53e8b3b6cec3135cc13ec3337566 Mon Sep 17 00:00:00 2001 From: Kenneth Yang Date: Tue, 21 Nov 2023 15:36:18 -0800 Subject: [PATCH 68/78] Resolved immediate code errors --- Assets/Scenes/TrajectoryPlanner.unity | 24 +++++++++---------- Assets/Scripts/EphysLink/DataFormats.cs | 5 ---- .../UI/EphysCopilot/DrivePanelHandler.cs | 2 +- .../UI/EphysCopilot/DropdownOpenedNotifier.cs | 3 +-- .../UI/EphysCopilot/EphysCopilotHandler.cs | 4 ++-- .../InsertionOptionColorHandler.cs | 3 +-- .../InsertionSelectionPanelHandler.cs | 4 +--- .../ResetDuraOffsetPanelHandler.cs | 18 +++++++------- .../ResetZeroCoordinatePanelHandler.cs | 2 +- 9 files changed, 28 insertions(+), 37 deletions(-) diff --git a/Assets/Scenes/TrajectoryPlanner.unity b/Assets/Scenes/TrajectoryPlanner.unity index 6b13e3e7..533bff41 100644 --- a/Assets/Scenes/TrajectoryPlanner.unity +++ b/Assets/Scenes/TrajectoryPlanner.unity @@ -38,7 +38,7 @@ RenderSettings: m_ReflectionIntensity: 1 m_CustomReflection: {fileID: 0} m_Sun: {fileID: 0} - m_IndirectSpecularColor: {r: 0.44912726, g: 0.49919963, b: 0.5757154, a: 1} + m_IndirectSpecularColor: {r: 0.44824904, g: 0.49827605, b: 0.5755831, a: 1} m_UseRadianceAmbientProbe: 0 --- !u!157 &3 LightmapSettings: @@ -3119,15 +3119,15 @@ PrefabInstance: objectReference: {fileID: 1703646459} - target: {fileID: 341190943836035196, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} propertyPath: m_AnchorMax.y - value: 1 + value: 0 objectReference: {fileID: 0} - target: {fileID: 341190943836035196, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} propertyPath: m_AnchorMin.y - value: 1 + value: 0 objectReference: {fileID: 0} - target: {fileID: 341190943836035196, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} propertyPath: m_AnchoredPosition.x - value: 169.88 + value: 0 objectReference: {fileID: 0} - target: {fileID: 341190943836276264, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} propertyPath: m_IsOn @@ -3263,19 +3263,19 @@ PrefabInstance: objectReference: {fileID: 0} - target: {fileID: 341190944034978748, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} propertyPath: m_AnchorMax.y - value: 1 + value: 0 objectReference: {fileID: 0} - target: {fileID: 341190944034978748, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} propertyPath: m_AnchorMin.y - value: 1 + value: 0 objectReference: {fileID: 0} - target: {fileID: 341190944034978748, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} propertyPath: m_AnchoredPosition.x - value: 354.84 + value: 0 objectReference: {fileID: 0} - target: {fileID: 341190944034978748, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} propertyPath: m_AnchoredPosition.y - value: -15 + value: 0 objectReference: {fileID: 0} - target: {fileID: 341190944071593138, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} propertyPath: m_AnchorMax.x @@ -3555,19 +3555,19 @@ PrefabInstance: objectReference: {fileID: 0} - target: {fileID: 341190944410943211, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} propertyPath: m_AnchorMax.y - value: 1 + value: 0 objectReference: {fileID: 0} - target: {fileID: 341190944410943211, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} propertyPath: m_AnchorMin.y - value: 1 + value: 0 objectReference: {fileID: 0} - target: {fileID: 341190944410943211, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} propertyPath: m_AnchoredPosition.x - value: 384.91998 + value: 0 objectReference: {fileID: 0} - target: {fileID: 341190944410943211, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} propertyPath: m_AnchoredPosition.y - value: -15 + value: 0 objectReference: {fileID: 0} - target: {fileID: 341190944411999430, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} propertyPath: m_AnchorMax.y diff --git a/Assets/Scripts/EphysLink/DataFormats.cs b/Assets/Scripts/EphysLink/DataFormats.cs index b01489ea..941503db 100644 --- a/Assets/Scripts/EphysLink/DataFormats.cs +++ b/Assets/Scripts/EphysLink/DataFormats.cs @@ -6,8 +6,6 @@ namespace EphysLink { -#pragma warning disable CS0649 - #region Input Data Format /// @@ -103,7 +101,6 @@ public InsideBrainInputDataFormat(string manipulatorId, bool inside) #region Callback Parameters Data Format (Output) - // FIXME: Dependent on Manipulator Type. Should be standardized by Ephys Link. /// /// Returned callback data format containing available manipulator IDs and error message. /// @@ -151,6 +148,4 @@ public struct StateCallbackParameters } #endregion - -#pragma warning restore CS0649 } \ No newline at end of file diff --git a/Assets/Scripts/Pinpoint/UI/EphysCopilot/DrivePanelHandler.cs b/Assets/Scripts/Pinpoint/UI/EphysCopilot/DrivePanelHandler.cs index 8befe461..c8d7d78f 100644 --- a/Assets/Scripts/Pinpoint/UI/EphysCopilot/DrivePanelHandler.cs +++ b/Assets/Scripts/Pinpoint/UI/EphysCopilot/DrivePanelHandler.cs @@ -6,7 +6,7 @@ using UnityEngine; using UnityEngine.UI; -namespace TrajectoryPlanner.UI.EphysCopilot +namespace Pinpoint.UI.EphysCopilot { public class DrivePanelHandler : MonoBehaviour { diff --git a/Assets/Scripts/Pinpoint/UI/EphysCopilot/DropdownOpenedNotifier.cs b/Assets/Scripts/Pinpoint/UI/EphysCopilot/DropdownOpenedNotifier.cs index 967fc276..7cf0d64d 100644 --- a/Assets/Scripts/Pinpoint/UI/EphysCopilot/DropdownOpenedNotifier.cs +++ b/Assets/Scripts/Pinpoint/UI/EphysCopilot/DropdownOpenedNotifier.cs @@ -1,8 +1,7 @@ -using System; using UnityEngine; using UnityEngine.Events; -namespace TrajectoryPlanner.UI.EphysCopilot +namespace Pinpoint.UI.EphysCopilot { public class DropdownOpenedNotifier : MonoBehaviour { diff --git a/Assets/Scripts/Pinpoint/UI/EphysCopilot/EphysCopilotHandler.cs b/Assets/Scripts/Pinpoint/UI/EphysCopilot/EphysCopilotHandler.cs index 4ea1da7d..167443f3 100644 --- a/Assets/Scripts/Pinpoint/UI/EphysCopilot/EphysCopilotHandler.cs +++ b/Assets/Scripts/Pinpoint/UI/EphysCopilot/EphysCopilotHandler.cs @@ -4,7 +4,7 @@ using UnityEngine; using UnityEngine.UI; -namespace TrajectoryPlanner.UI.EphysCopilot +namespace Pinpoint.UI.EphysCopilot { public class EphysCopilotHandler : MonoBehaviour { @@ -149,7 +149,7 @@ private void AddDrivePanel(ProbeManager probeManager) #endregion #region Components - + [Serializable] private class PanelComponents { diff --git a/Assets/Scripts/Pinpoint/UI/EphysCopilot/InsertionOptionColorHandler.cs b/Assets/Scripts/Pinpoint/UI/EphysCopilot/InsertionOptionColorHandler.cs index 68a30886..e3d20b35 100644 --- a/Assets/Scripts/Pinpoint/UI/EphysCopilot/InsertionOptionColorHandler.cs +++ b/Assets/Scripts/Pinpoint/UI/EphysCopilot/InsertionOptionColorHandler.cs @@ -1,10 +1,9 @@ using System; -using System.Linq; using TMPro; using UnityEngine; using UnityEngine.UI; -namespace TrajectoryPlanner.UI.EphysCopilot +namespace Pinpoint.UI.EphysCopilot { public class InsertionOptionColorHandler : MonoBehaviour { diff --git a/Assets/Scripts/Pinpoint/UI/EphysCopilot/InsertionSelectionPanelHandler.cs b/Assets/Scripts/Pinpoint/UI/EphysCopilot/InsertionSelectionPanelHandler.cs index 3954d24f..fa4beda3 100644 --- a/Assets/Scripts/Pinpoint/UI/EphysCopilot/InsertionSelectionPanelHandler.cs +++ b/Assets/Scripts/Pinpoint/UI/EphysCopilot/InsertionSelectionPanelHandler.cs @@ -1,7 +1,5 @@ using System; using System.Collections.Generic; -using System.Linq; -using CoordinateSpaces; using EphysLink; using TMPro; using TrajectoryPlanner.Probes; @@ -9,7 +7,7 @@ using UnityEngine.Events; using UnityEngine.UI; -namespace TrajectoryPlanner.UI.EphysCopilot +namespace Pinpoint.UI.EphysCopilot { public class InsertionSelectionPanelHandler : MonoBehaviour { diff --git a/Assets/Scripts/Pinpoint/UI/EphysCopilot/ResetDuraOffsetPanelHandler.cs b/Assets/Scripts/Pinpoint/UI/EphysCopilot/ResetDuraOffsetPanelHandler.cs index dfc1e458..0c864710 100644 --- a/Assets/Scripts/Pinpoint/UI/EphysCopilot/ResetDuraOffsetPanelHandler.cs +++ b/Assets/Scripts/Pinpoint/UI/EphysCopilot/ResetDuraOffsetPanelHandler.cs @@ -2,10 +2,18 @@ using TrajectoryPlanner.Probes; using UnityEngine; -namespace TrajectoryPlanner.UI.EphysCopilot +namespace Pinpoint.UI.EphysCopilot { public class ResetDuraOffsetPanelHandler : MonoBehaviour { + #region Components + + [SerializeField] private TMP_Text _manipulatorIDText; + public ProbeManager ProbeManager { private get; set; } + private ManipulatorBehaviorController _manipulatorBehaviorController; + + #endregion + #region Unity private void Start() @@ -30,13 +38,5 @@ public void ResetDuraOffset() } #endregion - - #region Components - - [SerializeField] private TMP_Text _manipulatorIDText; - public ProbeManager ProbeManager { private get; set; } - private ManipulatorBehaviorController _manipulatorBehaviorController; - - #endregion } } \ No newline at end of file diff --git a/Assets/Scripts/Pinpoint/UI/EphysCopilot/ResetZeroCoordinatePanelHandler.cs b/Assets/Scripts/Pinpoint/UI/EphysCopilot/ResetZeroCoordinatePanelHandler.cs index 7114cb6e..e16072f6 100644 --- a/Assets/Scripts/Pinpoint/UI/EphysCopilot/ResetZeroCoordinatePanelHandler.cs +++ b/Assets/Scripts/Pinpoint/UI/EphysCopilot/ResetZeroCoordinatePanelHandler.cs @@ -2,7 +2,7 @@ using TMPro; using UnityEngine; -namespace TrajectoryPlanner.UI.EphysCopilot +namespace Pinpoint.UI.EphysCopilot { public class ResetZeroCoordinatePanelHandler : MonoBehaviour { From 67664162b0d02258564ad8bab0d057d78b544926 Mon Sep 17 00:00:00 2001 From: Kenneth Yang Date: Tue, 28 Nov 2023 11:54:34 -0800 Subject: [PATCH 69/78] Fix merge errors for ManipulatorBehaviorController.cs --- .../FourAxisLeftHandedManipulatorTransform.cs | 4 +- ...FourAxisRightHandedManipulatorTransform.cs | 3 +- .../CoordinateSystems/ManipulatorSpace.cs | 3 +- .../Controllers/PlaceholderProbeController.cs | 1 - .../Probes/ManipulatorBehaviorController.cs | 53 +++++++++---------- .../Pinpoint/Probes/ProbeController.cs | 1 - .../Scripts/Pinpoint/Probes/ProbeManager.cs | 2 +- .../Scripts/Pinpoint/TP_ProbeQuickSettings.cs | 1 - 8 files changed, 33 insertions(+), 35 deletions(-) diff --git a/Assets/Scripts/Pinpoint/CoordinateSystems/FourAxisLeftHandedManipulatorTransform.cs b/Assets/Scripts/Pinpoint/CoordinateSystems/FourAxisLeftHandedManipulatorTransform.cs index 1eb2b8a0..0c8746cc 100644 --- a/Assets/Scripts/Pinpoint/CoordinateSystems/FourAxisLeftHandedManipulatorTransform.cs +++ b/Assets/Scripts/Pinpoint/CoordinateSystems/FourAxisLeftHandedManipulatorTransform.cs @@ -1,7 +1,7 @@ -using CoordinateTransforms; +using BrainAtlas.CoordinateSystems; using UnityEngine; -namespace Core.CoordinateSystems +namespace Pinpoint.CoordinateSystems { public sealed class FourAxisLeftHandedManipulatorTransform : AffineTransform { diff --git a/Assets/Scripts/Pinpoint/CoordinateSystems/FourAxisRightHandedManipulatorTransform.cs b/Assets/Scripts/Pinpoint/CoordinateSystems/FourAxisRightHandedManipulatorTransform.cs index 0a3c6b93..f1fd9155 100644 --- a/Assets/Scripts/Pinpoint/CoordinateSystems/FourAxisRightHandedManipulatorTransform.cs +++ b/Assets/Scripts/Pinpoint/CoordinateSystems/FourAxisRightHandedManipulatorTransform.cs @@ -1,6 +1,7 @@ +using BrainAtlas.CoordinateSystems; using UnityEngine; -namespace CoordinateTransforms +namespace Pinpoint.CoordinateSystems { public class FourAxisRightHandedManipulatorTransform : AffineTransform { diff --git a/Assets/Scripts/Pinpoint/CoordinateSystems/ManipulatorSpace.cs b/Assets/Scripts/Pinpoint/CoordinateSystems/ManipulatorSpace.cs index d73aaa69..5d6ffa67 100644 --- a/Assets/Scripts/Pinpoint/CoordinateSystems/ManipulatorSpace.cs +++ b/Assets/Scripts/Pinpoint/CoordinateSystems/ManipulatorSpace.cs @@ -1,6 +1,7 @@ +using BrainAtlas.CoordinateSystems; using UnityEngine; -namespace CoordinateSpaces +namespace Pinpoint.CoordinateSystems { public sealed class ManipulatorSpace : CoordinateSpace { diff --git a/Assets/Scripts/Pinpoint/Probes/Controllers/PlaceholderProbeController.cs b/Assets/Scripts/Pinpoint/Probes/Controllers/PlaceholderProbeController.cs index 0e4f577c..544cb28d 100644 --- a/Assets/Scripts/Pinpoint/Probes/Controllers/PlaceholderProbeController.cs +++ b/Assets/Scripts/Pinpoint/Probes/Controllers/PlaceholderProbeController.cs @@ -1,6 +1,5 @@ using System; using BrainAtlas; -using CoordinateSpaces; using CoordinateTransforms; using UnityEngine; diff --git a/Assets/Scripts/Pinpoint/Probes/ManipulatorBehaviorController.cs b/Assets/Scripts/Pinpoint/Probes/ManipulatorBehaviorController.cs index 43de6046..6441a588 100644 --- a/Assets/Scripts/Pinpoint/Probes/ManipulatorBehaviorController.cs +++ b/Assets/Scripts/Pinpoint/Probes/ManipulatorBehaviorController.cs @@ -1,14 +1,15 @@ using System; using System.Globalization; using System.Linq; -using CoordinateSpaces; +using BrainAtlas; +using BrainAtlas.CoordinateSystems; using CoordinateTransforms; -using Core.CoordinateSystems; using EphysLink; +using Pinpoint.CoordinateSystems; using UnityEngine; using UnityEngine.Events; -namespace TrajectoryPlanner.Probes +namespace Pinpoint.Probes { public class ManipulatorBehaviorController : MonoBehaviour { @@ -23,7 +24,6 @@ public class ManipulatorBehaviorController : MonoBehaviour [SerializeField] private ProbeManager _probeManager; [SerializeField] private ProbeController _probeController; - private readonly CCFAnnotationDataset _annotationDataset = VolumeDatasetManager.AnnotationDataset; #endregion @@ -75,7 +75,7 @@ public bool IsSetToDropToSurfaceWithDepth } public CoordinateSpace CoordinateSpace { get; private set; } - private CoordinateTransform Transform { get; set; } + private CoordinateTransform CoordinateTransform { get; set; } public bool IsRightHanded { @@ -168,8 +168,7 @@ private void EchoPosition(Vector4 pos) var zeroCoordinateAdjustedManipulatorPosition = pos - ZeroCoordinateOffset; // Convert to coordinate space - var manipulatorSpacePosition = - Transform.Transform2Space(zeroCoordinateAdjustedManipulatorPosition); + var manipulatorSpacePosition = CoordinateTransform.T2U(zeroCoordinateAdjustedManipulatorPosition); // Brain surface adjustment var brainSurfaceAdjustment = float.IsNaN(BrainSurfaceOffset) ? 0 : BrainSurfaceOffset; @@ -184,10 +183,10 @@ private void EchoPosition(Vector4 pos) // Set probe position (change axes to match probe) var transformedApmldv = - _probeController.Insertion.World2TransformedAxisChange(zeroCoordinateAdjustedWorldPosition); + _probeController.Insertion.World2T_Vector(zeroCoordinateAdjustedWorldPosition); // Split between 3 and 4 axis assignments - if (Transform.Prefix == "3lhm") + if (CoordinateTransform.Prefix == "3lhm") _probeController.SetProbePosition(transformedApmldv); else _probeController.SetProbePosition(new Vector4(transformedApmldv.x, transformedApmldv.y, @@ -206,9 +205,9 @@ private void EchoPosition(Vector4 pos) "ephys_link", Time.realtimeSinceStartup.ToString(CultureInfo.InvariantCulture), ManipulatorID, pos.x.ToString(CultureInfo.InvariantCulture), pos.y.ToString(CultureInfo.InvariantCulture), pos.z.ToString(CultureInfo.InvariantCulture), pos.w.ToString(CultureInfo.InvariantCulture), - _probeController.Insertion.yaw.ToString(CultureInfo.InvariantCulture), - _probeController.Insertion.pitch.ToString(CultureInfo.InvariantCulture), - _probeController.Insertion.roll.ToString(CultureInfo.InvariantCulture), + _probeController.Insertion.Yaw.ToString(CultureInfo.InvariantCulture), + _probeController.Insertion.Pitch.ToString(CultureInfo.InvariantCulture), + _probeController.Insertion.Roll.ToString(CultureInfo.InvariantCulture), tipPos.x.ToString(CultureInfo.InvariantCulture), tipPos.y.ToString(CultureInfo.InvariantCulture), tipPos.z.ToString(CultureInfo.InvariantCulture) }; @@ -271,24 +270,24 @@ void StartEchoing() public void UpdateSpaceAndTransform() { CoordinateSpace = new ManipulatorSpace(); - Transform = NumAxes switch + CoordinateTransform = NumAxes switch { 4 => IsRightHanded - ? new FourAxisRightHandedManipulatorTransform(_probeController.Insertion.yaw) - : new FourAxisLeftHandedManipulatorTransform(_probeController.Insertion.yaw), - 3 => new ThreeAxisLeftHandedTransform(_probeController.Insertion.yaw, _probeController.Insertion.pitch), - _ => Transform + ? new FourAxisRightHandedManipulatorTransform(_probeController.Insertion.Yaw) + : new FourAxisLeftHandedManipulatorTransform(_probeController.Insertion.Yaw), + 3 => new ThreeAxisLeftHandedTransform(_probeController.Insertion.Yaw, _probeController.Insertion.Pitch), + _ => CoordinateTransform }; } public Vector4 ConvertInsertionAPMLDVToManipulatorPosition(Vector3 insertionAPMLDV) { // Convert apmldv to world coordinate - var convertToWorld = _probeManager.ProbeController.Insertion.Transformed2WorldAxisChange(insertionAPMLDV); + var convertToWorld = _probeManager.ProbeController.Insertion.T2World_Vector(insertionAPMLDV); - // Convert to Sensapex space + // Convert to Manipulator space var posInManipulatorSpace = CoordinateSpace.World2Space(convertToWorld); - Vector4 posInManipulatorTransform = Transform.Space2Transform(posInManipulatorSpace); + Vector4 posInManipulatorTransform = CoordinateTransform.U2T(posInManipulatorSpace); // Apply brain surface offset var brainSurfaceAdjustment = float.IsNaN(BrainSurfaceOffset) @@ -319,10 +318,10 @@ public void ComputeBrainSurfaceOffset() var tipExtensionDirection = IsSetToDropToSurfaceWithDepth ? _probeController.GetTipWorldU().tipUpWorldU : Vector3.up; - var brainSurfaceCoordinate = _annotationDataset.FindSurfaceCoordinate( - _annotationDataset.CoordinateSpace.World2Space(_probeController.GetTipWorldU().tipCoordWorldU - + var brainSurfaceCoordinate = _probeManager.FindSurfaceIdxCoordinate( + BrainAtlasManager.ActiveReferenceAtlas.World2AtlasIdx(_probeController.GetTipWorldU().tipCoordWorldU - tipExtensionDirection * 5), - _annotationDataset.CoordinateSpace.World2SpaceAxisChange(tipExtensionDirection)); + BrainAtlasManager.ActiveReferenceAtlas.World2Atlas_Vector(tipExtensionDirection)); if (float.IsNaN(brainSurfaceCoordinate.x)) { @@ -331,8 +330,8 @@ public void ComputeBrainSurfaceOffset() } var brainSurfaceToTransformed = - _probeController.Insertion.World2Transformed( - _annotationDataset.CoordinateSpace.Space2World(brainSurfaceCoordinate)); + _probeController.Insertion.World2T( + BrainAtlasManager.ActiveReferenceAtlas.World2AtlasIdx(brainSurfaceCoordinate)); BrainSurfaceOffset += Vector3.Distance(brainSurfaceToTransformed, _probeController.Insertion.apmldv); @@ -358,8 +357,8 @@ public void MoveByWorldSpaceDelta(Vector4 worldSpaceDelta, Action onSucces Action onErrorCallback = null) { // Convert to manipulator axes (world -> space -> transform) - var manipulatorSpaceDelta = CoordinateSpace.World2SpaceAxisChange(worldSpaceDelta); - var manipulatorTransformDelta = Transform.Space2Transform(manipulatorSpaceDelta); + var manipulatorSpaceDelta = CoordinateSpace.World2Space_Vector(worldSpaceDelta); + var manipulatorTransformDelta = CoordinateTransform.U2T(manipulatorSpaceDelta); var manipulatorSpaceDepth = worldSpaceDelta.w; print("World space delta: " + worldSpaceDelta + "; Manipulator space delta: " + manipulatorSpaceDelta + diff --git a/Assets/Scripts/Pinpoint/Probes/ProbeController.cs b/Assets/Scripts/Pinpoint/Probes/ProbeController.cs index 800a336a..a2200432 100644 --- a/Assets/Scripts/Pinpoint/Probes/ProbeController.cs +++ b/Assets/Scripts/Pinpoint/Probes/ProbeController.cs @@ -1,6 +1,5 @@ using UnityEngine; using UnityEngine.Events; -using CoordinateSpaces; using CoordinateTransforms; using BrainAtlas; using BrainAtlas.CoordinateSystems; diff --git a/Assets/Scripts/Pinpoint/Probes/ProbeManager.cs b/Assets/Scripts/Pinpoint/Probes/ProbeManager.cs index 0617967e..a9da401a 100644 --- a/Assets/Scripts/Pinpoint/Probes/ProbeManager.cs +++ b/Assets/Scripts/Pinpoint/Probes/ProbeManager.cs @@ -5,7 +5,7 @@ using System.Threading.Tasks; using BrainAtlas; using EphysLink; -using TrajectoryPlanner.Probes; +using Pinpoint.Probes; using UnityEngine; using UnityEngine.Events; using UnityEngine.Serialization; diff --git a/Assets/Scripts/Pinpoint/TP_ProbeQuickSettings.cs b/Assets/Scripts/Pinpoint/TP_ProbeQuickSettings.cs index 564e7de5..6f109805 100644 --- a/Assets/Scripts/Pinpoint/TP_ProbeQuickSettings.cs +++ b/Assets/Scripts/Pinpoint/TP_ProbeQuickSettings.cs @@ -1,7 +1,6 @@ using System.Linq; using EphysLink; using TMPro; -using TrajectoryPlanner.Probes; using UnityEngine; using UnityEngine.Serialization; using UnityEngine.UI; From 35aea89a5598a0f3309ecbc36e9437a48fac0d50 Mon Sep 17 00:00:00 2001 From: Kenneth Yang Date: Tue, 28 Nov 2023 12:06:19 -0800 Subject: [PATCH 70/78] DrivePanelHandler.cs --- .../UI/EphysCopilot/CopilotDemoHandler.cs | 482 ------------------ .../EphysCopilot/CopilotDemoHandler.cs.meta | 11 - .../UI/EphysCopilot/DrivePanelHandler.cs | 15 +- .../InsertionSelectionPanelHandler.cs | 6 +- 4 files changed, 8 insertions(+), 506 deletions(-) delete mode 100644 Assets/Scripts/Pinpoint/UI/EphysCopilot/CopilotDemoHandler.cs delete mode 100644 Assets/Scripts/Pinpoint/UI/EphysCopilot/CopilotDemoHandler.cs.meta diff --git a/Assets/Scripts/Pinpoint/UI/EphysCopilot/CopilotDemoHandler.cs b/Assets/Scripts/Pinpoint/UI/EphysCopilot/CopilotDemoHandler.cs deleted file mode 100644 index 536973b6..00000000 --- a/Assets/Scripts/Pinpoint/UI/EphysCopilot/CopilotDemoHandler.cs +++ /dev/null @@ -1,482 +0,0 @@ -using System; -using System.Collections; -using System.Collections.Generic; -using System.Diagnostics.CodeAnalysis; -using System.IO; -using System.Linq; -using EphysLink; -using TMPro; -using UnityEngine; - -namespace TrajectoryPlanner.UI.EphysCopilot -{ - #region Structures - - [Serializable] - [SuppressMessage("ReSharper", "InconsistentNaming")] - internal struct DemoDataJson - { - public List data; - } - - [Serializable] - [SuppressMessage("ReSharper", "InconsistentNaming")] - internal struct ManipulatorDataJson - { - public List angle; - public List idle; - public List insertion; - } - - /// - /// Angle: Yaw, Pitch, Roll - /// Idle: AP, ML, DV - /// Insertion: AP, ML, DV, Depth - /// - internal struct ManipulatorData - { - public Vector3 Angle; - public Vector4 IdlePos; - public Vector4 EntryCoordinatePos; - public Vector4 DuraPos; - public float Depth; - } - - internal enum ManipulatorState - { - Idle, - Calibrated, - AtEntryCoordinate, - AtDura, - Inserted, - Retracted, - Traveling - } - - #endregion - - - public class CopilotDemoHandler : MonoBehaviour - { - #region Constants - - // Manipulator movement speed when outside in mm/s - private const float OUTSIDE_MOVEMENT_SPEED = 1.5f; - - // Manipulator movement speed when inside in mm/s - private const float INSIDE_MOVEMENT_SPEED = .75f; - - // Manipulator movement speed when close to target in mm/s - private const float CLOSE_MOVEMENT_SPEED = 0.3f; - - // DV ceiling in um - private const float DV_CEILING = 3500f; - - // Close to target distance (mm) - private const float CLOSE_TO_TARGET_DISTANCE = 0.1f; - - // Exit margin depth (mm) - private const float EXIT_MARGIN_DEPTH = 0.1f; - - // Go past distance (mm) - private const float GO_PAST_DISTANCE = 0.05f; - - // Pause time in seconds - private const long PAUSE_TIME = 1; - - #endregion - - #region Components - - [SerializeField] private TMP_Text _calibratingToBregmaText; - [SerializeField] private TMP_Text _goingToEntryCoordinateText; - [SerializeField] private TMP_Text _goingToDuraText; - [SerializeField] private TMP_Text _insertingText; - [SerializeField] private TMP_Text _retractingText; - - [SerializeField] private GameObject _startButton; - [SerializeField] private GameObject _stopButton; - [SerializeField] private BrainCameraController _brainCameraController; - - #endregion - - #region Properties - - private readonly Dictionary _demoManipulatorToData = new(); - private readonly Dictionary _manipulatorToStates = new(); - - - // Text progress colors - private static Color WaitingColor => ProbeProperties.ProbeColors[15]; - private static Color InProgressColor => ProbeProperties.ProbeColors[3]; - private static Color CompletedColor => ProbeProperties.ProbeColors[5]; - - #endregion - - #region Unity - - private void OnEnable() - { - // Parse JSON - var jsonString = File.ReadAllText(Application.streamingAssetsPath + "/copilot_demo.json"); - var data = JsonUtility.FromJson(jsonString); - - // Convert to ManipulatorData and match with manipulator - foreach (var manipulatorData in data.data) - { - var convertedAngle = new Vector3(manipulatorData.angle[0], manipulatorData.angle[1], - manipulatorData.angle[2]); - - // Match to manipulator - var matchingManipulator = ProbeManager.Instances.FirstOrDefault( - manager => manager.IsEphysLinkControlled && - IsCoterminal(manager.ProbeController.Insertion.angles, convertedAngle)); - - // Skip if there are no matching manipulators - if (matchingManipulator == null) continue; - - // Convert data - var convertedData = new ManipulatorData - { - Angle = convertedAngle, - IdlePos = - matchingManipulator.ManipulatorBehaviorController.ConvertInsertionAPMLDVToManipulatorPosition( - new Vector3(manipulatorData.idle[0], manipulatorData.idle[1], manipulatorData.idle[2]) / - 1000f), - EntryCoordinatePos = - matchingManipulator.ManipulatorBehaviorController.ConvertInsertionAPMLDVToManipulatorPosition( - new Vector3(manipulatorData.insertion[0], manipulatorData.insertion[1], DV_CEILING) / - 1000f), - DuraPos = - matchingManipulator.ManipulatorBehaviorController.ConvertInsertionAPMLDVToManipulatorPosition( - new Vector3(manipulatorData.insertion[0], manipulatorData.insertion[1], - manipulatorData.insertion[2]) / 1000f) - }; - convertedData.Depth = convertedData.DuraPos.w + manipulatorData.insertion[3] / 1000f; - - _demoManipulatorToData.Add(matchingManipulator, convertedData); - - // Default to traveling state on setup (will be moving to Idle soon) - _manipulatorToStates.Add(matchingManipulator, ManipulatorState.Traveling); - } - - // Show start button if there are manipulators to control - _startButton.SetActive(_demoManipulatorToData.Count > 0); - } - - private void Update() - { - // Cancel if there are no manipulators to control - if (_manipulatorToStates.Count == 0) return; - - if (_manipulatorToStates.Values.All(state => state == ManipulatorState.Idle)) - { - print("All manipulators are at idle"); - - // Set text colors - _calibratingToBregmaText.color = InProgressColor; - _goingToEntryCoordinateText.color = WaitingColor; - _goingToDuraText.color = WaitingColor; - _insertingText.color = WaitingColor; - _retractingText.color = WaitingColor; - - // Set state to traveling - SetAllToTraveling(); - - // Chill for a bit then calibrate - StartCoroutine(Pause(Calibrate)); - } - else if (_manipulatorToStates.Values.All(state => state == ManipulatorState.Calibrated)) - { - print("All manipulators are calibrated"); - - // Set text colors - _calibratingToBregmaText.color = CompletedColor; - _goingToEntryCoordinateText.color = InProgressColor; - _goingToDuraText.color = WaitingColor; - _insertingText.color = WaitingColor; - _retractingText.color = WaitingColor; - - // Set state to traveling - SetAllToTraveling(); - - // Chill for a bit then go to entry coordinate - StartCoroutine(Pause(GoToEntryCoordinate)); - } - else if (_manipulatorToStates.Values.All(state => state == ManipulatorState.AtEntryCoordinate)) - { - print("All manipulators are at entry coordinate"); - - // Set text colors - _calibratingToBregmaText.color = CompletedColor; - _goingToEntryCoordinateText.color = CompletedColor; - _goingToDuraText.color = InProgressColor; - _insertingText.color = WaitingColor; - _retractingText.color = WaitingColor; - - // Set state to traveling - SetAllToTraveling(); - - // Chill for a bit then go to dura - StartCoroutine(Pause(GoToDura)); - } - else if (_manipulatorToStates.Values.All(state => state == ManipulatorState.AtDura)) - { - print("All manipulators are at dura"); - - // Set text colors - _calibratingToBregmaText.color = CompletedColor; - _goingToEntryCoordinateText.color = CompletedColor; - _goingToDuraText.color = CompletedColor; - _insertingText.color = InProgressColor; - _retractingText.color = WaitingColor; - - // Set state to traveling - SetAllToTraveling(); - - // Chill for a bit then go to target insertion - StartCoroutine(Pause(Insert)); - } - else if (_manipulatorToStates.Values.All(state => state == ManipulatorState.Inserted)) - { - print("All manipulators are inserted"); - - // Set text colors - _calibratingToBregmaText.color = CompletedColor; - _goingToEntryCoordinateText.color = CompletedColor; - _goingToDuraText.color = CompletedColor; - _insertingText.color = CompletedColor; - _retractingText.color = InProgressColor; - - // Set state to traveling - SetAllToTraveling(); - - // Chill for a bit then bring them back out - StartCoroutine(Pause(Retract)); - } - else if (_manipulatorToStates.Values.All(state => state == ManipulatorState.Retracted)) - { - print("All manipulators are retracted"); - - // Set text colors - _calibratingToBregmaText.color = CompletedColor; - _goingToEntryCoordinateText.color = CompletedColor; - _goingToDuraText.color = CompletedColor; - _insertingText.color = CompletedColor; - _retractingText.color = CompletedColor; - - // Set state to traveling - SetAllToTraveling(); - - // Chill for a bit then go back to idle - StartCoroutine(Pause(GoToIdle)); - } - } - - #endregion - - #region UI Functions - - public void OnStartPressed() - { - // Set all manipulators to can write - var manipulatorIndex = 0; - SetCanWrite(_demoManipulatorToData.Keys.ToList()[manipulatorIndex]); - return; - - void SetCanWrite(ProbeManager manipulator) - { - CommunicationManager.Instance.SetCanWrite(manipulator.ManipulatorBehaviorController.ManipulatorID, true, - 100, _ => - { - if (++manipulatorIndex < _demoManipulatorToData.Count) - SetCanWrite(_demoManipulatorToData.Keys.ToList()[manipulatorIndex]); - else - ActuallyStart(); - }); - } - - void ActuallyStart() - { - // Swap start and stop buttons - _startButton.SetActive(false); - _stopButton.SetActive(true); - - // Reset state colors - _calibratingToBregmaText.color = WaitingColor; - _goingToEntryCoordinateText.color = WaitingColor; - _goingToDuraText.color = WaitingColor; - _insertingText.color = WaitingColor; - _retractingText.color = WaitingColor; - - // Start brain rotation - _brainCameraController.SetCameraContinuousRotation(true); - - // Move to idle position - SetAllToTraveling(); - GoToIdle(); - } - } - - public void OnStopPressed() - { - CommunicationManager.Instance.Stop(_ => print("Stopped")); - - // Swap start and stop buttons - _startButton.SetActive(true); - _stopButton.SetActive(false); - - // Stop brain rotation - _brainCameraController.SetCameraContinuousRotation(false); - } - - #endregion - - #region Movement Functions - - private void GoToIdle() - { - foreach (var manipulatorToData in _demoManipulatorToData) - CommunicationManager.Instance.GotoPos( - manipulatorToData.Key.ManipulatorBehaviorController.ManipulatorID, - manipulatorToData.Value.IdlePos, OUTSIDE_MOVEMENT_SPEED, - _ => _manipulatorToStates[manipulatorToData.Key] = ManipulatorState.Idle, Debug.LogError); - } - - private void Calibrate() - { - var manipulatorIndex = 0; - CalibrateManipulator(_demoManipulatorToData.Keys.ToList()[manipulatorIndex]); - return; - - void CalibrateManipulator(ProbeManager manipulator) - { - var manipulatorBehaviorController = manipulator.ManipulatorBehaviorController; - - // Goto above bregma then down to bregma - CommunicationManager.Instance.GotoPos(manipulatorBehaviorController.ManipulatorID, - manipulatorBehaviorController.ZeroCoordinateOffset + new Vector4(0, DV_CEILING / 1000f, 0, 0), - OUTSIDE_MOVEMENT_SPEED, _ => - CommunicationManager.Instance.GotoPos(manipulatorBehaviorController.ManipulatorID, - manipulatorBehaviorController.ZeroCoordinateOffset, - OUTSIDE_MOVEMENT_SPEED, - _ => - { - // Come back to idle - StartCoroutine(Pause(() => CommunicationManager.Instance.GotoPos( - manipulatorBehaviorController.ManipulatorID, - _demoManipulatorToData[manipulator].IdlePos, - OUTSIDE_MOVEMENT_SPEED, - _ => - { - // Complete and start next manipulator - StartCoroutine(Pause(() => - { - _manipulatorToStates[manipulator] = ManipulatorState.Calibrated; - if (++manipulatorIndex < _demoManipulatorToData.Count) - CalibrateManipulator( - _demoManipulatorToData.Keys.ToList()[manipulatorIndex]); - })); - }, Debug.LogError))); - }, Debug.LogError), - Debug.LogError); - } - } - - private void GoToEntryCoordinate() - { - foreach (var manipulatorData in _demoManipulatorToData) - CommunicationManager.Instance.GotoPos(manipulatorData.Key.ManipulatorBehaviorController.ManipulatorID, - manipulatorData.Value.EntryCoordinatePos, OUTSIDE_MOVEMENT_SPEED, - _ => _manipulatorToStates[manipulatorData.Key] = ManipulatorState.AtEntryCoordinate, - Debug.LogError); - } - - private void GoToDura() - { - foreach (var manipulatorData in _demoManipulatorToData) - CommunicationManager.Instance.GotoPos(manipulatorData.Key.ManipulatorBehaviorController.ManipulatorID, - manipulatorData.Value.DuraPos, OUTSIDE_MOVEMENT_SPEED, - _ => _manipulatorToStates[manipulatorData.Key] = ManipulatorState.AtDura, Debug.LogError); - } - - private void Insert() - { - foreach (var manipulatorData in _demoManipulatorToData) - CommunicationManager.Instance.DriveToDepth( - manipulatorData.Key.ManipulatorBehaviorController.ManipulatorID, - manipulatorData.Value.Depth - CLOSE_TO_TARGET_DISTANCE, - INSIDE_MOVEMENT_SPEED, - _ => CommunicationManager.Instance.DriveToDepth( - manipulatorData.Key.ManipulatorBehaviorController.ManipulatorID, - manipulatorData.Value.Depth + GO_PAST_DISTANCE, CLOSE_MOVEMENT_SPEED, - _ => CommunicationManager.Instance.DriveToDepth( - manipulatorData.Key.ManipulatorBehaviorController.ManipulatorID, - manipulatorData.Value.Depth, CLOSE_MOVEMENT_SPEED, - _ => _manipulatorToStates[manipulatorData.Key] = ManipulatorState.Inserted, Debug.LogError), - Debug.LogError), - Debug.LogError); - } - - private void Retract() - { - foreach (var manipulatorData in _demoManipulatorToData) - CommunicationManager.Instance.DriveToDepth( - manipulatorData.Key.ManipulatorBehaviorController.ManipulatorID, - manipulatorData.Value.Depth - CLOSE_TO_TARGET_DISTANCE, CLOSE_MOVEMENT_SPEED, - _ => - CommunicationManager.Instance.GotoPos( - manipulatorData.Key.ManipulatorBehaviorController.ManipulatorID, - manipulatorData.Value.DuraPos, INSIDE_MOVEMENT_SPEED, - duraPos => CommunicationManager.Instance.DriveToDepth( - manipulatorData.Key.ManipulatorBehaviorController.ManipulatorID, - duraPos.w - EXIT_MARGIN_DEPTH, INSIDE_MOVEMENT_SPEED, _ => - CommunicationManager.Instance.GotoPos( - manipulatorData.Key.ManipulatorBehaviorController.ManipulatorID, - manipulatorData.Value.EntryCoordinatePos, OUTSIDE_MOVEMENT_SPEED, - _ => _manipulatorToStates[manipulatorData.Key] = ManipulatorState.Retracted, - Debug.LogError), - Debug.LogError), - Debug.LogError), - Debug.LogError); - } - - #endregion - - #region Helper functions - - /// - /// Determine if two Vector3 angles are coterminal - /// - /// one Vector3 angle - /// another Vector3 angle - /// - private static bool IsCoterminal(Vector3 first, Vector3 second) - { - return Mathf.Abs(first.x - second.x) % 360 < 0.01f && Mathf.Abs(first.y - second.y) % 360 < 0.01f && - Mathf.Abs(first.z - second.z) % 360 < 0.01f; - } - - /// - /// Basic spin timer - /// - /// Callback after timer ends - /// Timer length in milliseconds - private static IEnumerator Pause(Action doAfter, long duration = PAUSE_TIME) - { - yield return new WaitForSeconds(duration); - doAfter(); - } - - /// - /// Set all manipulator states to Traveling - /// - private void SetAllToTraveling() - { - foreach (var manipulatorData in _demoManipulatorToData) - _manipulatorToStates[manipulatorData.Key] = ManipulatorState.Traveling; - } - - #endregion - } -} \ No newline at end of file diff --git a/Assets/Scripts/Pinpoint/UI/EphysCopilot/CopilotDemoHandler.cs.meta b/Assets/Scripts/Pinpoint/UI/EphysCopilot/CopilotDemoHandler.cs.meta deleted file mode 100644 index dae3ebf7..00000000 --- a/Assets/Scripts/Pinpoint/UI/EphysCopilot/CopilotDemoHandler.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 78f91eb601d18cf4ca076cc899036bd8 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Pinpoint/UI/EphysCopilot/DrivePanelHandler.cs b/Assets/Scripts/Pinpoint/UI/EphysCopilot/DrivePanelHandler.cs index 1fe4f79f..33091384 100644 --- a/Assets/Scripts/Pinpoint/UI/EphysCopilot/DrivePanelHandler.cs +++ b/Assets/Scripts/Pinpoint/UI/EphysCopilot/DrivePanelHandler.cs @@ -1,11 +1,10 @@ -using System; -using System.Collections; using EphysLink; using TMPro; +using TrajectoryPlanner.UI.EphysCopilot; using UnityEngine; using UnityEngine.UI; -namespace TrajectoryPlanner.UI.EphysCopilot +namespace Pinpoint.UI.EphysCopilot { public class DrivePanelHandler : MonoBehaviour { @@ -218,7 +217,7 @@ private float _targetDriveDistance // Calibrate target insertion depth based on surface position var targetInsertion = new ProbeInsertion( InsertionSelectionPanelHandler.ManipulatorIDToSelectedTargetProbeManager[ - _manipulatorId].ProbeController.Insertion, false); + _manipulatorId].ProbeController.Insertion); var targetPositionWorldT = targetInsertion.PositionWorldT(); var relativePositionWorldT = ProbeManager.ProbeController.Insertion.PositionWorldT() - targetPositionWorldT; @@ -229,9 +228,7 @@ private float _targetDriveDistance targetPositionWorldT + offsetAdjustedRelativeTargetPositionWorldT; // Converting worldT back to APMLDV (position transformed) - targetInsertion.apmldv = - targetInsertion.CoordinateTransform.Space2TransformAxisChange( - targetInsertion.CoordinateSpace.World2Space(offsetAdjustedTargetPositionWorldT)); + targetInsertion.apmldv = targetInsertion.World2T(offsetAdjustedTargetPositionWorldT); return Vector3.Distance(targetInsertion.apmldv, _duraAPMLDV); } @@ -245,7 +242,7 @@ private Vector4 _outsidePosition // Create outside position APMLDV var targetAPMLDV = _duraAPMLDV; targetAPMLDV.z = ProbeManager.ProbeController.Insertion - .World2TransformedAxisChange(InsertionSelectionPanelHandler.PRE_DEPTH_DRIVE_DV_OFFSET).z; + .World2T_Vector(InsertionSelectionPanelHandler.PRE_DEPTH_DRIVE_DV_OFFSET).z; // Convert to manipulator position return ProbeManager.ManipulatorBehaviorController.ConvertInsertionAPMLDVToManipulatorPosition( @@ -555,10 +552,8 @@ public void Exit() // Drive to outside position if (position.y < _outsidePosition.y) - { CommunicationManager.Instance.GotoPos(_manipulatorId, _outsidePosition, _outsideDriveSpeed, _ => CompleteOutside(), Debug.LogError); - } // Drive to outside depth if DV movement is unavailable else if (position.w > _outsideDepth) CommunicationManager.Instance.DriveToDepth(_manipulatorId, _outsideDepth, diff --git a/Assets/Scripts/Pinpoint/UI/EphysCopilot/InsertionSelectionPanelHandler.cs b/Assets/Scripts/Pinpoint/UI/EphysCopilot/InsertionSelectionPanelHandler.cs index c29899e6..35d2e4f8 100644 --- a/Assets/Scripts/Pinpoint/UI/EphysCopilot/InsertionSelectionPanelHandler.cs +++ b/Assets/Scripts/Pinpoint/UI/EphysCopilot/InsertionSelectionPanelHandler.cs @@ -1,15 +1,15 @@ using System; using System.Collections.Generic; +using System.Drawing.Drawing2D; using System.Linq; -using CoordinateSpaces; using EphysLink; +using Pinpoint.Probes; using TMPro; -using TrajectoryPlanner.Probes; using UnityEngine; using UnityEngine.Events; using UnityEngine.UI; -namespace TrajectoryPlanner.UI.EphysCopilot +namespace Pinpoint.UI.EphysCopilot { public class InsertionSelectionPanelHandler : MonoBehaviour { From 2ad550c1a3bff187db08352ded38c6fbefd386d8 Mon Sep 17 00:00:00 2001 From: Kenneth Yang Date: Tue, 28 Nov 2023 12:06:53 -0800 Subject: [PATCH 71/78] EphysCopilotHandler.cs --- Assets/Scripts/Pinpoint/UI/EphysCopilot/DrivePanelHandler.cs | 1 - .../Pinpoint/UI/EphysCopilot/ResetDuraOffsetPanelHandler.cs | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/Assets/Scripts/Pinpoint/UI/EphysCopilot/DrivePanelHandler.cs b/Assets/Scripts/Pinpoint/UI/EphysCopilot/DrivePanelHandler.cs index 33091384..bedbcfc8 100644 --- a/Assets/Scripts/Pinpoint/UI/EphysCopilot/DrivePanelHandler.cs +++ b/Assets/Scripts/Pinpoint/UI/EphysCopilot/DrivePanelHandler.cs @@ -1,6 +1,5 @@ using EphysLink; using TMPro; -using TrajectoryPlanner.UI.EphysCopilot; using UnityEngine; using UnityEngine.UI; diff --git a/Assets/Scripts/Pinpoint/UI/EphysCopilot/ResetDuraOffsetPanelHandler.cs b/Assets/Scripts/Pinpoint/UI/EphysCopilot/ResetDuraOffsetPanelHandler.cs index 45c89737..cf547ad0 100644 --- a/Assets/Scripts/Pinpoint/UI/EphysCopilot/ResetDuraOffsetPanelHandler.cs +++ b/Assets/Scripts/Pinpoint/UI/EphysCopilot/ResetDuraOffsetPanelHandler.cs @@ -3,7 +3,7 @@ using TMPro; using UnityEngine; -namespace TrajectoryPlanner.UI.EphysCopilot +namespace Pinpoint.UI.EphysCopilot { public class ResetDuraOffsetPanelHandler : MonoBehaviour { From ad41e758a3a428fbd3c9aa61079b89b52c910d9e Mon Sep 17 00:00:00 2001 From: Kenneth Yang Date: Tue, 28 Nov 2023 12:24:52 -0800 Subject: [PATCH 72/78] InsertionSelectionPanelHandler.cs --- .../InsertionSelectionPanelHandler.cs | 50 +++++++++---------- .../trajectoryplanner.ui.ephyscopilot.asmdef | 5 +- 2 files changed, 28 insertions(+), 27 deletions(-) diff --git a/Assets/Scripts/Pinpoint/UI/EphysCopilot/InsertionSelectionPanelHandler.cs b/Assets/Scripts/Pinpoint/UI/EphysCopilot/InsertionSelectionPanelHandler.cs index 35d2e4f8..9796d1c5 100644 --- a/Assets/Scripts/Pinpoint/UI/EphysCopilot/InsertionSelectionPanelHandler.cs +++ b/Assets/Scripts/Pinpoint/UI/EphysCopilot/InsertionSelectionPanelHandler.cs @@ -1,7 +1,7 @@ using System; using System.Collections.Generic; -using System.Drawing.Drawing2D; using System.Linq; +using BrainAtlas; using EphysLink; using Pinpoint.Probes; using TMPro; @@ -64,21 +64,18 @@ public class InsertionSelectionPanelHandler : MonoBehaviour #region Shared - private static CoordinateSpace _annotationDatasetCoordinateSpace => - VolumeDatasetManager.AnnotationDataset.CoordinateSpace; - /// /// Filter for probe managers that are targetable. /// 1. Are not ephys link controlled /// 2. Are inside the brain (not NaN) /// public static IEnumerable TargetableProbeManagers => ProbeManager.Instances - .Where(manager => !manager.IsEphysLinkControlled).Where(manager => !float.IsNaN(VolumeDatasetManager - .AnnotationDataset.FindSurfaceCoordinate( - _annotationDatasetCoordinateSpace.World2Space(manager.ProbeController + .Where(manager => !manager.IsEphysLinkControlled).Where(manager => !float.IsNaN(manager + .FindSurfaceIdxCoordinate( + BrainAtlasManager.ActiveReferenceAtlas.World2AtlasIdx(manager.ProbeController .Insertion .PositionWorldU()), - _annotationDatasetCoordinateSpace.World2SpaceAxisChange(manager + BrainAtlasManager.ActiveReferenceAtlas.World2Atlas_Vector(manager .ProbeController .GetTipWorldU().tipUpWorldU)).x)); @@ -304,38 +301,38 @@ private void ComputeMovementInsertions() // DV axis _movementAxesInsertions.dv = new ProbeInsertion(ProbeManager.ProbeController.Insertion) { - dv = ProbeManager.ProbeController.Insertion.World2TransformedAxisChange(PRE_DEPTH_DRIVE_DV_OFFSET).z + DV = ProbeManager.ProbeController.Insertion.World2T_Vector(PRE_DEPTH_DRIVE_DV_OFFSET).z }; // Recalculate AP and ML based on pre-depth-drive DV - var brainSurfaceCoordinate = VolumeDatasetManager.AnnotationDataset.FindSurfaceCoordinate( - _annotationDatasetCoordinateSpace.World2Space( + var brainSurfaceCoordinate = ProbeManager.FindSurfaceIdxCoordinate( + BrainAtlasManager.ActiveReferenceAtlas.World2AtlasIdx( ManipulatorIDToSelectedTargetProbeManager[ProbeManager.ManipulatorBehaviorController.ManipulatorID] .ProbeController.Insertion.PositionWorldU()), - _annotationDatasetCoordinateSpace.World2SpaceAxisChange(ProbeManager + BrainAtlasManager.ActiveReferenceAtlas.World2Atlas_Vector(ProbeManager .ProbeController .GetTipWorldU().tipUpWorldU)); - var brainSurfaceWorld = - _annotationDatasetCoordinateSpace.Space2World(brainSurfaceCoordinate); - var brainSurfaceTransformed = _movementAxesInsertions.dv.World2Transformed(brainSurfaceWorld); + var brainSurfaceWorld = BrainAtlasManager.ActiveReferenceAtlas.Atlas2World(brainSurfaceCoordinate); + var brainSurfaceTransformed = _movementAxesInsertions.dv.World2T(brainSurfaceWorld); // AP Axis _movementAxesInsertions.ap = new ProbeInsertion(_movementAxesInsertions.dv) { - ap = brainSurfaceTransformed.x + AP = brainSurfaceTransformed.x }; // ML Axis _movementAxesInsertions.ml = new ProbeInsertion(_movementAxesInsertions.ap) { - ml = brainSurfaceTransformed.y + ML = brainSurfaceTransformed.y }; // Check if within bounds var manipulatorPosition = - ProbeManager.ManipulatorBehaviorController.ConvertInsertionAPMLDVToManipulatorPosition(_movementAxesInsertions - .ml.apmldv); + ProbeManager.ManipulatorBehaviorController.ConvertInsertionAPMLDVToManipulatorPosition( + _movementAxesInsertions + .ml.apmldv); if (!_acknowledgedOutOfBounds && (manipulatorPosition.x < 0 || manipulatorPosition.x > ProbeManager.ManipulatorBehaviorController.CoordinateSpace.Dimensions.x || manipulatorPosition.y < 0 || manipulatorPosition.y > @@ -372,14 +369,17 @@ private void MoveToTargetInsertion() // Setup and compute movement _isMoving = true; var apPosition = - ProbeManager.ManipulatorBehaviorController.ConvertInsertionAPMLDVToManipulatorPosition(_movementAxesInsertions - .ap.apmldv); + ProbeManager.ManipulatorBehaviorController.ConvertInsertionAPMLDVToManipulatorPosition( + _movementAxesInsertions + .ap.apmldv); var mlPosition = - ProbeManager.ManipulatorBehaviorController.ConvertInsertionAPMLDVToManipulatorPosition(_movementAxesInsertions - .ml.apmldv); + ProbeManager.ManipulatorBehaviorController.ConvertInsertionAPMLDVToManipulatorPosition( + _movementAxesInsertions + .ml.apmldv); var dvPosition = - ProbeManager.ManipulatorBehaviorController.ConvertInsertionAPMLDVToManipulatorPosition(_movementAxesInsertions - .dv.apmldv); + ProbeManager.ManipulatorBehaviorController.ConvertInsertionAPMLDVToManipulatorPosition( + _movementAxesInsertions + .dv.apmldv); // Move CommunicationManager.Instance.SetCanWrite(ProbeManager.ManipulatorBehaviorController.ManipulatorID, true, 1, diff --git a/Assets/Scripts/Pinpoint/UI/EphysCopilot/trajectoryplanner.ui.ephyscopilot.asmdef b/Assets/Scripts/Pinpoint/UI/EphysCopilot/trajectoryplanner.ui.ephyscopilot.asmdef index f5b41eb1..57c39c7a 100644 --- a/Assets/Scripts/Pinpoint/UI/EphysCopilot/trajectoryplanner.ui.ephyscopilot.asmdef +++ b/Assets/Scripts/Pinpoint/UI/EphysCopilot/trajectoryplanner.ui.ephyscopilot.asmdef @@ -5,12 +5,13 @@ "GUID:6055be8ebefd69e48b49212b09b47b2f", "GUID:90e12186c705ec4439eaedb493060fe3", "GUID:7e45fd9ef3568e944946569af99430de", - "GUID:07000d85304fd3c488914a7dc63b71d7", "GUID:bcfae4c7cb9968e45808db945035df54", "GUID:025d8743921d928489cc31aa3f24d884", "GUID:eff99741200a0ca47a1364af79d8741c", "GUID:160da71e82fca504abe6ab7833979cdb", - "GUID:f79fe5250a39d8440b0d2a8ac418f14f" + "GUID:baba835d3f6de1948879ba12c4c45295", + "GUID:0e68f56b71507ea46a7a7e86308f8eef", + "GUID:1487851fb22c2cc4a85babd43c153c20" ], "includePlatforms": [], "excludePlatforms": [], From 52061e773480938ec36e80ec8bd27085dadd22e2 Mon Sep 17 00:00:00 2001 From: Kenneth Yang Date: Tue, 28 Nov 2023 12:28:27 -0800 Subject: [PATCH 73/78] ManipulatorSpace.cs --- .../CoordinateSystems/ManipulatorSpace.cs | 21 +++++++++---------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/Assets/Scripts/Pinpoint/CoordinateSystems/ManipulatorSpace.cs b/Assets/Scripts/Pinpoint/CoordinateSystems/ManipulatorSpace.cs index 5d6ffa67..ae25a1de 100644 --- a/Assets/Scripts/Pinpoint/CoordinateSystems/ManipulatorSpace.cs +++ b/Assets/Scripts/Pinpoint/CoordinateSystems/ManipulatorSpace.cs @@ -5,29 +5,28 @@ namespace Pinpoint.CoordinateSystems { public sealed class ManipulatorSpace : CoordinateSpace { + // Default to Sensapex dimensions + public override Vector3 Dimensions { get; } = Vector3.one * 20; public override string Name => "Manipulator"; - // Default to Sensapex dimensions, but can be edited - public override Vector3 Dimensions { get; set; } = Vector3.one * 20; - - public override Vector3 Space2World(Vector3 coord) + public override Vector3 Space2World(Vector3 coordSpace, bool useReference = true) { - return new Vector3(-coord.x, coord.y, -coord.z); + return new Vector3(-coordSpace.x, coordSpace.y, -coordSpace.z); } - public override Vector3 World2Space(Vector3 world) + public override Vector3 World2Space(Vector3 coordWorld, bool useReference = true) { - return new Vector3(-world.x, world.y, -world.z); + return new Vector3(-coordWorld.x, coordWorld.y, -coordWorld.z); } - public override Vector3 Space2WorldAxisChange(Vector3 coord) + public override Vector3 Space2World_Vector(Vector3 vecSpace) { - return Space2World(coord); + return Space2World(vecSpace); } - public override Vector3 World2SpaceAxisChange(Vector3 world) + public override Vector3 World2Space_Vector(Vector3 vecWorld) { - return World2Space(world); + return World2Space(vecWorld); } } } \ No newline at end of file From 7f2a9fc2ebcf6181fc40843d07e4fdc0f0cde1d0 Mon Sep 17 00:00:00 2001 From: Kenneth Yang Date: Tue, 28 Nov 2023 12:32:44 -0800 Subject: [PATCH 74/78] Remove Copilot demo --- Assets/Prefabs/UI/MainCanvas.prefab | 621 +++++++++++------- Assets/Scenes/TrajectoryPlanner.unity | 262 +++++++- .../UI/EphysLinkSettings/EphysLinkSettings.cs | 11 +- .../ManipulatorConnectionPanel.cs | 4 +- 4 files changed, 625 insertions(+), 273 deletions(-) diff --git a/Assets/Prefabs/UI/MainCanvas.prefab b/Assets/Prefabs/UI/MainCanvas.prefab index b405ec49..fe9872fd 100644 --- a/Assets/Prefabs/UI/MainCanvas.prefab +++ b/Assets/Prefabs/UI/MainCanvas.prefab @@ -44,13 +44,11 @@ RectTransform: - {fileID: 341190944882926340} - {fileID: 341190945112364105} - {fileID: 858666763888331269} - - {fileID: 6065941617704141803} - {fileID: 5977723730511622612} - {fileID: 9068794098842140863} - {fileID: 341190944649414362} - {fileID: 4538316674562318397} m_Father: {fileID: 0} - m_RootOrder: 0 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 0} m_AnchorMax: {x: 0, y: 0} @@ -74,7 +72,9 @@ Canvas: m_OverrideSorting: 0 m_OverridePixelPerfect: 0 m_SortingBucketNormalizedSize: 0 + m_VertexColorAlwaysGammaSpace: 0 m_AdditionalShaderChannelsFlag: 25 + m_UpdateRectTransformForStandalone: 0 m_SortingLayerID: 0 m_SortingOrder: 0 m_TargetDisplay: 0 @@ -199,12 +199,14 @@ MonoBehaviour: - {fileID: 0} _whiteUIText: [] _ephysCopilotPanelGameObject: {fileID: 0} + _copilotDemoPanelGameObject: {fileID: 0} _settingsPanel: {fileID: 341190943640726960} --- !u!1001 &313233569129278197 PrefabInstance: m_ObjectHideFlags: 0 serializedVersion: 2 m_Modification: + serializedVersion: 3 m_TransformParent: {fileID: 341190944083206654} m_Modifications: - target: {fileID: 4225364627726879432, guid: 2935bf57d75895c4b9ab6878851725ea, type: 3} @@ -296,6 +298,9 @@ PrefabInstance: value: Log objectReference: {fileID: 0} m_RemovedComponents: [] + m_RemovedGameObjects: [] + m_AddedGameObjects: [] + m_AddedComponents: [] m_SourcePrefab: {fileID: 100100000, guid: 2935bf57d75895c4b9ab6878851725ea, type: 3} --- !u!224 &4538316674562318397 stripped RectTransform: @@ -307,6 +312,7 @@ PrefabInstance: m_ObjectHideFlags: 0 serializedVersion: 2 m_Modification: + serializedVersion: 3 m_TransformParent: {fileID: 341190944083206654} m_Modifications: - target: {fileID: 116878910754973469, guid: b789710e596e04e41a4d178650b90f0b, type: 3} @@ -1774,6 +1780,9 @@ PrefabInstance: value: objectReference: {fileID: 0} m_RemovedComponents: [] + m_RemovedGameObjects: [] + m_AddedGameObjects: [] + m_AddedComponents: [] m_SourcePrefab: {fileID: 100100000, guid: b789710e596e04e41a4d178650b90f0b, type: 3} --- !u!1 &341190943640726960 stripped GameObject: @@ -1806,6 +1815,7 @@ PrefabInstance: m_ObjectHideFlags: 0 serializedVersion: 2 m_Modification: + serializedVersion: 3 m_TransformParent: {fileID: 341190944083206654} m_Modifications: - target: {fileID: 2144108167864247631, guid: 26a5047d31719424cb4234b18de5028b, type: 3} @@ -1897,6 +1907,9 @@ PrefabInstance: value: QuestionDialoguePanel objectReference: {fileID: 0} m_RemovedComponents: [] + m_RemovedGameObjects: [] + m_AddedGameObjects: [] + m_AddedComponents: [] m_SourcePrefab: {fileID: 100100000, guid: 26a5047d31719424cb4234b18de5028b, type: 3} --- !u!224 &341190944882926340 stripped RectTransform: @@ -1908,6 +1921,7 @@ PrefabInstance: m_ObjectHideFlags: 0 serializedVersion: 2 m_Modification: + serializedVersion: 3 m_TransformParent: {fileID: 341190944083206654} m_Modifications: - target: {fileID: 297090512738848627, guid: 196fe30eaa658f243a73a6225140bf82, type: 3} @@ -1934,6 +1948,10 @@ PrefabInstance: propertyPath: m_AnchoredPosition.y value: -83.369995 objectReference: {fileID: 0} + - target: {fileID: 316626772814739228, guid: 196fe30eaa658f243a73a6225140bf82, type: 3} + propertyPath: m_Size + value: 0.9985308 + objectReference: {fileID: 0} - target: {fileID: 341854792408792398, guid: 196fe30eaa658f243a73a6225140bf82, type: 3} propertyPath: m_AnchorMax.y value: 1 @@ -1982,6 +2000,38 @@ PrefabInstance: propertyPath: m_AnchoredPosition.y value: -252.5 objectReference: {fileID: 0} + - target: {fileID: 538386439288270413, guid: 196fe30eaa658f243a73a6225140bf82, type: 3} + propertyPath: m_AnchorMax.x + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 538386439288270413, guid: 196fe30eaa658f243a73a6225140bf82, type: 3} + propertyPath: m_AnchorMax.y + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 538386439288270413, guid: 196fe30eaa658f243a73a6225140bf82, type: 3} + propertyPath: m_AnchorMin.y + value: 0.0014691949 + objectReference: {fileID: 0} + - target: {fileID: 604587447986236897, guid: 196fe30eaa658f243a73a6225140bf82, type: 3} + propertyPath: m_AnchorMax.x + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 604587447986236897, guid: 196fe30eaa658f243a73a6225140bf82, type: 3} + propertyPath: m_AnchorMax.y + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 604587447986236897, guid: 196fe30eaa658f243a73a6225140bf82, type: 3} + propertyPath: m_AnchorMin.y + value: 0.0014690757 + objectReference: {fileID: 0} + - target: {fileID: 1023112252082091778, guid: 196fe30eaa658f243a73a6225140bf82, type: 3} + propertyPath: m_SizeDelta.y + value: 20 + objectReference: {fileID: 0} + - target: {fileID: 1023112252082091778, guid: 196fe30eaa658f243a73a6225140bf82, type: 3} + propertyPath: m_AnchoredPosition.y + value: -0.16956012 + objectReference: {fileID: 0} - target: {fileID: 1329200430980672766, guid: 196fe30eaa658f243a73a6225140bf82, type: 3} propertyPath: m_AnchorMax.y value: 1 @@ -1992,19 +2042,19 @@ PrefabInstance: objectReference: {fileID: 0} - target: {fileID: 1329200430980672766, guid: 196fe30eaa658f243a73a6225140bf82, type: 3} propertyPath: m_SizeDelta.x - value: 368.74222 + value: 327.46713 objectReference: {fileID: 0} - target: {fileID: 1329200430980672766, guid: 196fe30eaa658f243a73a6225140bf82, type: 3} propertyPath: m_SizeDelta.y - value: 126.52 + value: 81.65784 objectReference: {fileID: 0} - target: {fileID: 1329200430980672766, guid: 196fe30eaa658f243a73a6225140bf82, type: 3} propertyPath: m_AnchoredPosition.x - value: 194.37111 + value: 173.73357 objectReference: {fileID: 0} - target: {fileID: 1329200430980672766, guid: 196fe30eaa658f243a73a6225140bf82, type: 3} propertyPath: m_AnchoredPosition.y - value: -73.259995 + value: -50.82892 objectReference: {fileID: 0} - target: {fileID: 1420855686876151314, guid: 196fe30eaa658f243a73a6225140bf82, type: 3} propertyPath: m_AnchorMax.y @@ -2136,19 +2186,19 @@ PrefabInstance: objectReference: {fileID: 0} - target: {fileID: 1445278465210223969, guid: 196fe30eaa658f243a73a6225140bf82, type: 3} propertyPath: m_SizeDelta.x - value: 408.74222 + value: 446.81714 objectReference: {fileID: 0} - target: {fileID: 1445278465210223969, guid: 196fe30eaa658f243a73a6225140bf82, type: 3} propertyPath: m_SizeDelta.y - value: 126.52 + value: 81.65784 objectReference: {fileID: 0} - target: {fileID: 1445278465210223969, guid: 196fe30eaa658f243a73a6225140bf82, type: 3} propertyPath: m_AnchoredPosition.x - value: 214.37111 + value: 233.40857 objectReference: {fileID: 0} - target: {fileID: 1445278465210223969, guid: 196fe30eaa658f243a73a6225140bf82, type: 3} propertyPath: m_AnchoredPosition.y - value: -73.259995 + value: -50.82892 objectReference: {fileID: 0} - target: {fileID: 1445278465261351436, guid: 196fe30eaa658f243a73a6225140bf82, type: 3} propertyPath: m_AnchorMax.y @@ -2300,11 +2350,11 @@ PrefabInstance: objectReference: {fileID: 0} - target: {fileID: 1445278465893963706, guid: 196fe30eaa658f243a73a6225140bf82, type: 3} propertyPath: m_SizeDelta.x - value: 428.74222 + value: 466.81714 objectReference: {fileID: 0} - target: {fileID: 1445278465893963706, guid: 196fe30eaa658f243a73a6225140bf82, type: 3} propertyPath: m_AnchoredPosition.x - value: 214.37111 + value: 233.40857 objectReference: {fileID: 0} - target: {fileID: 1445278465893963706, guid: 196fe30eaa658f243a73a6225140bf82, type: 3} propertyPath: m_AnchoredPosition.y @@ -2368,16 +2418,64 @@ PrefabInstance: objectReference: {fileID: 0} - target: {fileID: 1828645389624930458, guid: 196fe30eaa658f243a73a6225140bf82, type: 3} propertyPath: m_SizeDelta.x - value: 388.74222 + value: 347.46713 objectReference: {fileID: 0} - target: {fileID: 1828645389624930458, guid: 196fe30eaa658f243a73a6225140bf82, type: 3} propertyPath: m_AnchoredPosition.x - value: 1280.5978 + value: 1163.865 objectReference: {fileID: 0} - target: {fileID: 1828645389624930458, guid: 196fe30eaa658f243a73a6225140bf82, type: 3} propertyPath: m_AnchoredPosition.y value: -250 objectReference: {fileID: 0} + - target: {fileID: 1871767357751830342, guid: 196fe30eaa658f243a73a6225140bf82, type: 3} + propertyPath: m_AnchorMax.y + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 1871767357751830342, guid: 196fe30eaa658f243a73a6225140bf82, type: 3} + propertyPath: m_AnchorMin.y + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 1871767357751830342, guid: 196fe30eaa658f243a73a6225140bf82, type: 3} + propertyPath: m_SizeDelta.x + value: 463.3143 + objectReference: {fileID: 0} + - target: {fileID: 1871767357751830342, guid: 196fe30eaa658f243a73a6225140bf82, type: 3} + propertyPath: m_SizeDelta.y + value: 388.34216 + objectReference: {fileID: 0} + - target: {fileID: 1871767357751830342, guid: 196fe30eaa658f243a73a6225140bf82, type: 3} + propertyPath: m_AnchoredPosition.x + value: 241.65715 + objectReference: {fileID: 0} + - target: {fileID: 1871767357751830342, guid: 196fe30eaa658f243a73a6225140bf82, type: 3} + propertyPath: m_AnchoredPosition.y + value: -295.82892 + objectReference: {fileID: 0} + - target: {fileID: 1980688578011265982, guid: 196fe30eaa658f243a73a6225140bf82, type: 3} + propertyPath: m_AnchorMax.y + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 1980688578011265982, guid: 196fe30eaa658f243a73a6225140bf82, type: 3} + propertyPath: m_AnchorMin.y + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 1980688578011265982, guid: 196fe30eaa658f243a73a6225140bf82, type: 3} + propertyPath: m_SizeDelta.x + value: 446.81714 + objectReference: {fileID: 0} + - target: {fileID: 1980688578011265982, guid: 196fe30eaa658f243a73a6225140bf82, type: 3} + propertyPath: m_SizeDelta.y + value: 388.34216 + objectReference: {fileID: 0} + - target: {fileID: 1980688578011265982, guid: 196fe30eaa658f243a73a6225140bf82, type: 3} + propertyPath: m_AnchoredPosition.x + value: 233.40857 + objectReference: {fileID: 0} + - target: {fileID: 1980688578011265982, guid: 196fe30eaa658f243a73a6225140bf82, type: 3} + propertyPath: m_AnchoredPosition.y + value: -295.82892 + objectReference: {fileID: 0} - target: {fileID: 2219146652646867223, guid: 196fe30eaa658f243a73a6225140bf82, type: 3} propertyPath: m_AnchorMax.y value: 1 @@ -2460,19 +2558,19 @@ PrefabInstance: objectReference: {fileID: 0} - target: {fileID: 2392387104559285655, guid: 196fe30eaa658f243a73a6225140bf82, type: 3} propertyPath: m_SizeDelta.x - value: 285.03113 + value: 422.40143 objectReference: {fileID: 0} - target: {fileID: 2392387104559285655, guid: 196fe30eaa658f243a73a6225140bf82, type: 3} propertyPath: m_SizeDelta.y - value: 85 + value: 81.65784 objectReference: {fileID: 0} - target: {fileID: 2392387104559285655, guid: 196fe30eaa658f243a73a6225140bf82, type: 3} propertyPath: m_AnchoredPosition.x - value: 152.51556 + value: 221.20071 objectReference: {fileID: 0} - target: {fileID: 2392387104559285655, guid: 196fe30eaa658f243a73a6225140bf82, type: 3} propertyPath: m_AnchoredPosition.y - value: -52.5 + value: -50.82892 objectReference: {fileID: 0} - target: {fileID: 2443275810401281638, guid: 196fe30eaa658f243a73a6225140bf82, type: 3} propertyPath: m_AnchorMax.y @@ -2484,16 +2582,20 @@ PrefabInstance: objectReference: {fileID: 0} - target: {fileID: 2443275810401281638, guid: 196fe30eaa658f243a73a6225140bf82, type: 3} propertyPath: m_SizeDelta.x - value: 305.03113 + value: 442.40143 objectReference: {fileID: 0} - target: {fileID: 2443275810401281638, guid: 196fe30eaa658f243a73a6225140bf82, type: 3} propertyPath: m_AnchoredPosition.x - value: 1647.4844 + value: 1578.7993 objectReference: {fileID: 0} - target: {fileID: 2443275810401281638, guid: 196fe30eaa658f243a73a6225140bf82, type: 3} propertyPath: m_AnchoredPosition.y value: -250 objectReference: {fileID: 0} + - target: {fileID: 2654698296376999678, guid: 196fe30eaa658f243a73a6225140bf82, type: 3} + propertyPath: m_Size + value: 0.9985309 + objectReference: {fileID: 0} - target: {fileID: 2745294210082331459, guid: 196fe30eaa658f243a73a6225140bf82, type: 3} propertyPath: m_AnchorMax.y value: 1 @@ -2566,6 +2668,54 @@ PrefabInstance: propertyPath: m_AnchoredPosition.y value: -406.62997 objectReference: {fileID: 0} + - target: {fileID: 3068108255336848725, guid: 196fe30eaa658f243a73a6225140bf82, type: 3} + propertyPath: m_AnchorMax.x + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 3068108255336848725, guid: 196fe30eaa658f243a73a6225140bf82, type: 3} + propertyPath: m_AnchorMax.y + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 3068108255336848725, guid: 196fe30eaa658f243a73a6225140bf82, type: 3} + propertyPath: m_AnchorMin.y + value: 0.0014691949 + objectReference: {fileID: 0} + - target: {fileID: 3100601276906428472, guid: 196fe30eaa658f243a73a6225140bf82, type: 3} + propertyPath: m_AnchorMax.x + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 3100601276906428472, guid: 196fe30eaa658f243a73a6225140bf82, type: 3} + propertyPath: m_AnchorMax.y + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 3100601276906428472, guid: 196fe30eaa658f243a73a6225140bf82, type: 3} + propertyPath: m_SizeDelta.x + value: -17 + objectReference: {fileID: 0} + - target: {fileID: 3171181750794952356, guid: 196fe30eaa658f243a73a6225140bf82, type: 3} + propertyPath: m_AnchorMax.y + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 3171181750794952356, guid: 196fe30eaa658f243a73a6225140bf82, type: 3} + propertyPath: m_AnchorMin.y + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 3171181750794952356, guid: 196fe30eaa658f243a73a6225140bf82, type: 3} + propertyPath: m_SizeDelta.x + value: 327.46713 + objectReference: {fileID: 0} + - target: {fileID: 3171181750794952356, guid: 196fe30eaa658f243a73a6225140bf82, type: 3} + propertyPath: m_SizeDelta.y + value: 388.34216 + objectReference: {fileID: 0} + - target: {fileID: 3171181750794952356, guid: 196fe30eaa658f243a73a6225140bf82, type: 3} + propertyPath: m_AnchoredPosition.x + value: 173.73357 + objectReference: {fileID: 0} + - target: {fileID: 3171181750794952356, guid: 196fe30eaa658f243a73a6225140bf82, type: 3} + propertyPath: m_AnchoredPosition.y + value: -295.82892 + objectReference: {fileID: 0} - target: {fileID: 3208185261194632028, guid: 196fe30eaa658f243a73a6225140bf82, type: 3} propertyPath: m_AnchorMax.y value: 1 @@ -2576,11 +2726,11 @@ PrefabInstance: objectReference: {fileID: 0} - target: {fileID: 3208185261194632028, guid: 196fe30eaa658f243a73a6225140bf82, type: 3} propertyPath: m_SizeDelta.x - value: 617.48444 + value: 483.3143 objectReference: {fileID: 0} - target: {fileID: 3208185261194632028, guid: 196fe30eaa658f243a73a6225140bf82, type: 3} propertyPath: m_AnchoredPosition.x - value: 757.48444 + value: 728.4743 objectReference: {fileID: 0} - target: {fileID: 3208185261194632028, guid: 196fe30eaa658f243a73a6225140bf82, type: 3} propertyPath: m_AnchoredPosition.y @@ -2610,6 +2760,18 @@ PrefabInstance: propertyPath: m_AnchoredPosition.y value: -83.369995 objectReference: {fileID: 0} + - target: {fileID: 3433957872760773670, guid: 196fe30eaa658f243a73a6225140bf82, type: 3} + propertyPath: m_AnchorMax.x + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 3433957872760773670, guid: 196fe30eaa658f243a73a6225140bf82, type: 3} + propertyPath: m_AnchorMax.y + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 3433957872760773670, guid: 196fe30eaa658f243a73a6225140bf82, type: 3} + propertyPath: m_SizeDelta.x + value: -17 + objectReference: {fileID: 0} - target: {fileID: 3686407937574207330, guid: 196fe30eaa658f243a73a6225140bf82, type: 3} propertyPath: m_AnchorMax.y value: 1 @@ -2620,19 +2782,27 @@ PrefabInstance: objectReference: {fileID: 0} - target: {fileID: 3686407937574207330, guid: 196fe30eaa658f243a73a6225140bf82, type: 3} propertyPath: m_SizeDelta.x - value: 597.48444 + value: 463.3143 objectReference: {fileID: 0} - target: {fileID: 3686407937574207330, guid: 196fe30eaa658f243a73a6225140bf82, type: 3} propertyPath: m_SizeDelta.y - value: 82.5 + value: 81.65784 objectReference: {fileID: 0} - target: {fileID: 3686407937574207330, guid: 196fe30eaa658f243a73a6225140bf82, type: 3} propertyPath: m_AnchoredPosition.x - value: 308.74222 + value: 241.65715 objectReference: {fileID: 0} - target: {fileID: 3686407937574207330, guid: 196fe30eaa658f243a73a6225140bf82, type: 3} propertyPath: m_AnchoredPosition.y - value: -51.25 + value: -50.82892 + objectReference: {fileID: 0} + - target: {fileID: 4053970164101770309, guid: 196fe30eaa658f243a73a6225140bf82, type: 3} + propertyPath: m_SizeDelta.y + value: 20 + objectReference: {fileID: 0} + - target: {fileID: 4053970164101770309, guid: 196fe30eaa658f243a73a6225140bf82, type: 3} + propertyPath: m_AnchoredPosition.y + value: -0.16957356 objectReference: {fileID: 0} - target: {fileID: 4245670433166484202, guid: 196fe30eaa658f243a73a6225140bf82, type: 3} propertyPath: m_AnchorMax.y @@ -2778,6 +2948,54 @@ PrefabInstance: propertyPath: m_AnchoredPosition.y value: -28.75 objectReference: {fileID: 0} + - target: {fileID: 5847460939056171599, guid: 196fe30eaa658f243a73a6225140bf82, type: 3} + propertyPath: m_AnchorMax.y + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 5847460939056171599, guid: 196fe30eaa658f243a73a6225140bf82, type: 3} + propertyPath: m_AnchorMin.y + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 5847460939056171599, guid: 196fe30eaa658f243a73a6225140bf82, type: 3} + propertyPath: m_SizeDelta.x + value: 422.40143 + objectReference: {fileID: 0} + - target: {fileID: 5847460939056171599, guid: 196fe30eaa658f243a73a6225140bf82, type: 3} + propertyPath: m_SizeDelta.y + value: 388.34216 + objectReference: {fileID: 0} + - target: {fileID: 5847460939056171599, guid: 196fe30eaa658f243a73a6225140bf82, type: 3} + propertyPath: m_AnchoredPosition.x + value: 221.20071 + objectReference: {fileID: 0} + - target: {fileID: 5847460939056171599, guid: 196fe30eaa658f243a73a6225140bf82, type: 3} + propertyPath: m_AnchoredPosition.y + value: -295.82892 + objectReference: {fileID: 0} + - target: {fileID: 6126481738209059470, guid: 196fe30eaa658f243a73a6225140bf82, type: 3} + propertyPath: m_SizeDelta.y + value: 20 + objectReference: {fileID: 0} + - target: {fileID: 6126481738209059470, guid: 196fe30eaa658f243a73a6225140bf82, type: 3} + propertyPath: m_AnchoredPosition.y + value: -0.16957356 + objectReference: {fileID: 0} + - target: {fileID: 6696808094185633579, guid: 196fe30eaa658f243a73a6225140bf82, type: 3} + propertyPath: m_Size + value: 0.9985308 + objectReference: {fileID: 0} + - target: {fileID: 6891135516417237052, guid: 196fe30eaa658f243a73a6225140bf82, type: 3} + propertyPath: m_AnchorMax.x + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 6891135516417237052, guid: 196fe30eaa658f243a73a6225140bf82, type: 3} + propertyPath: m_AnchorMax.y + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 6891135516417237052, guid: 196fe30eaa658f243a73a6225140bf82, type: 3} + propertyPath: m_SizeDelta.x + value: -17 + objectReference: {fileID: 0} - target: {fileID: 7194566140052559301, guid: 196fe30eaa658f243a73a6225140bf82, type: 3} propertyPath: m_AnchorMax.y value: 1 @@ -2802,6 +3020,26 @@ PrefabInstance: propertyPath: m_AnchoredPosition.y value: -28.75 objectReference: {fileID: 0} + - target: {fileID: 7730571946973758776, guid: 196fe30eaa658f243a73a6225140bf82, type: 3} + propertyPath: m_SizeDelta.y + value: 20 + objectReference: {fileID: 0} + - target: {fileID: 7730571946973758776, guid: 196fe30eaa658f243a73a6225140bf82, type: 3} + propertyPath: m_AnchoredPosition.y + value: -0.16957356 + objectReference: {fileID: 0} + - target: {fileID: 7761443917104768108, guid: 196fe30eaa658f243a73a6225140bf82, type: 3} + propertyPath: m_AnchorMax.x + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 7761443917104768108, guid: 196fe30eaa658f243a73a6225140bf82, type: 3} + propertyPath: m_AnchorMax.y + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 7761443917104768108, guid: 196fe30eaa658f243a73a6225140bf82, type: 3} + propertyPath: m_SizeDelta.x + value: -17 + objectReference: {fileID: 0} - target: {fileID: 7913539047539659810, guid: 196fe30eaa658f243a73a6225140bf82, type: 3} propertyPath: m_AnchorMax.y value: 1 @@ -2874,6 +3112,22 @@ PrefabInstance: propertyPath: m_AnchoredPosition.y value: -178.75 objectReference: {fileID: 0} + - target: {fileID: 8361295466311985757, guid: 196fe30eaa658f243a73a6225140bf82, type: 3} + propertyPath: m_AnchorMax.x + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 8361295466311985757, guid: 196fe30eaa658f243a73a6225140bf82, type: 3} + propertyPath: m_AnchorMax.y + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 8361295466311985757, guid: 196fe30eaa658f243a73a6225140bf82, type: 3} + propertyPath: m_AnchorMin.y + value: 0.0014691949 + objectReference: {fileID: 0} + - target: {fileID: 8428055214211566965, guid: 196fe30eaa658f243a73a6225140bf82, type: 3} + propertyPath: m_Size + value: 0.9985308 + objectReference: {fileID: 0} - target: {fileID: 8624134810927461005, guid: 196fe30eaa658f243a73a6225140bf82, type: 3} propertyPath: m_AnchorMax.y value: 1 @@ -2947,6 +3201,9 @@ PrefabInstance: value: -28.75 objectReference: {fileID: 0} m_RemovedComponents: [] + m_RemovedGameObjects: [] + m_AddedGameObjects: [] + m_AddedComponents: [] m_SourcePrefab: {fileID: 100100000, guid: 196fe30eaa658f243a73a6225140bf82, type: 3} --- !u!224 &858666763888331269 stripped RectTransform: @@ -2958,6 +3215,7 @@ PrefabInstance: m_ObjectHideFlags: 0 serializedVersion: 2 m_Modification: + serializedVersion: 3 m_TransformParent: {fileID: 341190944083206654} m_Modifications: - target: {fileID: 2697801029150039400, guid: d78b8e4ed4a566b4e821d110f00655a7, type: 3} @@ -3049,6 +3307,9 @@ PrefabInstance: value: ProbePanelParent objectReference: {fileID: 0} m_RemovedComponents: [] + m_RemovedGameObjects: [] + m_AddedGameObjects: [] + m_AddedComponents: [] m_SourcePrefab: {fileID: 100100000, guid: d78b8e4ed4a566b4e821d110f00655a7, type: 3} --- !u!224 &341190945477065620 stripped RectTransform: @@ -3060,6 +3321,7 @@ PrefabInstance: m_ObjectHideFlags: 0 serializedVersion: 2 m_Modification: + serializedVersion: 3 m_TransformParent: {fileID: 341190944083206654} m_Modifications: - target: {fileID: 2350846122840215465, guid: e1adb83ccfab11d40bddce865259e54f, type: 3} @@ -3151,6 +3413,9 @@ PrefabInstance: value: CollisionsPanel objectReference: {fileID: 0} m_RemovedComponents: [] + m_RemovedGameObjects: [] + m_AddedGameObjects: [] + m_AddedComponents: [] m_SourcePrefab: {fileID: 100100000, guid: e1adb83ccfab11d40bddce865259e54f, type: 3} --- !u!224 &341190945420745090 stripped RectTransform: @@ -3162,6 +3427,7 @@ PrefabInstance: m_ObjectHideFlags: 0 serializedVersion: 2 m_Modification: + serializedVersion: 3 m_TransformParent: {fileID: 341190944083206654} m_Modifications: - target: {fileID: 3208650239917680533, guid: 660ce40bc11f7704b9904d1fdf674b54, type: 3} @@ -3345,6 +3611,9 @@ PrefabInstance: value: -102.833336 objectReference: {fileID: 0} m_RemovedComponents: [] + m_RemovedGameObjects: [] + m_AddedGameObjects: [] + m_AddedComponents: [] m_SourcePrefab: {fileID: 100100000, guid: 660ce40bc11f7704b9904d1fdf674b54, type: 3} --- !u!224 &341190945112364105 stripped RectTransform: @@ -3367,6 +3636,7 @@ PrefabInstance: m_ObjectHideFlags: 0 serializedVersion: 2 m_Modification: + serializedVersion: 3 m_TransformParent: {fileID: 341190945403315020} m_Modifications: - target: {fileID: 3269436126806437280, guid: b16f891380abab1438950ba67a118f71, type: 3} @@ -3466,12 +3736,21 @@ PrefabInstance: value: 0 objectReference: {fileID: 0} m_RemovedComponents: [] + m_RemovedGameObjects: [] + m_AddedGameObjects: [] + m_AddedComponents: [] m_SourcePrefab: {fileID: 100100000, guid: b16f891380abab1438950ba67a118f71, type: 3} +--- !u!224 &341190944298537966 stripped +RectTransform: + m_CorrespondingSourceObject: {fileID: 3269436126806437287, guid: b16f891380abab1438950ba67a118f71, type: 3} + m_PrefabInstance: {fileID: 3018389829841780297} + m_PrefabAsset: {fileID: 0} --- !u!1001 &3161837466982038489 PrefabInstance: m_ObjectHideFlags: 0 serializedVersion: 2 m_Modification: + serializedVersion: 3 m_TransformParent: {fileID: 341190944083206654} m_Modifications: - target: {fileID: 839751988006088, guid: a845e935ace78824095cdcafdc73cec3, type: 3} @@ -3852,19 +4131,19 @@ PrefabInstance: objectReference: {fileID: 0} - target: {fileID: 3412951401384689765, guid: a845e935ace78824095cdcafdc73cec3, type: 3} propertyPath: m_AnchorMax.y - value: 1 + value: 0 objectReference: {fileID: 0} - target: {fileID: 3412951401384689765, guid: a845e935ace78824095cdcafdc73cec3, type: 3} propertyPath: m_AnchorMin.y - value: 1 + value: 0 objectReference: {fileID: 0} - target: {fileID: 3412951401384689765, guid: a845e935ace78824095cdcafdc73cec3, type: 3} propertyPath: m_AnchoredPosition.x - value: 354.84 + value: 0 objectReference: {fileID: 0} - target: {fileID: 3412951401384689765, guid: a845e935ace78824095cdcafdc73cec3, type: 3} propertyPath: m_AnchoredPosition.y - value: -15 + value: 0 objectReference: {fileID: 0} - target: {fileID: 3412951401415546731, guid: a845e935ace78824095cdcafdc73cec3, type: 3} propertyPath: m_AnchorMax.x @@ -3964,15 +4243,15 @@ PrefabInstance: objectReference: {fileID: 0} - target: {fileID: 3412951401717916581, guid: a845e935ace78824095cdcafdc73cec3, type: 3} propertyPath: m_AnchorMax.y - value: 1 + value: 0 objectReference: {fileID: 0} - target: {fileID: 3412951401717916581, guid: a845e935ace78824095cdcafdc73cec3, type: 3} propertyPath: m_AnchorMin.y - value: 1 + value: 0 objectReference: {fileID: 0} - target: {fileID: 3412951401717916581, guid: a845e935ace78824095cdcafdc73cec3, type: 3} propertyPath: m_AnchoredPosition.x - value: 169.88 + value: 0 objectReference: {fileID: 0} - target: {fileID: 3412951401779554079, guid: a845e935ace78824095cdcafdc73cec3, type: 3} propertyPath: m_AnchorMax.y @@ -3988,19 +4267,19 @@ PrefabInstance: objectReference: {fileID: 0} - target: {fileID: 3412951401780577586, guid: a845e935ace78824095cdcafdc73cec3, type: 3} propertyPath: m_AnchorMax.y - value: 1 + value: 0 objectReference: {fileID: 0} - target: {fileID: 3412951401780577586, guid: a845e935ace78824095cdcafdc73cec3, type: 3} propertyPath: m_AnchorMin.y - value: 1 + value: 0 objectReference: {fileID: 0} - target: {fileID: 3412951401780577586, guid: a845e935ace78824095cdcafdc73cec3, type: 3} propertyPath: m_AnchoredPosition.x - value: 384.91998 + value: 0 objectReference: {fileID: 0} - target: {fileID: 3412951401780577586, guid: a845e935ace78824095cdcafdc73cec3, type: 3} propertyPath: m_AnchoredPosition.y - value: -15 + value: 0 objectReference: {fileID: 0} - target: {fileID: 3412951401809217141, guid: a845e935ace78824095cdcafdc73cec3, type: 3} propertyPath: m_AnchorMax.y @@ -4018,6 +4297,10 @@ PrefabInstance: propertyPath: m_AnchoredPosition.y value: 0 objectReference: {fileID: 0} + - target: {fileID: 3412951401896794032, guid: a845e935ace78824095cdcafdc73cec3, type: 3} + propertyPath: m_SortingLayer + value: 0 + objectReference: {fileID: 0} - target: {fileID: 3412951401896794032, guid: a845e935ace78824095cdcafdc73cec3, type: 3} propertyPath: m_Materials.Array.data[0] value: @@ -5043,6 +5326,12 @@ PrefabInstance: value: -17 objectReference: {fileID: 0} m_RemovedComponents: [] + m_RemovedGameObjects: [] + m_AddedGameObjects: + - targetCorrespondingSourceObject: {fileID: 3412951403304589461, guid: a845e935ace78824095cdcafdc73cec3, type: 3} + insertIndex: -1 + addedObject: {fileID: 341190944298537966} + m_AddedComponents: [] m_SourcePrefab: {fileID: 100100000, guid: a845e935ace78824095cdcafdc73cec3, type: 3} --- !u!114 &193214259762620640 stripped MonoBehaviour: @@ -5219,6 +5508,7 @@ PrefabInstance: m_ObjectHideFlags: 0 serializedVersion: 2 m_Modification: + serializedVersion: 3 m_TransformParent: {fileID: 341190944083206654} m_Modifications: - target: {fileID: 1917941435178448969, guid: b70534dfc2e4a52489c512aabd5dd59d, type: 3} @@ -5326,231 +5616,21 @@ PrefabInstance: value: 0 objectReference: {fileID: 0} m_RemovedComponents: [] + m_RemovedGameObjects: [] + m_AddedGameObjects: [] + m_AddedComponents: [] m_SourcePrefab: {fileID: 100100000, guid: b70534dfc2e4a52489c512aabd5dd59d, type: 3} --- !u!224 &5977723730511622612 stripped RectTransform: m_CorrespondingSourceObject: {fileID: 8061307773979316499, guid: b70534dfc2e4a52489c512aabd5dd59d, type: 3} m_PrefabInstance: {fileID: 4407511908067877063} m_PrefabAsset: {fileID: 0} ---- !u!1001 &4620733729677790419 -PrefabInstance: - m_ObjectHideFlags: 0 - serializedVersion: 2 - m_Modification: - m_TransformParent: {fileID: 341190944083206654} - m_Modifications: - - target: {fileID: 316626772814739228, guid: c61e26b987f076144a8c951a87349115, type: 3} - propertyPath: m_Size - value: 1 - objectReference: {fileID: 0} - - target: {fileID: 316626772814739228, guid: c61e26b987f076144a8c951a87349115, type: 3} - propertyPath: m_Value - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 538386439288270413, guid: c61e26b987f076144a8c951a87349115, type: 3} - propertyPath: m_AnchorMax.x - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 538386439288270413, guid: c61e26b987f076144a8c951a87349115, type: 3} - propertyPath: m_AnchorMax.y - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 538386439288270413, guid: c61e26b987f076144a8c951a87349115, type: 3} - propertyPath: m_AnchorMin.y - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 604587447986236897, guid: c61e26b987f076144a8c951a87349115, type: 3} - propertyPath: m_AnchorMax.x - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 604587447986236897, guid: c61e26b987f076144a8c951a87349115, type: 3} - propertyPath: m_AnchorMax.y - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 604587447986236897, guid: c61e26b987f076144a8c951a87349115, type: 3} - propertyPath: m_AnchorMin.y - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 1023112252082091778, guid: c61e26b987f076144a8c951a87349115, type: 3} - propertyPath: m_SizeDelta.y - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 1023112252082091778, guid: c61e26b987f076144a8c951a87349115, type: 3} - propertyPath: m_AnchoredPosition.y - value: 0.000045776367 - objectReference: {fileID: 0} - - target: {fileID: 1445278465348587320, guid: c61e26b987f076144a8c951a87349115, type: 3} - propertyPath: m_Pivot.x - value: 0.5 - objectReference: {fileID: 0} - - target: {fileID: 1445278465348587320, guid: c61e26b987f076144a8c951a87349115, type: 3} - propertyPath: m_Pivot.y - value: 0.5 - objectReference: {fileID: 0} - - target: {fileID: 1445278465348587320, guid: c61e26b987f076144a8c951a87349115, type: 3} - propertyPath: m_RootOrder - value: 8 - objectReference: {fileID: 0} - - target: {fileID: 1445278465348587320, guid: c61e26b987f076144a8c951a87349115, type: 3} - propertyPath: m_AnchorMax.x - value: 0.5 - objectReference: {fileID: 0} - - target: {fileID: 1445278465348587320, guid: c61e26b987f076144a8c951a87349115, type: 3} - propertyPath: m_AnchorMax.y - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 1445278465348587320, guid: c61e26b987f076144a8c951a87349115, type: 3} - propertyPath: m_AnchorMin.x - value: 0.5 - objectReference: {fileID: 0} - - target: {fileID: 1445278465348587320, guid: c61e26b987f076144a8c951a87349115, type: 3} - propertyPath: m_AnchorMin.y - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 1445278465348587320, guid: c61e26b987f076144a8c951a87349115, type: 3} - propertyPath: m_SizeDelta.x - value: 1800 - objectReference: {fileID: 0} - - target: {fileID: 1445278465348587320, guid: c61e26b987f076144a8c951a87349115, type: 3} - propertyPath: m_SizeDelta.y - value: 500 - objectReference: {fileID: 0} - - target: {fileID: 1445278465348587320, guid: c61e26b987f076144a8c951a87349115, type: 3} - propertyPath: m_LocalPosition.x - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 1445278465348587320, guid: c61e26b987f076144a8c951a87349115, type: 3} - propertyPath: m_LocalPosition.y - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 1445278465348587320, guid: c61e26b987f076144a8c951a87349115, type: 3} - propertyPath: m_LocalPosition.z - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 1445278465348587320, guid: c61e26b987f076144a8c951a87349115, type: 3} - propertyPath: m_LocalRotation.w - value: 1 - objectReference: {fileID: 0} - - target: {fileID: 1445278465348587320, guid: c61e26b987f076144a8c951a87349115, type: 3} - propertyPath: m_LocalRotation.x - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 1445278465348587320, guid: c61e26b987f076144a8c951a87349115, type: 3} - propertyPath: m_LocalRotation.y - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 1445278465348587320, guid: c61e26b987f076144a8c951a87349115, type: 3} - propertyPath: m_LocalRotation.z - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 1445278465348587320, guid: c61e26b987f076144a8c951a87349115, type: 3} - propertyPath: m_AnchoredPosition.x - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 1445278465348587320, guid: c61e26b987f076144a8c951a87349115, type: 3} - propertyPath: m_AnchoredPosition.y - value: 300 - objectReference: {fileID: 0} - - target: {fileID: 1445278465348587320, guid: c61e26b987f076144a8c951a87349115, type: 3} - propertyPath: m_LocalEulerAnglesHint.x - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 1445278465348587320, guid: c61e26b987f076144a8c951a87349115, type: 3} - propertyPath: m_LocalEulerAnglesHint.y - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 1445278465348587320, guid: c61e26b987f076144a8c951a87349115, type: 3} - propertyPath: m_LocalEulerAnglesHint.z - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 1445278465348587321, guid: c61e26b987f076144a8c951a87349115, type: 3} - propertyPath: m_Name - value: CopilotDemoPanel - objectReference: {fileID: 0} - - target: {fileID: 2654698296376999678, guid: c61e26b987f076144a8c951a87349115, type: 3} - propertyPath: m_Size - value: 1 - objectReference: {fileID: 0} - - target: {fileID: 2654698296376999678, guid: c61e26b987f076144a8c951a87349115, type: 3} - propertyPath: m_Value - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 3068108255336848725, guid: c61e26b987f076144a8c951a87349115, type: 3} - propertyPath: m_AnchorMax.x - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 3068108255336848725, guid: c61e26b987f076144a8c951a87349115, type: 3} - propertyPath: m_AnchorMax.y - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 3068108255336848725, guid: c61e26b987f076144a8c951a87349115, type: 3} - propertyPath: m_AnchorMin.y - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 4053970164101770309, guid: c61e26b987f076144a8c951a87349115, type: 3} - propertyPath: m_SizeDelta.y - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 4053970164101770309, guid: c61e26b987f076144a8c951a87349115, type: 3} - propertyPath: m_AnchoredPosition.y - value: 0.000015258789 - objectReference: {fileID: 0} - - target: {fileID: 6126481738209059470, guid: c61e26b987f076144a8c951a87349115, type: 3} - propertyPath: m_SizeDelta.y - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 6126481738209059470, guid: c61e26b987f076144a8c951a87349115, type: 3} - propertyPath: m_AnchoredPosition.y - value: 0.000015258789 - objectReference: {fileID: 0} - - target: {fileID: 6696808094185633579, guid: c61e26b987f076144a8c951a87349115, type: 3} - propertyPath: m_Size - value: 1 - objectReference: {fileID: 0} - - target: {fileID: 6696808094185633579, guid: c61e26b987f076144a8c951a87349115, type: 3} - propertyPath: m_Value - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 7730571946973758776, guid: c61e26b987f076144a8c951a87349115, type: 3} - propertyPath: m_SizeDelta.y - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 7730571946973758776, guid: c61e26b987f076144a8c951a87349115, type: 3} - propertyPath: m_AnchoredPosition.y - value: 0.000015258789 - objectReference: {fileID: 0} - - target: {fileID: 8361295466311985757, guid: c61e26b987f076144a8c951a87349115, type: 3} - propertyPath: m_AnchorMax.x - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 8361295466311985757, guid: c61e26b987f076144a8c951a87349115, type: 3} - propertyPath: m_AnchorMax.y - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 8361295466311985757, guid: c61e26b987f076144a8c951a87349115, type: 3} - propertyPath: m_AnchorMin.y - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 8428055214211566965, guid: c61e26b987f076144a8c951a87349115, type: 3} - propertyPath: m_Size - value: 1 - objectReference: {fileID: 0} - - target: {fileID: 8428055214211566965, guid: c61e26b987f076144a8c951a87349115, type: 3} - propertyPath: m_Value - value: 0 - objectReference: {fileID: 0} - m_RemovedComponents: [] - m_SourcePrefab: {fileID: 100100000, guid: c61e26b987f076144a8c951a87349115, type: 3} ---- !u!224 &6065941617704141803 stripped -RectTransform: - m_CorrespondingSourceObject: {fileID: 1445278465348587320, guid: c61e26b987f076144a8c951a87349115, type: 3} - m_PrefabInstance: {fileID: 4620733729677790419} - m_PrefabAsset: {fileID: 0} --- !u!1001 &5000858622118457398 PrefabInstance: m_ObjectHideFlags: 0 serializedVersion: 2 m_Modification: + serializedVersion: 3 m_TransformParent: {fileID: 341190944083206654} m_Modifications: - target: {fileID: 4040330997745294021, guid: 0bc497a41ae98c34996698f167fe12fc, type: 3} @@ -5894,6 +5974,9 @@ PrefabInstance: value: objectReference: {fileID: 0} m_RemovedComponents: [] + m_RemovedGameObjects: [] + m_AddedGameObjects: [] + m_AddedComponents: [] m_SourcePrefab: {fileID: 100100000, guid: 0bc497a41ae98c34996698f167fe12fc, type: 3} --- !u!114 &341190944649414309 stripped MonoBehaviour: @@ -5916,6 +5999,7 @@ PrefabInstance: m_ObjectHideFlags: 0 serializedVersion: 2 m_Modification: + serializedVersion: 3 m_TransformParent: {fileID: 341190944083206654} m_Modifications: - target: {fileID: 3478975257933580972, guid: 2a3faed150327c041acb3d9ebce2d19b, type: 3} @@ -6071,6 +6155,9 @@ PrefabInstance: value: 0 objectReference: {fileID: 0} m_RemovedComponents: [] + m_RemovedGameObjects: [] + m_AddedGameObjects: [] + m_AddedComponents: [] m_SourcePrefab: {fileID: 100100000, guid: 2a3faed150327c041acb3d9ebce2d19b, type: 3} --- !u!224 &9068794098842140863 stripped RectTransform: @@ -6082,6 +6169,7 @@ PrefabInstance: m_ObjectHideFlags: 0 serializedVersion: 2 m_Modification: + serializedVersion: 3 m_TransformParent: {fileID: 341190944083206654} m_Modifications: - target: {fileID: 821444603974483889, guid: 06e37a956a642544ca1ab258bde47264, type: 3} @@ -6100,14 +6188,30 @@ PrefabInstance: propertyPath: brainCameraController value: objectReference: {fileID: 0} + - target: {fileID: 7481604451649752965, guid: 06e37a956a642544ca1ab258bde47264, type: 3} + propertyPath: m_SortingLayer + value: 0 + objectReference: {fileID: 0} - target: {fileID: 7481604451892701008, guid: 06e37a956a642544ca1ab258bde47264, type: 3} propertyPath: cameraController value: objectReference: {fileID: 0} + - target: {fileID: 7481604451892701038, guid: 06e37a956a642544ca1ab258bde47264, type: 3} + propertyPath: m_SortingLayer + value: 0 + objectReference: {fileID: 0} - target: {fileID: 7481604452042575779, guid: 06e37a956a642544ca1ab258bde47264, type: 3} propertyPath: cameraController value: objectReference: {fileID: 0} + - target: {fileID: 7481604452042575781, guid: 06e37a956a642544ca1ab258bde47264, type: 3} + propertyPath: m_SortingLayer + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 7481604452204866977, guid: 06e37a956a642544ca1ab258bde47264, type: 3} + propertyPath: m_SortingLayer + value: 0 + objectReference: {fileID: 0} - target: {fileID: 7481604452546003725, guid: 06e37a956a642544ca1ab258bde47264, type: 3} propertyPath: m_Name value: RotatorPanel @@ -6200,15 +6304,30 @@ PrefabInstance: propertyPath: m_Enabled value: 1 objectReference: {fileID: 0} + - target: {fileID: 7481604452670194186, guid: 06e37a956a642544ca1ab258bde47264, type: 3} + propertyPath: m_SortingLayer + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 7481604453359634521, guid: 06e37a956a642544ca1ab258bde47264, type: 3} + propertyPath: m_SortingLayer + value: 0 + objectReference: {fileID: 0} - target: {fileID: 7481604453359634523, guid: 06e37a956a642544ca1ab258bde47264, type: 3} propertyPath: cameraController value: objectReference: {fileID: 0} + - target: {fileID: 7481604453399048338, guid: 06e37a956a642544ca1ab258bde47264, type: 3} + propertyPath: m_SortingLayer + value: 0 + objectReference: {fileID: 0} - target: {fileID: 7481604453399048340, guid: 06e37a956a642544ca1ab258bde47264, type: 3} propertyPath: cameraController value: objectReference: {fileID: 0} m_RemovedComponents: [] + m_RemovedGameObjects: [] + m_AddedGameObjects: [] + m_AddedComponents: [] m_SourcePrefab: {fileID: 100100000, guid: 06e37a956a642544ca1ab258bde47264, type: 3} --- !u!224 &341190944239140890 stripped RectTransform: diff --git a/Assets/Scenes/TrajectoryPlanner.unity b/Assets/Scenes/TrajectoryPlanner.unity index 533bff41..8be6709b 100644 --- a/Assets/Scenes/TrajectoryPlanner.unity +++ b/Assets/Scenes/TrajectoryPlanner.unity @@ -3119,15 +3119,15 @@ PrefabInstance: objectReference: {fileID: 1703646459} - target: {fileID: 341190943836035196, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} propertyPath: m_AnchorMax.y - value: 0 + value: 1 objectReference: {fileID: 0} - target: {fileID: 341190943836035196, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} propertyPath: m_AnchorMin.y - value: 0 + value: 1 objectReference: {fileID: 0} - target: {fileID: 341190943836035196, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} propertyPath: m_AnchoredPosition.x - value: 0 + value: 169.88 objectReference: {fileID: 0} - target: {fileID: 341190943836276264, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} propertyPath: m_IsOn @@ -3263,19 +3263,19 @@ PrefabInstance: objectReference: {fileID: 0} - target: {fileID: 341190944034978748, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} propertyPath: m_AnchorMax.y - value: 0 + value: 1 objectReference: {fileID: 0} - target: {fileID: 341190944034978748, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} propertyPath: m_AnchorMin.y - value: 0 + value: 1 objectReference: {fileID: 0} - target: {fileID: 341190944034978748, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} propertyPath: m_AnchoredPosition.x - value: 0 + value: 354.84 objectReference: {fileID: 0} - target: {fileID: 341190944034978748, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} propertyPath: m_AnchoredPosition.y - value: 0 + value: -15 objectReference: {fileID: 0} - target: {fileID: 341190944071593138, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} propertyPath: m_AnchorMax.x @@ -3555,19 +3555,19 @@ PrefabInstance: objectReference: {fileID: 0} - target: {fileID: 341190944410943211, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} propertyPath: m_AnchorMax.y - value: 0 + value: 1 objectReference: {fileID: 0} - target: {fileID: 341190944410943211, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} propertyPath: m_AnchorMin.y - value: 0 + value: 1 objectReference: {fileID: 0} - target: {fileID: 341190944410943211, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} propertyPath: m_AnchoredPosition.x - value: 0 + value: 384.91998 objectReference: {fileID: 0} - target: {fileID: 341190944410943211, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} propertyPath: m_AnchoredPosition.y - value: 0 + value: -15 objectReference: {fileID: 0} - target: {fileID: 341190944411999430, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} propertyPath: m_AnchorMax.y @@ -4309,6 +4309,30 @@ PrefabInstance: propertyPath: m_AnchoredPosition.x value: -55.600006 objectReference: {fileID: 0} + - target: {fileID: 526666674236384042, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} + propertyPath: m_AnchorMax.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 526666674236384042, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} + propertyPath: m_AnchorMin.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 526666674236384042, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} + propertyPath: m_SizeDelta.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 526666674236384042, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} + propertyPath: m_SizeDelta.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 526666674236384042, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} + propertyPath: m_AnchoredPosition.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 526666674236384042, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} + propertyPath: m_AnchoredPosition.y + value: 0 + objectReference: {fileID: 0} - target: {fileID: 568637148373482672, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} propertyPath: m_AnchorMax.y value: 1 @@ -4809,6 +4833,30 @@ PrefabInstance: propertyPath: _experimentDropdown value: objectReference: {fileID: 341190943874437990} + - target: {fileID: 1829180218217638352, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} + propertyPath: m_AnchorMax.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1829180218217638352, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} + propertyPath: m_AnchorMin.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1829180218217638352, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} + propertyPath: m_SizeDelta.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1829180218217638352, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} + propertyPath: m_SizeDelta.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1829180218217638352, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} + propertyPath: m_AnchoredPosition.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1829180218217638352, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} + propertyPath: m_AnchoredPosition.y + value: 0 + objectReference: {fileID: 0} - target: {fileID: 1890578862338769638, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} propertyPath: m_AnchorMax.y value: 0 @@ -5105,6 +5153,30 @@ PrefabInstance: propertyPath: m_AnchoredPosition.y value: -5 objectReference: {fileID: 0} + - target: {fileID: 2549492478463270206, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} + propertyPath: m_AnchorMax.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 2549492478463270206, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} + propertyPath: m_AnchorMin.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 2549492478463270206, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} + propertyPath: m_SizeDelta.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 2549492478463270206, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} + propertyPath: m_SizeDelta.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 2549492478463270206, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} + propertyPath: m_AnchoredPosition.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 2549492478463270206, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} + propertyPath: m_AnchoredPosition.y + value: 0 + objectReference: {fileID: 0} - target: {fileID: 2576245173555294759, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} propertyPath: m_AnchorMax.y value: 1 @@ -5537,6 +5609,30 @@ PrefabInstance: propertyPath: _editorFocusableInputFields.Array.data[0] value: objectReference: {fileID: 0} + - target: {fileID: 3444711362033518062, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} + propertyPath: m_AnchorMax.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 3444711362033518062, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} + propertyPath: m_AnchorMin.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 3444711362033518062, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} + propertyPath: m_SizeDelta.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 3444711362033518062, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} + propertyPath: m_SizeDelta.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 3444711362033518062, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} + propertyPath: m_AnchoredPosition.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 3444711362033518062, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} + propertyPath: m_AnchoredPosition.y + value: 0 + objectReference: {fileID: 0} - target: {fileID: 3477886918378625307, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} propertyPath: m_AnchorMax.x value: 1 @@ -5925,6 +6021,30 @@ PrefabInstance: propertyPath: m_AnchorMin.y value: 1 objectReference: {fileID: 0} + - target: {fileID: 4216880249697705858, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} + propertyPath: m_AnchorMax.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 4216880249697705858, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} + propertyPath: m_AnchorMin.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 4216880249697705858, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} + propertyPath: m_SizeDelta.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 4216880249697705858, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} + propertyPath: m_SizeDelta.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 4216880249697705858, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} + propertyPath: m_AnchoredPosition.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 4216880249697705858, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} + propertyPath: m_AnchoredPosition.y + value: 0 + objectReference: {fileID: 0} - target: {fileID: 4218167276952692149, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} propertyPath: m_AnchoredPosition.x value: -48.700012 @@ -6229,6 +6349,30 @@ PrefabInstance: propertyPath: m_SizeDelta.x value: -17 objectReference: {fileID: 0} + - target: {fileID: 4638972357698478462, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} + propertyPath: m_AnchorMax.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 4638972357698478462, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} + propertyPath: m_AnchorMin.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 4638972357698478462, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} + propertyPath: m_SizeDelta.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 4638972357698478462, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} + propertyPath: m_SizeDelta.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 4638972357698478462, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} + propertyPath: m_AnchoredPosition.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 4638972357698478462, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} + propertyPath: m_AnchoredPosition.y + value: 0 + objectReference: {fileID: 0} - target: {fileID: 4724898486047142119, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} propertyPath: m_AnchorMax.y value: 1 @@ -6949,6 +7093,30 @@ PrefabInstance: propertyPath: m_OnClick.m_PersistentCalls.m_Calls.Array.data[0].m_Arguments.m_ObjectArgumentAssemblyTypeName value: UnityEngine.Object, UnityEngine objectReference: {fileID: 0} + - target: {fileID: 6458267049939974945, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} + propertyPath: m_AnchorMax.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 6458267049939974945, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} + propertyPath: m_AnchorMin.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 6458267049939974945, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} + propertyPath: m_SizeDelta.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 6458267049939974945, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} + propertyPath: m_SizeDelta.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 6458267049939974945, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} + propertyPath: m_AnchoredPosition.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 6458267049939974945, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} + propertyPath: m_AnchoredPosition.y + value: 0 + objectReference: {fileID: 0} - target: {fileID: 6514980532054408230, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} propertyPath: m_AnchorMax.y value: 0 @@ -7045,6 +7213,30 @@ PrefabInstance: propertyPath: m_SizeDelta.x value: -17 objectReference: {fileID: 0} + - target: {fileID: 6902199046925824417, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} + propertyPath: m_AnchorMax.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 6902199046925824417, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} + propertyPath: m_AnchorMin.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 6902199046925824417, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} + propertyPath: m_SizeDelta.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 6902199046925824417, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} + propertyPath: m_SizeDelta.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 6902199046925824417, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} + propertyPath: m_AnchoredPosition.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 6902199046925824417, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} + propertyPath: m_AnchoredPosition.y + value: 0 + objectReference: {fileID: 0} - target: {fileID: 6932418094552038715, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} propertyPath: m_OnClick.m_PersistentCalls.m_Calls.Array.size value: 1 @@ -7549,6 +7741,30 @@ PrefabInstance: propertyPath: m_AnchoredPosition.y value: 0 objectReference: {fileID: 0} + - target: {fileID: 8054674137374801413, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} + propertyPath: m_AnchorMax.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 8054674137374801413, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} + propertyPath: m_AnchorMin.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 8054674137374801413, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} + propertyPath: m_SizeDelta.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 8054674137374801413, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} + propertyPath: m_SizeDelta.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 8054674137374801413, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} + propertyPath: m_AnchoredPosition.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 8054674137374801413, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} + propertyPath: m_AnchoredPosition.y + value: 0 + objectReference: {fileID: 0} - target: {fileID: 8122223018216829504, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} propertyPath: m_AnchorMax.y value: 1 @@ -8065,6 +8281,30 @@ PrefabInstance: propertyPath: m_IsActive value: 0 objectReference: {fileID: 0} + - target: {fileID: 9125755490035067209, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} + propertyPath: m_AnchorMax.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 9125755490035067209, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} + propertyPath: m_AnchorMin.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 9125755490035067209, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} + propertyPath: m_SizeDelta.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 9125755490035067209, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} + propertyPath: m_SizeDelta.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 9125755490035067209, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} + propertyPath: m_AnchoredPosition.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 9125755490035067209, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} + propertyPath: m_AnchoredPosition.y + value: 0 + objectReference: {fileID: 0} - target: {fileID: 9201160669940680994, guid: 94cdeca105038d74ea47b57e6b99eb4e, type: 3} propertyPath: m_AnchorMax.y value: 0 diff --git a/Assets/Scripts/Pinpoint/UI/EphysLinkSettings/EphysLinkSettings.cs b/Assets/Scripts/Pinpoint/UI/EphysLinkSettings/EphysLinkSettings.cs index 858e4afb..e5d8af8f 100644 --- a/Assets/Scripts/Pinpoint/UI/EphysLinkSettings/EphysLinkSettings.cs +++ b/Assets/Scripts/Pinpoint/UI/EphysLinkSettings/EphysLinkSettings.cs @@ -3,11 +3,12 @@ using System.Linq; using EphysLink; using TMPro; +using TrajectoryPlanner.UI.EphysLinkSettings; using UnityEngine; using UnityEngine.Events; using UnityEngine.UI; -namespace TrajectoryPlanner.UI.EphysLinkSettings +namespace Pinpoint.UI.EphysLinkSettings { /// /// Settings menu to connect to the Ephys Link server and manage probe-manipulator bindings. @@ -26,7 +27,6 @@ public class EphysLinkSettings : MonoBehaviour [SerializeField] private GameObject _manipulatorList; [SerializeField] private GameObject _manipulatorConnectionPanelPrefab; [SerializeField] private Toggle _copilotToggle; - [SerializeField] private Toggle _copilotDemoToggle; private UIManager _uiManager; @@ -87,7 +87,6 @@ private void UpdateManipulatorPanels() { // Default Copilot to be disabled unless the right manipulator type is found _copilotToggle.interactable = false; - _copilotDemoToggle.interactable = false; if (CommunicationManager.Instance.IsConnected) { @@ -95,7 +94,6 @@ private void UpdateManipulatorPanels() { // Enable Copilot button if using Sensapex or New Scale _copilotToggle.interactable = numAxes > 0; - _copilotDemoToggle.interactable = numAxes > 0; // Keep track of handled manipulator panels var handledManipulatorIds = new HashSet(); @@ -219,11 +217,6 @@ public void ToggleCopilotPanel(bool isEnabled) _uiManager.EnableEphysCopilotPanel(isEnabled); } - public void ToggleCopilotDemoPanel(bool isEnabled) - { - _uiManager.EnableCopilotDemoPanel(isEnabled); - } - public void InvokeShouldUpdateProbesListEvent() { ShouldUpdateProbesListEvent.Invoke(); diff --git a/Assets/Scripts/Pinpoint/UI/EphysLinkSettings/ManipulatorConnectionPanel.cs b/Assets/Scripts/Pinpoint/UI/EphysLinkSettings/ManipulatorConnectionPanel.cs index 18c9f4f3..48eb5e06 100644 --- a/Assets/Scripts/Pinpoint/UI/EphysLinkSettings/ManipulatorConnectionPanel.cs +++ b/Assets/Scripts/Pinpoint/UI/EphysLinkSettings/ManipulatorConnectionPanel.cs @@ -14,7 +14,7 @@ public class ManipulatorConnectionPanel : MonoBehaviour { #region Constructor - public void Initialize(EphysLinkSettings settingsMenu, string manipulatorID, int numAxes) + public void Initialize(Pinpoint.UI.EphysLinkSettings.EphysLinkSettings settingsMenu, string manipulatorID, int numAxes) { // Set properties _ephysLinkSettings = settingsMenu; @@ -421,7 +421,7 @@ private void UpdateBrainSurfaceOffsetInputField(float brainSurfaceOffset) #region Properties - private EphysLinkSettings _ephysLinkSettings; + private Pinpoint.UI.EphysLinkSettings.EphysLinkSettings _ephysLinkSettings; private string _manipulatorId; private int _numAxes; From 852c66f0ef511ae579591e4c7777a6babb68db26 Mon Sep 17 00:00:00 2001 From: Kenneth Yang Date: Tue, 28 Nov 2023 12:32:53 -0800 Subject: [PATCH 75/78] Remove Copilot demo UI --- .../SettingsMenu/Menus/EphysLinkMenu.prefab | 413 +----------------- 1 file changed, 14 insertions(+), 399 deletions(-) diff --git a/Assets/Prefabs/UI/SettingsMenu/Menus/EphysLinkMenu.prefab b/Assets/Prefabs/UI/SettingsMenu/Menus/EphysLinkMenu.prefab index 28151490..fa3801a2 100644 --- a/Assets/Prefabs/UI/SettingsMenu/Menus/EphysLinkMenu.prefab +++ b/Assets/Prefabs/UI/SettingsMenu/Menus/EphysLinkMenu.prefab @@ -34,7 +34,6 @@ RectTransform: m_Children: - {fileID: 38915140806856538} m_Father: {fileID: 2047283783586261496} - m_RootOrder: 2 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 0} m_AnchorMax: {x: 0, y: 0} @@ -228,7 +227,6 @@ RectTransform: m_ConstrainProportionsScale: 0 m_Children: [] m_Father: {fileID: 38915140806856538} - m_RootOrder: 1 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 0} m_AnchorMax: {x: 1, y: 1} @@ -367,7 +365,6 @@ RectTransform: - {fileID: 3996764095595718417} - {fileID: 215679457066498566} m_Father: {fileID: 6362176155741130746} - m_RootOrder: 4 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 0} m_AnchorMax: {x: 0, y: 0} @@ -462,42 +459,6 @@ MonoBehaviour: m_FlexibleWidth: -1 m_FlexibleHeight: 1000 m_LayoutPriority: 1 ---- !u!1 &1826329449438794058 -GameObject: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - serializedVersion: 6 - m_Component: - - component: {fileID: 4733268162864556575} - m_Layer: 5 - m_Name: Spacer - m_TagString: Untagged - m_Icon: {fileID: 0} - m_NavMeshLayer: 0 - m_StaticEditorFlags: 0 - m_IsActive: 1 ---- !u!224 &4733268162864556575 -RectTransform: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 1826329449438794058} - 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: [] - m_Father: {fileID: 3368363359402801633} - m_RootOrder: 2 - 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!1 &1905739261017864310 GameObject: m_ObjectHideFlags: 0 @@ -529,7 +490,6 @@ RectTransform: m_ConstrainProportionsScale: 0 m_Children: [] m_Father: {fileID: 402872827330927990} - m_RootOrder: 0 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 0} m_AnchorMax: {x: 1, y: 1} @@ -664,7 +624,6 @@ RectTransform: m_ConstrainProportionsScale: 0 m_Children: [] m_Father: {fileID: 5668169073541834191} - m_RootOrder: 0 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 0} m_AnchorMax: {x: 1, y: 1} @@ -801,7 +760,6 @@ RectTransform: m_Children: - {fileID: 1021889813847180340} m_Father: {fileID: 2026155534260252091} - m_RootOrder: 1 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 1, y: 0} m_AnchorMax: {x: 1, y: 1} @@ -895,82 +853,6 @@ MonoBehaviour: m_OnValueChanged: m_PersistentCalls: m_Calls: [] ---- !u!1 &2463412627045294728 -GameObject: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - serializedVersion: 6 - m_Component: - - component: {fileID: 2943885646786418918} - - component: {fileID: 2307278747312407585} - - component: {fileID: 3258961051634933478} - m_Layer: 5 - m_Name: Checkmark - m_TagString: Untagged - m_Icon: {fileID: 0} - m_NavMeshLayer: 0 - m_StaticEditorFlags: 0 - m_IsActive: 1 ---- !u!224 &2943885646786418918 -RectTransform: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 2463412627045294728} - 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: [] - m_Father: {fileID: 1251162055235371913} - m_RootOrder: 0 - m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} - m_AnchorMin: {x: 0.5, y: 0.5} - m_AnchorMax: {x: 0.5, y: 0.5} - m_AnchoredPosition: {x: 0, y: 0} - m_SizeDelta: {x: 70, y: 70} - m_Pivot: {x: 0.5, y: 0.5} ---- !u!222 &2307278747312407585 -CanvasRenderer: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 2463412627045294728} - m_CullTransparentMesh: 1 ---- !u!114 &3258961051634933478 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 2463412627045294728} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3} - m_Name: - m_EditorClassIdentifier: - m_Material: {fileID: 0} - m_Color: {r: 1, g: 1, b: 1, a: 1} - m_RaycastTarget: 1 - m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} - m_Maskable: 1 - m_OnCullStateChanged: - m_PersistentCalls: - m_Calls: [] - m_Sprite: {fileID: 10901, guid: 0000000000000000f000000000000000, type: 0} - m_Type: 0 - m_PreserveAspect: 0 - m_FillCenter: 1 - m_FillMethod: 4 - m_FillAmount: 1 - m_FillClockwise: 1 - m_FillOrigin: 0 - m_UseSpriteMesh: 0 - m_PixelsPerUnitMultiplier: 1 --- !u!1 &2820967185475947156 GameObject: m_ObjectHideFlags: 0 @@ -1003,7 +885,6 @@ RectTransform: m_ConstrainProportionsScale: 0 m_Children: [] m_Father: {fileID: 38915140806856538} - m_RootOrder: 0 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 0} m_AnchorMax: {x: 1, y: 1} @@ -1158,10 +1039,7 @@ RectTransform: m_ConstrainProportionsScale: 0 m_Children: - {fileID: 6454811602450069208} - - {fileID: 8862325249793869894} - - {fileID: 4733268162864556575} m_Father: {fileID: 6362176155741130746} - m_RootOrder: 2 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 0} m_AnchorMax: {x: 0, y: 0} @@ -1247,7 +1125,6 @@ RectTransform: m_Children: - {fileID: 6870659471952674721} m_Father: {fileID: 2047283783586261496} - m_RootOrder: 5 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 1} m_AnchorMax: {x: 0, y: 1} @@ -1381,7 +1258,6 @@ RectTransform: m_Children: - {fileID: 5745525655117009368} m_Father: {fileID: 2026155534260252091} - m_RootOrder: 0 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 0} m_AnchorMax: {x: 0, y: 0} @@ -1469,7 +1345,6 @@ RectTransform: m_Children: - {fileID: 2259807623879296756} m_Father: {fileID: 215679457066498566} - m_RootOrder: 0 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 0} m_AnchorMax: {x: 1, y: 1} @@ -1507,7 +1382,6 @@ RectTransform: m_ConstrainProportionsScale: 0 m_Children: [] m_Father: {fileID: 6454811602450069208} - m_RootOrder: 1 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 0} m_AnchorMax: {x: 1, y: 1} @@ -1587,7 +1461,6 @@ RectTransform: m_ConstrainProportionsScale: 0 m_Children: [] m_Father: {fileID: 2047283783586261496} - m_RootOrder: 3 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 0} m_AnchorMax: {x: 0, y: 0} @@ -1691,86 +1564,6 @@ MonoBehaviour: m_hasFontAssetChanged: 0 m_baseMaterial: {fileID: 0} m_maskOffset: {x: 0, y: 0, z: 0, w: 0} ---- !u!1 &4885030235408315657 -GameObject: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - serializedVersion: 6 - m_Component: - - component: {fileID: 465684715438252110} - - component: {fileID: 1350648356087742117} - - component: {fileID: 3197261609905304939} - m_Layer: 5 - m_Name: Label - m_TagString: Untagged - m_Icon: {fileID: 0} - m_NavMeshLayer: 0 - m_StaticEditorFlags: 0 - m_IsActive: 1 ---- !u!224 &465684715438252110 -RectTransform: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 4885030235408315657} - 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: [] - m_Father: {fileID: 8862325249793869894} - m_RootOrder: 1 - m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} - m_AnchorMin: {x: 0, y: 0} - m_AnchorMax: {x: 1, y: 1} - m_AnchoredPosition: {x: 37.5, y: 0.5} - m_SizeDelta: {x: -85, y: -1.0000191} - m_Pivot: {x: 0.5, y: 0.5} ---- !u!222 &1350648356087742117 -CanvasRenderer: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 4885030235408315657} - m_CullTransparentMesh: 1 ---- !u!114 &3197261609905304939 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 4885030235408315657} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: 5f7201a12d95ffc409449d95f23cf332, type: 3} - m_Name: - m_EditorClassIdentifier: - m_Material: {fileID: 0} - m_Color: {r: 0.19607843, g: 0.19607843, b: 0.19607843, a: 1} - m_RaycastTarget: 1 - m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} - m_Maskable: 1 - m_OnCullStateChanged: - m_PersistentCalls: - m_Calls: [] - m_FontData: - m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0} - m_FontSize: 36 - m_FontStyle: 0 - m_BestFit: 0 - m_MinSize: 10 - m_MaxSize: 40 - m_Alignment: 3 - m_AlignByGeometry: 0 - m_RichText: 1 - m_HorizontalOverflow: 0 - m_VerticalOverflow: 0 - m_LineSpacing: 1 - m_Text: Enable Copilot Demo --- !u!1 &4937477631376377988 GameObject: m_ObjectHideFlags: 0 @@ -1802,7 +1595,6 @@ RectTransform: m_ConstrainProportionsScale: 0 m_Children: [] m_Father: {fileID: 2047283783586261496} - m_RootOrder: 0 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 0} m_AnchorMax: {x: 0, y: 0} @@ -1946,7 +1738,6 @@ RectTransform: - {fileID: 8908337441760298693} - {fileID: 8324711128621182813} m_Father: {fileID: 6362176155741130746} - m_RootOrder: 1 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 0} m_AnchorMax: {x: 0, y: 0} @@ -2048,7 +1839,6 @@ RectTransform: m_ConstrainProportionsScale: 0 m_Children: [] m_Father: {fileID: 6362176155741130746} - m_RootOrder: 3 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 0} m_AnchorMax: {x: 0, y: 0} @@ -2184,7 +1974,6 @@ RectTransform: m_ConstrainProportionsScale: 0 m_Children: [] m_Father: {fileID: 2047283783586261496} - m_RootOrder: 7 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 0} m_AnchorMax: {x: 0, y: 0} @@ -2339,7 +2128,6 @@ RectTransform: m_ConstrainProportionsScale: 0 m_Children: [] m_Father: {fileID: 6362176155741130746} - m_RootOrder: 0 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 0} m_AnchorMax: {x: 0, y: 0} @@ -2482,7 +2270,6 @@ RectTransform: - {fileID: 2026155534260252091} - {fileID: 5668169073541834191} m_Father: {fileID: 0} - m_RootOrder: 0 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 1} m_AnchorMax: {x: 0, y: 1} @@ -2546,7 +2333,6 @@ MonoBehaviour: _manipulatorList: {fileID: 7994738088484906322} _manipulatorConnectionPanelPrefab: {fileID: 8830734852478451222, guid: 19384593a545a404bbe8bd298659df46, type: 3} _copilotToggle: {fileID: 6762999849811435235} - _copilotDemoToggle: {fileID: 282356076181514970} --- !u!114 &7858764217905313557 MonoBehaviour: m_ObjectHideFlags: 0 @@ -2605,7 +2391,6 @@ RectTransform: - {fileID: 5086426771079407237} - {fileID: 4549333973363489582} m_Father: {fileID: 5000388725093730506} - m_RootOrder: 0 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 0} m_AnchorMax: {x: 1, y: 1} @@ -2657,7 +2442,6 @@ RectTransform: m_ConstrainProportionsScale: 0 m_Children: [] m_Father: {fileID: 2707765522829527282} - m_RootOrder: 0 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0.5, y: 0.5} m_AnchorMax: {x: 0.5, y: 0.5} @@ -2734,7 +2518,6 @@ RectTransform: - {fileID: 2707765522829527282} - {fileID: 1529037423938537742} m_Father: {fileID: 3368363359402801633} - m_RootOrder: 0 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 0} m_AnchorMax: {x: 0, y: 0} @@ -2833,7 +2616,6 @@ RectTransform: m_ConstrainProportionsScale: 0 m_Children: [] m_Father: {fileID: 1021889813847180340} - m_RootOrder: 0 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 0} m_AnchorMax: {x: 0, y: 0} @@ -2878,183 +2660,6 @@ MonoBehaviour: m_FillOrigin: 0 m_UseSpriteMesh: 0 m_PixelsPerUnitMultiplier: 1 ---- !u!1 &6826895715115904834 -GameObject: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - serializedVersion: 6 - m_Component: - - component: {fileID: 8862325249793869894} - - component: {fileID: 282356076181514970} - m_Layer: 5 - m_Name: CopilotDemoToggle - m_TagString: Untagged - m_Icon: {fileID: 0} - m_NavMeshLayer: 0 - m_StaticEditorFlags: 0 - m_IsActive: 1 ---- !u!224 &8862325249793869894 -RectTransform: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 6826895715115904834} - 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: 1251162055235371913} - - {fileID: 465684715438252110} - m_Father: {fileID: 3368363359402801633} - m_RootOrder: 1 - 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 &282356076181514970 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 6826895715115904834} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: 9085046f02f69544eb97fd06b6048fe2, type: 3} - m_Name: - m_EditorClassIdentifier: - m_Navigation: - m_Mode: 3 - m_WrapAround: 0 - m_SelectOnUp: {fileID: 0} - m_SelectOnDown: {fileID: 0} - m_SelectOnLeft: {fileID: 0} - m_SelectOnRight: {fileID: 0} - m_Transition: 1 - m_Colors: - m_NormalColor: {r: 1, g: 1, b: 1, a: 1} - m_HighlightedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1} - m_PressedColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 1} - m_SelectedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1} - m_DisabledColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 0.5019608} - m_ColorMultiplier: 1 - m_FadeDuration: 0.1 - m_SpriteState: - m_HighlightedSprite: {fileID: 0} - m_PressedSprite: {fileID: 0} - m_SelectedSprite: {fileID: 0} - m_DisabledSprite: {fileID: 0} - m_AnimationTriggers: - m_NormalTrigger: Normal - m_HighlightedTrigger: Highlighted - m_PressedTrigger: Pressed - m_SelectedTrigger: Selected - m_DisabledTrigger: Disabled - m_Interactable: 1 - m_TargetGraphic: {fileID: 1884488258719385616} - toggleTransition: 1 - graphic: {fileID: 3258961051634933478} - m_Group: {fileID: 0} - onValueChanged: - m_PersistentCalls: - m_Calls: - - m_Target: {fileID: 4412914667077470364} - m_TargetAssemblyTypeName: TrajectoryPlanner.UI.EphysLinkSettings.EphysLinkSettings, - trajectoryplanner.ui.ephyslinksettings - m_MethodName: ToggleCopilotDemoPanel - m_Mode: 0 - m_Arguments: - m_ObjectArgument: {fileID: 0} - m_ObjectArgumentAssemblyTypeName: UnityEngine.Object, UnityEngine - m_IntArgument: 0 - m_FloatArgument: 0 - m_StringArgument: - m_BoolArgument: 0 - m_CallState: 2 - m_IsOn: 0 ---- !u!1 &7240603151880297605 -GameObject: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - serializedVersion: 6 - m_Component: - - component: {fileID: 1251162055235371913} - - component: {fileID: 1788166065057526308} - - component: {fileID: 1884488258719385616} - m_Layer: 5 - m_Name: Background - m_TagString: Untagged - m_Icon: {fileID: 0} - m_NavMeshLayer: 0 - m_StaticEditorFlags: 0 - m_IsActive: 1 ---- !u!224 &1251162055235371913 -RectTransform: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 7240603151880297605} - 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: 2943885646786418918} - m_Father: {fileID: 8862325249793869894} - m_RootOrder: 0 - m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} - m_AnchorMin: {x: 0, y: 1} - m_AnchorMax: {x: 0, y: 1} - m_AnchoredPosition: {x: 35, y: -35} - m_SizeDelta: {x: 70, y: 70} - m_Pivot: {x: 0.5, y: 0.5} ---- !u!222 &1788166065057526308 -CanvasRenderer: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 7240603151880297605} - m_CullTransparentMesh: 1 ---- !u!114 &1884488258719385616 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 7240603151880297605} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3} - m_Name: - m_EditorClassIdentifier: - m_Material: {fileID: 0} - m_Color: {r: 1, g: 1, b: 1, a: 1} - m_RaycastTarget: 1 - m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} - m_Maskable: 1 - m_OnCullStateChanged: - m_PersistentCalls: - m_Calls: [] - m_Sprite: {fileID: 10905, guid: 0000000000000000f000000000000000, type: 0} - m_Type: 1 - m_PreserveAspect: 0 - m_FillCenter: 1 - m_FillMethod: 4 - m_FillAmount: 1 - m_FillClockwise: 1 - m_FillOrigin: 0 - m_UseSpriteMesh: 0 - m_PixelsPerUnitMultiplier: 1 --- !u!1 &7614803770262254004 GameObject: m_ObjectHideFlags: 0 @@ -3087,7 +2692,6 @@ RectTransform: m_Children: - {fileID: 3642204298839887896} m_Father: {fileID: 6454811602450069208} - m_RootOrder: 0 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 1} m_AnchorMax: {x: 0, y: 1} @@ -3163,7 +2767,6 @@ RectTransform: m_ConstrainProportionsScale: 0 m_Children: [] m_Father: {fileID: 3996764095595718417} - m_RootOrder: 0 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 0} m_AnchorMax: {x: 1, y: 1} @@ -3240,7 +2843,6 @@ RectTransform: m_ConstrainProportionsScale: 0 m_Children: [] m_Father: {fileID: 2047283783586261496} - m_RootOrder: 1 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 0} m_AnchorMax: {x: 0, y: 0} @@ -3300,7 +2902,6 @@ RectTransform: m_Children: - {fileID: 8341784043796240673} m_Father: {fileID: 6362176155741130746} - m_RootOrder: 5 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 1} m_AnchorMax: {x: 0, y: 1} @@ -3406,6 +3007,7 @@ PrefabInstance: m_ObjectHideFlags: 0 serializedVersion: 2 m_Modification: + serializedVersion: 3 m_TransformParent: {fileID: 2047283783586261496} m_Modifications: - target: {fileID: 1917941435178448969, guid: b70534dfc2e4a52489c512aabd5dd59d, type: 3} @@ -3541,6 +3143,12 @@ PrefabInstance: value: 0 objectReference: {fileID: 0} m_RemovedComponents: [] + m_RemovedGameObjects: [] + m_AddedGameObjects: [] + m_AddedComponents: + - targetCorrespondingSourceObject: {fileID: 2971839373268861373, guid: b70534dfc2e4a52489c512aabd5dd59d, type: 3} + insertIndex: -1 + addedObject: {fileID: 8810270889018719643} m_SourcePrefab: {fileID: 100100000, guid: b70534dfc2e4a52489c512aabd5dd59d, type: 3} --- !u!114 &1072600612830375839 stripped MonoBehaviour: @@ -3588,6 +3196,7 @@ PrefabInstance: m_ObjectHideFlags: 0 serializedVersion: 2 m_Modification: + serializedVersion: 3 m_TransformParent: {fileID: 2047283783586261496} m_Modifications: - target: {fileID: 608477772891859801, guid: b5c9c741a0d4edd4c9948dba78e58d2b, type: 3} @@ -3739,6 +3348,12 @@ PrefabInstance: value: -0.000030517578 objectReference: {fileID: 0} m_RemovedComponents: [] + m_RemovedGameObjects: [] + m_AddedGameObjects: [] + m_AddedComponents: + - targetCorrespondingSourceObject: {fileID: 1373293703190948031, guid: b5c9c741a0d4edd4c9948dba78e58d2b, type: 3} + insertIndex: -1 + addedObject: {fileID: 8833591938072377424} m_SourcePrefab: {fileID: 100100000, guid: b5c9c741a0d4edd4c9948dba78e58d2b, type: 3} --- !u!224 &82302228965344709 stripped RectTransform: From dd7fc832be6a6ddfdaeb22f6a8a4d571393d78b3 Mon Sep 17 00:00:00 2001 From: Kenneth Yang Date: Tue, 28 Nov 2023 13:02:46 -0800 Subject: [PATCH 76/78] Echoing works with ump4 --- .../CoordinateSystems/ManipulatorSpace.cs | 8 ++++---- .../InsertionOptionColorHandler.cs | 20 +++++++++---------- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/Assets/Scripts/Pinpoint/CoordinateSystems/ManipulatorSpace.cs b/Assets/Scripts/Pinpoint/CoordinateSystems/ManipulatorSpace.cs index ae25a1de..c661a325 100644 --- a/Assets/Scripts/Pinpoint/CoordinateSystems/ManipulatorSpace.cs +++ b/Assets/Scripts/Pinpoint/CoordinateSystems/ManipulatorSpace.cs @@ -11,22 +11,22 @@ public sealed class ManipulatorSpace : CoordinateSpace public override Vector3 Space2World(Vector3 coordSpace, bool useReference = true) { - return new Vector3(-coordSpace.x, coordSpace.y, -coordSpace.z); + return coordSpace; } public override Vector3 World2Space(Vector3 coordWorld, bool useReference = true) { - return new Vector3(-coordWorld.x, coordWorld.y, -coordWorld.z); + return coordWorld; } public override Vector3 Space2World_Vector(Vector3 vecSpace) { - return Space2World(vecSpace); + return vecSpace; } public override Vector3 World2Space_Vector(Vector3 vecWorld) { - return World2Space(vecWorld); + return vecWorld; } } } \ No newline at end of file diff --git a/Assets/Scripts/Pinpoint/UI/EphysCopilot/InsertionOptionColorHandler.cs b/Assets/Scripts/Pinpoint/UI/EphysCopilot/InsertionOptionColorHandler.cs index e3d20b35..5aefe162 100644 --- a/Assets/Scripts/Pinpoint/UI/EphysCopilot/InsertionOptionColorHandler.cs +++ b/Assets/Scripts/Pinpoint/UI/EphysCopilot/InsertionOptionColorHandler.cs @@ -1,4 +1,5 @@ using System; +using System.Linq; using TMPro; using UnityEngine; using UnityEngine.UI; @@ -23,17 +24,16 @@ private void Start() // Get the probe manager with this UUID (if it exists) var probeNameString = _text.text[..textEndIndex]; - throw new NotImplementedException(); - //var matchingManager = InsertionSelectionPanelHandler.TargetableProbeManagers.First(manager => - // manager.name.Equals(probeNameString) || (manager.OverrideName?.Equals(probeNameString) ?? false)); - //if (!matchingManager) return; + var matchingManager = InsertionSelectionPanelHandler.TargetableProbeManagers.First(manager => + manager.name.Equals(probeNameString) || (manager.OverrideName?.Equals(probeNameString) ?? false)); + if (!matchingManager) return; - //// Set the toggle color to match the probe color - //var colorBlockCopy = _toggle.colors; - //colorBlockCopy.normalColor = matchingManager.Color; - //colorBlockCopy.selectedColor = new Color(colorBlockCopy.normalColor.r * 0.9f, - // colorBlockCopy.normalColor.g * 0.9f, colorBlockCopy.normalColor.b * 0.9f); - //_toggle.colors = colorBlockCopy; + // Set the toggle color to match the probe color + var colorBlockCopy = _toggle.colors; + colorBlockCopy.normalColor = matchingManager.Color; + colorBlockCopy.selectedColor = new Color(colorBlockCopy.normalColor.r * 0.9f, + colorBlockCopy.normalColor.g * 0.9f, colorBlockCopy.normalColor.b * 0.9f); + _toggle.colors = colorBlockCopy; } } } \ No newline at end of file From 792e02a67a0c8faadfbd4f61bddddb8dfa73233c Mon Sep 17 00:00:00 2001 From: Kenneth Yang Date: Tue, 28 Nov 2023 13:23:33 -0800 Subject: [PATCH 77/78] Flip 3 axis pitch --- .../CoordinateSystems/ThreeAxisLeftHandedTransform.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Assets/Scripts/Pinpoint/CoordinateSystems/ThreeAxisLeftHandedTransform.cs b/Assets/Scripts/Pinpoint/CoordinateSystems/ThreeAxisLeftHandedTransform.cs index f2172a0e..3cf0be15 100644 --- a/Assets/Scripts/Pinpoint/CoordinateSystems/ThreeAxisLeftHandedTransform.cs +++ b/Assets/Scripts/Pinpoint/CoordinateSystems/ThreeAxisLeftHandedTransform.cs @@ -1,7 +1,7 @@ using BrainAtlas.CoordinateSystems; using UnityEngine; -namespace CoordinateTransforms +namespace Pinpoint.CoordinateSystems { public class ThreeAxisLeftHandedTransform : CoordinateTransform { @@ -11,7 +11,7 @@ public class ThreeAxisLeftHandedTransform : CoordinateTransform public ThreeAxisLeftHandedTransform(float yaw, float pitch) { var yawRotation = Quaternion.AngleAxis(-yaw, Vector3.up); - var pitchRotation = Quaternion.AngleAxis(pitch, Vector3.right); + var pitchRotation = Quaternion.AngleAxis(90 - pitch, Vector3.right); _rotation = pitchRotation * yawRotation; _inverseRotation = Quaternion.Inverse(_rotation); From 6b754ee50911b023bc85c1fcb04077e462eb97b2 Mon Sep 17 00:00:00 2001 From: Kenneth Yang Date: Tue, 28 Nov 2023 15:23:50 -0800 Subject: [PATCH 78/78] Switch to dimension constructor --- .../Scripts/EphysLink/CommunicationManager.cs | 2 +- .../CoordinateSystems/ManipulatorSpace.cs | 7 ++++++- .../Probes/ManipulatorBehaviorController.cs | 19 +++++++++---------- 3 files changed, 16 insertions(+), 12 deletions(-) diff --git a/Assets/Scripts/EphysLink/CommunicationManager.cs b/Assets/Scripts/EphysLink/CommunicationManager.cs index 2a4611db..29d1bbf4 100644 --- a/Assets/Scripts/EphysLink/CommunicationManager.cs +++ b/Assets/Scripts/EphysLink/CommunicationManager.cs @@ -20,7 +20,7 @@ public class CommunicationManager : MonoBehaviour #region Properties - private static readonly int[] EPHYS_LINK_MIN_VERSION = { 0, 9, 17 }; + private static readonly int[] EPHYS_LINK_MIN_VERSION = { 1, 0, 0 }; public static readonly string EPHYS_LINK_MIN_VERSION_STRING = "≥ v" + string.Join(".", EPHYS_LINK_MIN_VERSION); diff --git a/Assets/Scripts/Pinpoint/CoordinateSystems/ManipulatorSpace.cs b/Assets/Scripts/Pinpoint/CoordinateSystems/ManipulatorSpace.cs index c661a325..e410e818 100644 --- a/Assets/Scripts/Pinpoint/CoordinateSystems/ManipulatorSpace.cs +++ b/Assets/Scripts/Pinpoint/CoordinateSystems/ManipulatorSpace.cs @@ -6,9 +6,14 @@ namespace Pinpoint.CoordinateSystems public sealed class ManipulatorSpace : CoordinateSpace { // Default to Sensapex dimensions - public override Vector3 Dimensions { get; } = Vector3.one * 20; + public override Vector3 Dimensions { get; } public override string Name => "Manipulator"; + public ManipulatorSpace(Vector3 dimensions) + { + Dimensions = dimensions; + } + public override Vector3 Space2World(Vector3 coordSpace, bool useReference = true) { return coordSpace; diff --git a/Assets/Scripts/Pinpoint/Probes/ManipulatorBehaviorController.cs b/Assets/Scripts/Pinpoint/Probes/ManipulatorBehaviorController.cs index 6441a588..8485a1e8 100644 --- a/Assets/Scripts/Pinpoint/Probes/ManipulatorBehaviorController.cs +++ b/Assets/Scripts/Pinpoint/Probes/ManipulatorBehaviorController.cs @@ -3,7 +3,6 @@ using System.Linq; using BrainAtlas; using BrainAtlas.CoordinateSystems; -using CoordinateTransforms; using EphysLink; using Pinpoint.CoordinateSystems; using UnityEngine; @@ -32,7 +31,7 @@ public class ManipulatorBehaviorController : MonoBehaviour public string ManipulatorID { get; private set; } public int NumAxes { get; set; } - + public Vector3 Dimensions { get; set; } /** @@ -269,7 +268,7 @@ void StartEchoing() public void UpdateSpaceAndTransform() { - CoordinateSpace = new ManipulatorSpace(); + CoordinateSpace = new ManipulatorSpace(Dimensions); CoordinateTransform = NumAxes switch { 4 => IsRightHanded @@ -316,14 +315,14 @@ public void ComputeBrainSurfaceOffset() { // We need to calculate the surface coordinate ourselves var tipExtensionDirection = - IsSetToDropToSurfaceWithDepth ? _probeController.GetTipWorldU().tipUpWorldU : Vector3.up; + IsSetToDropToSurfaceWithDepth ? _probeController.GetTipWorldU().tipForwardWorldU : Vector3.down; - var brainSurfaceCoordinate = _probeManager.FindSurfaceIdxCoordinate( - BrainAtlasManager.ActiveReferenceAtlas.World2AtlasIdx(_probeController.GetTipWorldU().tipCoordWorldU - - tipExtensionDirection * 5), - BrainAtlasManager.ActiveReferenceAtlas.World2Atlas_Vector(tipExtensionDirection)); + var brainSurfaceCoordinateIdx = _probeManager.FindSurfaceIdxCoordinate( + BrainAtlasManager.ActiveReferenceAtlas.World2AtlasIdx( + _probeController.GetTipWorldU().tipCoordWorldU + tipExtensionDirection * 5), + BrainAtlasManager.ActiveReferenceAtlas.World2Atlas_Vector(-tipExtensionDirection)); - if (float.IsNaN(brainSurfaceCoordinate.x)) + if (float.IsNaN(brainSurfaceCoordinateIdx.x)) { Debug.LogError("Could not find brain surface! Canceling set brain offset."); return; @@ -331,7 +330,7 @@ public void ComputeBrainSurfaceOffset() var brainSurfaceToTransformed = _probeController.Insertion.World2T( - BrainAtlasManager.ActiveReferenceAtlas.World2AtlasIdx(brainSurfaceCoordinate)); + BrainAtlasManager.ActiveReferenceAtlas.AtlasIdx2World(brainSurfaceCoordinateIdx)); BrainSurfaceOffset += Vector3.Distance(brainSurfaceToTransformed, _probeController.Insertion.apmldv);