Beispiel #1
0
        static void OnLocalizationPoseReceivedCallback(int TrackerID, string ObjectID, float tx, float ty, float tz, float qx, float qy, float qz, float qw)
        {
            EskyPoseCallbackData epcd = new EskyPoseCallbackData();

            (Vector3, Quaternion)vq = instances[TrackerID].IntelPoseToUnity(tx, ty, tz, qx, qy, qz, qw);
            epcd.PoseID             = ObjectID;
            epcd.position           = vq.Item1;
            epcd.rotation           = vq.Item2;
            ((EskyTrackerIntel)instances[TrackerID]).AddPoseFromCallback(epcd);
            UnityEngine.Debug.Log("Received a pose from the relocalization");
        }
Beispiel #2
0
        // Update is called once per frame
        void Update()
        {
            ObtainPose();
            if (myOffsets.AllowsSaving)
            {
                if (Input.GetKeyDown(KeyCode.S))
                {
                    SaveCalibration();
                }
            }
            if (UpdateLocalizationCallback)
            {
                UpdateLocalizationCallback = false;
                ObtainObjectPoses();
                if (instances[TrackerID].ReLocalizationCallback != null)
                {
                    instances[TrackerID].ReLocalizationCallback.Invoke();
                }
            }
            if (ShouldCallBackMap)
            {
                if (subscribedAnchor != null)   // we only return the first instance when saving map info for now, in theory we only subscribe one anchor to one tracker;
                {
                    (Dictionary <string, EskyAnchorContentInfo>, byte[])returnvals = subscribedAnchor.GetEskyMapInfo();
                    retEskyMap.contentLocations = returnvals.Item1;
                    retEskyMap.meshDataArray    = returnvals.Item2;
                }
                if (instances[TrackerID].mapCollectedCallback != null)
                {
                    instances[TrackerID].mapCollectedCallback.Invoke(retEskyMap);
                }

                ShouldCallBackMap = false;
            }
            if (callbackEvents != null)
            {
                if (subscribedAnchor != null)
                {
                    subscribedAnchor.transform.position = callbackEvents.position;
                    subscribedAnchor.transform.rotation = callbackEvents.rotation;
                }
                callbackEvents = null;
            }
            AfterUpdate();
        }
Beispiel #3
0
 public void AddPoseFromCallback(EskyPoseCallbackData epcd)
 {
     callbackEvents = epcd;
 }