Skip to content

Commit 277a41b

Browse files
authored
Merge pull request #285 from stereolabs/v4.1.0
V4.1.0 Update
2 parents ff35f65 + 08e57b2 commit 277a41b

22 files changed

+499
-148
lines changed

ZEDCamera/Assets/ZED/Editor/Scripts/BuildScript.cs

Lines changed: 0 additions & 8 deletions
This file was deleted.

ZEDCamera/Assets/ZED/Editor/Scripts/BuildScript.cs.meta

Lines changed: 0 additions & 15 deletions
This file was deleted.

ZEDCamera/Assets/ZED/Editor/Scripts/ZEDCameraEditor.cs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -605,8 +605,10 @@ public override void OnInspectorGUI()
605605
"Can be useful for stationary cameras where you still need tracking enabled, such as in Object Detection.");
606606
trackingIsStaticProperty.boolValue = EditorGUILayout.Toggle(trackingIsStaticPropertyLabel, trackingIsStaticProperty.boolValue);
607607

608-
GUIContent positionalTrackingModePropertyLabel = new GUIContent("Positional Tracking Mode", "Lists the mode of positional tracking that can be used.");
609-
positionalTrackingModeProperty.enumValueIndex = (int)(sl.POSTIONAL_TRACKING_MODE)EditorGUILayout.EnumPopup(positionalTrackingModePropertyLabel, (sl.POSTIONAL_TRACKING_MODE)positionalTrackingModeProperty.enumValueIndex);
608+
GUIContent positionalTrackingModePropertyLabel = new GUIContent("Positional Tracking Mode", "Lists the mode of positional tracking that can be used.\r\n " +
609+
"- GEN_1 : Default mode, best compromise in performance and accuracy.\r\n" +
610+
"- GEN_2 : Next generation of positional tracking, allows better accuracy.");
611+
positionalTrackingModeProperty.enumValueIndex = (int)(sl.POSITIONAL_TRACKING_MODE)EditorGUILayout.EnumPopup(positionalTrackingModePropertyLabel, (sl.POSITIONAL_TRACKING_MODE)positionalTrackingModeProperty.enumValueIndex);
610612

611613
EditorGUI.indentLevel--;
612614

ZEDCamera/Assets/ZED/Examples/Planetarium/Scripts/PlanetariumMover.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ void Update()
175175

176176
Quaternion gravity = Quaternion.identity;
177177

178-
gravity = Quaternion.FromToRotation(manager.GetZedRootTansform().up, Vector3.up);
178+
gravity = Quaternion.FromToRotation(manager.GetZedRootTransform().up, Vector3.up);
179179
planetarium.transform.localPosition += manager.GetMainCameraTransform().right * axisH * speedMove * Time.deltaTime;
180180
planetarium.transform.localPosition += gravity * manager.GetMainCameraTransform().forward * axisV * speedMove * Time.deltaTime;
181181

ZEDCamera/Assets/ZED/SDK/Helpers/Scripts/BodyTracking/ZEDBodyTrackingManager.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -341,10 +341,10 @@ private void UpdateAvatarControl(SkeletonHandler handler, sl.BodyData data)
341341

342342
for (int i = 0; i < worldJointsPos.Length; i++)
343343
{
344-
worldJointsPos[i] = zedManager.GetZedRootTansform().TransformPoint(data.keypoint[i]);
344+
worldJointsPos[i] = zedManager.GetZedRootTransform().TransformPoint(data.keypoint[i]);
345345
normalizedLocalJointsRot[i] = data.localOrientationPerJoint[i].normalized;
346346
}
347-
Quaternion worldGlobalRotation = zedManager.GetZedRootTansform().rotation * data.globalRootOrientation;
347+
Quaternion worldGlobalRotation = zedManager.GetZedRootTransform().rotation * data.globalRootOrientation;
348348

349349
if (data.localOrientationPerJoint.Length > 0 && data.keypoint.Length > 0 && data.keypointConfidence.Length > 0)
350350
{

ZEDCamera/Assets/ZED/SDK/Helpers/Scripts/Interactions/ZEDControllerTracker.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ protected virtual void Awake()
110110
"value wasn't set, but there are multiple ZEDManagers in the scene. Assign a reference directly to ensure no unexpected behavior.");
111111
}
112112
}
113-
if (zedManager) zedRigRoot = zedManager.GetZedRootTansform();
113+
if (zedManager) zedRigRoot = zedManager.GetZedRootTransform();
114114
}
115115

116116
/// <summary>

ZEDCamera/Assets/ZED/SDK/Helpers/Scripts/Interactions/ZEDTransformController.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,7 @@ private void Update()
184184
}
185185
else if (motion == RelativeMotion.Camera)
186186
{
187-
gravity = Quaternion.FromToRotation(zedManager.GetZedRootTansform().up, Vector3.up);
187+
gravity = Quaternion.FromToRotation(zedManager.GetZedRootTransform().up, Vector3.up);
188188
transform.localPosition += zedManager.GetMainCameraTransform().right * moveAxis.x;
189189
transform.localPosition += zedManager.GetMainCameraTransform().forward * moveAxis.z;
190190
transform.localPosition += gravity * zedManager.GetMainCameraTransform().up * moveAxis.y;
@@ -213,7 +213,7 @@ private void Update()
213213
if (Mathf.Abs(moveaxis.y) < 0.1f) moveaxis.y = 0;
214214
inputRotation += moveaxis.x * rotationSpeed * 360f * Time.deltaTime;
215215

216-
gravity = Quaternion.FromToRotation(zedManager.GetZedRootTansform().up, Vector3.up);
216+
gravity = Quaternion.FromToRotation(zedManager.GetZedRootTransform().up, Vector3.up);
217217
transform.localPosition += gravity * zedManager.GetMainCameraTransform().up * moveaxis.y * movementSpeed * Time.deltaTime;
218218

219219
if (objectTrackers[0].CheckClickButton(ControllerButtonState.Held))
@@ -230,7 +230,7 @@ private void Update()
230230
if (moveaxis.x != 0 || moveaxis.y != 0)
231231
{
232232
isMoving = true;
233-
gravity = Quaternion.FromToRotation(zedManager.GetZedRootTansform().up, Vector3.up);
233+
gravity = Quaternion.FromToRotation(zedManager.GetZedRootTransform().up, Vector3.up);
234234
transform.localPosition += zedManager.GetMainCameraTransform().right * moveaxis.x * movementSpeed * Time.deltaTime;
235235
transform.localPosition += gravity * zedManager.GetMainCameraTransform().forward * moveaxis.y * movementSpeed * Time.deltaTime;
236236
}
@@ -334,7 +334,7 @@ IEnumerator RepositionAfterZEDReady()
334334
{
335335
for (int i = 0; i < 50; i++)
336336
{
337-
print(zedManager.GetZedRootTansform().position);
337+
print(zedManager.GetZedRootTransform().position);
338338
yield return null;
339339
}
340340

ZEDCamera/Assets/ZED/SDK/Helpers/Scripts/SpatialMapping/ZEDSpatialMapping.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -847,7 +847,7 @@ public bool LoadMesh(string meshFilePath = "ZEDMesh.obj")
847847
zedCamera.DisableTracking();
848848
Quaternion quat = Quaternion.identity; Vector3 tr = Vector3.zero;
849849

850-
if (zedCamera.EnableTracking(ref quat, ref tr, true, false, false, false, true, -1.0f, true, sl.POSTIONAL_TRACKING_MODE.STANDARD, System.IO.File.Exists(basePath + ".area") ? basePath + ".area" : "") != sl.ERROR_CODE.SUCCESS)
850+
if (zedCamera.EnableTracking(ref quat, ref tr, true, false, false, false, true, -1.0f, true, sl.POSITIONAL_TRACKING_MODE.GEN_1, System.IO.File.Exists(basePath + ".area") ? basePath + ".area" : "") != sl.ERROR_CODE.SUCCESS)
851851
{
852852
Debug.LogWarning(ZEDLogMessage.Error2Str(ZEDLogMessage.ERROR.TRACKING_NOT_INITIALIZED));
853853
}

ZEDCamera/Assets/ZED/SDK/Helpers/Scripts/ZEDManager.cs

Lines changed: 25 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -295,7 +295,7 @@ public enum shaderType
295295
/// Positional tracking mode used. Can be used to improve accuracy in some type of scene at the cost of longer runtime.
296296
/// </summary>
297297
[HideInInspector]
298-
public sl.POSTIONAL_TRACKING_MODE positionalTrackingMode;
298+
public sl.POSITIONAL_TRACKING_MODE positionalTrackingMode;
299299

300300
/// <summary>
301301
/// Estimate initial position by detecting the floor.
@@ -1012,7 +1012,7 @@ public float MaxDepthRange
10121012
/// </summary>
10131013
[SerializeField]
10141014
[HideInInspector]
1015-
private int m_confidenceThreshold = 100;
1015+
private int m_confidenceThreshold = 95;
10161016
/// <summary>
10171017
/// How tolerant the ZED SDK is to low confidence values. Lower values filter more pixels.
10181018
/// </summary>
@@ -1592,7 +1592,7 @@ public sl.TRACKING_STATE ZEDTrackingState
15921592
/// Gets the center transform, which is the transform moved by the tracker in AR mode.
15931593
/// This is the root object in ZED_Rig_Mono, and Camera_eyes in ZED_Rig_Stereo.
15941594
/// </summary>
1595-
public Transform GetZedRootTansform()
1595+
public Transform GetZedRootTransform()
15961596
{
15971597
return zedRigRoot;
15981598
}
@@ -2211,30 +2211,35 @@ private void OpenZEDInBackground()
22112211

22122212
private System.Collections.IEnumerator InitZED()
22132213
{
2214-
if (initParameters.depthMode == sl.DEPTH_MODE.NEURAL)
2214+
DEPTH_MODE[] NeuralModes = { DEPTH_MODE.NEURAL, DEPTH_MODE.NEURAL_PLUS };
2215+
2216+
foreach (var mode in NeuralModes)
22152217
{
2216-
System.Diagnostics.Stopwatch watch = new System.Diagnostics.Stopwatch(); //Time how long the loading takes so we can tell the user.
2217-
watch.Start();
2218-
2219-
sl.AI_Model_status status = sl.ZEDCamera.CheckAIModelStatus(sl.AI_MODELS.NEURAL_DEPTH, 0);
2220-
if (!status.optimized)
2218+
if (initParameters.depthMode == mode)
22212219
{
2222-
var threadOptim = new Thread(() => OptimizeModel(sl.AI_MODELS.NEURAL_DEPTH)); //Assign thread.
2223-
threadOptim.Start();
2220+
System.Diagnostics.Stopwatch watch = new System.Diagnostics.Stopwatch(); //Time how long the loading takes so we can tell the user.
2221+
watch.Start();
22242222

2225-
while (optimStatus != sl.ERROR_CODE.SUCCESS)
2223+
sl.AI_Model_status status = sl.ZEDCamera.CheckAIModelStatus(ZEDCamera.ToAIModel(mode), 0);
2224+
if (!status.optimized)
22262225
{
2227-
if (watch.Elapsed.TotalSeconds > optimTimeout_S)
2226+
var threadOptim = new Thread(() => OptimizeModel(ZEDCamera.ToAIModel(mode))); //Assign thread.
2227+
threadOptim.Start();
2228+
2229+
while (optimStatus != sl.ERROR_CODE.SUCCESS)
22282230
{
2229-
Debug.LogError("Optimization process Timeout. Please try to optimze the AI models outside of Unity, using the ZED Diagnostic tool ");
2230-
yield break;
2231-
}
2231+
if (watch.Elapsed.TotalSeconds > optimTimeout_S)
2232+
{
2233+
Debug.LogError("Optimization process Timeout. Please try to optimze the AI models outside of Unity, using the ZED Diagnostic tool ");
2234+
yield break;
2235+
}
22322236

2233-
Debug.LogWarning($"Optimizing neural model ... The process can take few minutes. Running for {watch.Elapsed.TotalSeconds.ToString("N2")} seconds.");
2234-
yield return new WaitForSeconds(5.0f);
2237+
Debug.LogWarning($"Optimizing neural model ... The process can take few minutes. Running for {watch.Elapsed.TotalSeconds.ToString("N2")} seconds.");
2238+
yield return new WaitForSeconds(5.0f);
2239+
}
2240+
threadOptim.Join();
2241+
watch.Stop();
22352242
}
2236-
threadOptim.Join();
2237-
watch.Stop();
22382243
}
22392244
}
22402245

@@ -3216,18 +3221,6 @@ private void RetrieveObjectDetectionFrame()
32163221
}
32173222
}
32183223

3219-
/// <summary>
3220-
/// Switchs the state of the object detection pause.
3221-
/// </summary>
3222-
/// <param name="state">If set to <c>true</c> state, the object detection will pause. It will resume otherwise</param>
3223-
public void SwitchObjectDetectionPauseState(bool state)
3224-
{
3225-
if (zedCamera != null)
3226-
{
3227-
if (objectDetectionRunning)
3228-
zedCamera.PauseObjectDetection(state);
3229-
}
3230-
}
32313224
#endregion
32323225

32333226
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
@@ -3438,18 +3431,6 @@ private void RetrieveBodyTrackingFrame()
34383431
}
34393432
}
34403433

3441-
/// <summary>
3442-
/// Switchs the state of the body tracking pause.
3443-
/// </summary>
3444-
/// <param name="state">If set to <c>true</c> state, the body tracking will pause. It will resume otherwise</param>
3445-
public void SwitchBodyTrackingPauseState(bool state)
3446-
{
3447-
if (zedCamera != null)
3448-
{
3449-
if (bodyTrackingRunning)
3450-
zedCamera.PauseBodyTracking(state);
3451-
}
3452-
}
34533434
#endregion
34543435

34553436

ZEDCamera/Assets/ZED/SDK/Helpers/Shaders/Lighting/ZED_Deferred.shader

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -64,9 +64,10 @@ Properties
6464
v2f o;
6565
#if SHADER_API_D3D11
6666
o.pos = float4(v.pos.x*2.0, v.pos.y*2.0, 0, 1);
67-
#elif SHADER_API_GLCORE || SHADER_API_VULKAN
67+
#elif SHADER_API_GLCORE
6868
o.pos = float4(v.pos.x*2.0, -v.pos.y*2.0, 0, 1);
69-
69+
#elif SHADER_API_VULKAN
70+
o.pos = float4(v.pos.x * 2.0, -v.pos.y * 2.0, 0, 1);
7071
#endif
7172
o.screenUV = float4(v.pos.x - 0.5, v.pos.y - 0.5, 0, 1);
7273
o.depthUV = float4(v.pos.x + 0.5f, v.pos.y + 0.5f, 0, 1);
@@ -121,8 +122,10 @@ Properties
121122
#ifdef NO_DEPTH
122123
#if SHADER_API_D3D11
123124
outDepth = 0;
124-
#elif SHADER_API_GLCORE
125+
#elif SHADER_API_GLCORE
125126
outDepth = 1000;//fake infinite depth
127+
#elif SHADER_API_VULCAN
128+
outDepth = 0;
126129
#endif
127130
#else
128131
outDepth = saturate(d);

0 commit comments

Comments
 (0)