Skip to content

Commit d0351cc

Browse files
authored
fix: 597 copilot drive direction incorrect (#598)
* Things are working * Set drive speed to normal
1 parent 90f1574 commit d0351cc

File tree

4 files changed

+13
-15
lines changed

4 files changed

+13
-15
lines changed

Assets/Scripts/Pinpoint/UI/EphysCopilot/DrivePanelHandler.cs

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
using BrainAtlas;
12
using EphysLink;
23
using TMPro;
34
using UnityEngine;
@@ -34,8 +35,8 @@ private enum DriveState
3435

3536
// Base speeds (in mm/s)
3637
private const float DEPTH_DRIVE_BASE_SPEED_TEST = 0.5f;
37-
private const float DEPTH_DRIVE_BASE_SPEED = DEPTH_DRIVE_BASE_SPEED_TEST;
38-
// private const float DEPTH_DRIVE_BASE_SPEED = 0.005f;
38+
// private const float DEPTH_DRIVE_BASE_SPEED = DEPTH_DRIVE_BASE_SPEED_TEST;
39+
private const float DEPTH_DRIVE_BASE_SPEED = 0.005f;
3940

4041
// Speed multipliers
4142
private const float NEAR_TARGET_SPEED_MULTIPLIER = 2f / 3f;
@@ -220,15 +221,17 @@ private float _targetDriveDistance
220221
var targetPositionWorldT = targetInsertion.PositionWorldT();
221222
var relativePositionWorldT =
222223
ProbeManager.ProbeController.Insertion.PositionWorldT() - targetPositionWorldT;
223-
var probeTipTUp = ProbeManager.ProbeController.ProbeTipT.up;
224+
var probeTipTForward = ProbeManager.ProbeController.ProbeTipT.forward;
224225
var offsetAdjustedRelativeTargetPositionWorldT =
225-
Vector3.ProjectOnPlane(relativePositionWorldT, probeTipTUp);
226+
Vector3.ProjectOnPlane(relativePositionWorldT, probeTipTForward);
226227
var offsetAdjustedTargetPositionWorldT =
227228
targetPositionWorldT + offsetAdjustedRelativeTargetPositionWorldT;
228229

229230
// Converting worldT back to APMLDV (position transformed)
230231
targetInsertion.apmldv = targetInsertion.World2T(offsetAdjustedTargetPositionWorldT);
231232

233+
print("Target distance: " + Vector3.Distance(targetInsertion.apmldv, _duraAPMLDV));
234+
232235
return Vector3.Distance(targetInsertion.apmldv, _duraAPMLDV);
233236
}
234237
}

Assets/Scripts/Pinpoint/UI/EphysCopilot/InsertionSelectionPanelHandler.cs

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -305,15 +305,9 @@ private void ComputeMovementInsertions()
305305
};
306306

307307
// Recalculate AP and ML based on pre-depth-drive DV
308-
var targetProbeManager =
309-
ManipulatorIDToSelectedTargetProbeManager[ProbeManager.ManipulatorBehaviorController.ManipulatorID];
310-
var (brainSurfaceCoordinateIdx, _) = targetProbeManager.CalculateEntryCoordinate(!ProbeManager
311-
.ManipulatorBehaviorController
312-
.IsSetToDropToSurfaceWithDepth);
313-
314308
var brainSurfaceTransformed =
315-
targetProbeManager.ProbeController.Insertion.World2T(
316-
BrainAtlasManager.ActiveReferenceAtlas.AtlasIdx2World(brainSurfaceCoordinateIdx));
309+
ManipulatorIDToSelectedTargetProbeManager[ProbeManager.ManipulatorBehaviorController.ManipulatorID]
310+
.GetSurfaceCoordinateT().surfaceCoordinateT;
317311

318312
// AP Axis
319313
_movementAxesInsertions.ap = new ProbeInsertion(_movementAxesInsertions.dv)
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
{
2-
"Date": "11/30/2023 2:28:23 PM",
2+
"Date": "11/30/2023 3:04:24 PM",
33
"UnityVersion": "2022.3.12f1",
44
"com.unity.scriptablebuildpipeline": "1.21.20",
55
"com.unity.addressables": "1.21.18",
66
"traceEvents": [
7-
{"name": "Building Use Asset Database (fastest)", "ph": "X", "dur": 346.7, "tid": 1, "ts": 1280, "pid": 1}
7+
{"name": "Building Use Asset Database (fastest)", "ph": "X", "dur": 586.8, "tid": 1, "ts": 1248, "pid": 1}
88
]
99
}

ProjectSettings/ProjectSettings.asset

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,8 @@ PlayerSettings:
137137
vulkanEnableCommandBufferRecycling: 1
138138
loadStoreDebugModeEnabled: 0
139139
bundleVersion: 1.0.3
140-
preloadedAssets: []
140+
preloadedAssets:
141+
- {fileID: 11400000, guid: 6057f25234ce83a4bbb3ae618a501907, type: 2}
141142
metroInputSource: 0
142143
wsaTransparentSwapchain: 0
143144
m_HolographicPauseOnTrackingLoss: 1

0 commit comments

Comments
 (0)