void LogTrackerInitIssues(VLTrackingIssues errorIssues, VLTrackingIssues warningIssues) { // Please use this function in order notify the user of unforseen events during initialization of the tracking pipe // Review the documentation of the visionLib SDK in order to get information on possible errorCodes that // can help you interpret the error/warning messages // Error means, that the visionLib will not work at this moment-> It will NOT start running then if (errorIssues != null) { // Errors on init, which lead to better not advance right now... Debug.LogError("LogTrackerInitIssues Errors:" + errorIssues.message); for (int i = 0; i < errorIssues.issues.Length; i++) { Debug.LogError("LogTrackerInitIssue: " + i + "->" + errorIssues.issues[i].code + "->" + errorIssues.issues[i].info); } } // Warning means, that the visionLib will work but might have an issue which can harm the tracking quality // (e.g. a not well recognized/calibrated camera) if (warningIssues != null) { // We have some advises from the system that are fine to interpret and // pass to the user... Debug.LogWarning("LogTrackerInitIssues Warnings:" + warningIssues.message); for (int i = 0; i < warningIssues.issues.Length; i++) { Debug.LogWarning("LogTrackerInitIssue: " + i + "->" + warningIssues.issues[i].code + "->" + warningIssues.issues[i].info); } } }
private void CreateTrackerHandler(string errorJson, string resultJson) { bool hasError = (errorJson != null); if (OnTrackerInitializedWithIssues != null) { VLTrackingIssues errorIssues = null; VLTrackingIssues warningIssues = null; if (errorJson != null) { errorIssues = VLJsonUtility.FromJson <VLTrackingIssues>(errorJson); } if (resultJson != null) { warningIssues = VLJsonUtility.FromJson <VLTrackingIssues>(resultJson); } OnTrackerInitializedWithIssues(errorIssues, warningIssues); } if (OnTrackerInitialized != null) { OnTrackerInitialized(errorJson == null); } // Push the RunTracking command after calling the OnTrackerInitialized // event in order to give the user the chance to push commands which // will then be executed before the tracking is running. // only run if no error has occured... if (!hasError) { this.worker.PushCommand( new RunTrackingCmd(), DispatchRunTrackingCallback, GCHandle.ToIntPtr(this.gcHandle)); } else { StopTracking(); } }
private void LogTrackerInitIssues(VLTrackingIssues errors, VLTrackingIssues warnings) { // Notify the user of problems during the initialization of the // tracking pipeline. Take a look at the VisionLib SDK documentation // for a complete list of error codes. // If an error occurred, then the tracking won't work if (errors != null) { if (errors.message != null && errors.message != "") { this.errorTextList.Add(errors.message); Debug.LogError("Error: " + errors.message); } if (errors.issues != null) { foreach (VLTrackingIssues.VLTrackingIssue issue in errors.issues) { string errorMessage = GetErrorMessage(issue); if (errorMessage != null) { this.errorTextList.Add(errorMessage); Debug.LogError("Issue " + issue.code + " (\"" + issue.info + "\"): " + errorMessage); } else { Debug.LogError("Issue " + issue.code + " (\"" + issue.info + "\")"); } } } } // If a warning occurred, then the tracking will work, but the tracking // quality might be harmed (e.g. camera not calibrated) if (warnings != null) { if (warnings.message != null && warnings.message != "") { this.warningTextList.Add(warnings.message); Debug.LogWarning("Warning: " + warnings.message); } if (warnings.issues != null) { foreach (VLTrackingIssues.VLTrackingIssue issue in warnings.issues) { string errorMessage = GetErrorMessage(issue); if (errorMessage != null) { this.warningTextList.Add(errorMessage); Debug.LogWarning("Issue " + issue.code + " (\"" + issue.info + "\"): " + errorMessage); } else { Debug.LogWarning("Issue " + issue.code + " (\"" + issue.info + "\")"); } } } } if (this.textComponent != null) { foreach (string errorText in this.errorTextList) { if (this.issuesText != "") { this.issuesText += "\n"; } this.issuesText += "[Error] " + errorText; } foreach (string warningText in this.warningTextList) { if (this.issuesText != "") { this.issuesText += "\n"; } this.issuesText += "[Warning] " + warningText; } // Updating the text of the textComponent here caused crashes on // the HoloLens. As a workaround, we update the text inside the // OnGUI function. } }