public void OnSaveMapClick() { if (!LibPlacenote.Instance.Initialized()) { Debug.Log("SDK not yet initialized"); return; } bool useLocation = Input.location.status == LocationServiceStatus.Running; LocationInfo locationInfo = Input.location.lastData; mLabelText.text = "Saving..."; LibPlacenote.Instance.SaveMap( (mapId) => { LibPlacenote.Instance.StopSession(); FeaturesVisualizer.DisablePointcloud(); FeaturesVisualizer.clearPointcloud(); mLabelText.text = "Saved Map ID: " + mapId; mInitButtonPanel.SetActive(true); mMappingButtonPanel.SetActive(false); LibPlacenote.MapMetadataSettable metadata = CreateMetaDataObject(); LibPlacenote.Instance.SetMetadata(mapId, metadata, (success) => { if (success) { mLabelText.text = "Meta data successfully saved"; } else { mLabelText.text = "Meta data failed to save"; } }); SaveMapIDToFile(mapId); }, (completed, faulted, percentage) => { if (completed) { mLabelText.text = "Upload Complete:"; // delete the planes. ConfigureSession(false, true); } else if (faulted) { mLabelText.text = "Upload of Map failed"; } else { mLabelText.text = "Upload Progress: " + percentage.ToString("F2") + "/1.0)"; } } ); }
//Called when user has selected a route and clicked Load public void OnLoadRouteClicked() { ConfigureSession(); //Sets ARKit configuration for session FeaturesVisualizer.DisablePointcloud(); //Ensure feature points dont show to user FeaturesVisualizer.clearPointcloud(); //Clear any already visible features notificationPanelText.text = "Loading Route ID: " + selectedRouteId; LibPlacenote.Instance.LoadMap(selectedRouteId, (completed, faulted, percentage) => { if (completed) //Mapping of route download finished { routeSelectedPanel.SetActive(false); routeListPanel.SetActive(false); initialPanel.SetActive(false); mappingPanel.SetActive(false); exitButton.SetActive(true); LibPlacenote.Instance.StartSession(); //Start Placenote Session when route has successfully downloaded notificationPanelText.text = "Loaded Route ID: " + selectedRouteId; } else if (faulted) //route failed to load { notificationPanelText.text = "Failed to load Route ID: " + selectedRouteId; } else //Route downloading { notificationPanelText.text = "Route Download: " + percentage.ToString("F2") + "/1.0"; } } ); }
public void OnExitClick() { LibPlacenote.Instance.StopSession(); FeaturesVisualizer.clearPointcloud(); initialized = false; haveMapName = false; mapping = false; localizeFirstTime = false; mInitButtonPanel.SetActive(true); mExitButton.SetActive(false); mExtendedPanel.SetActive(false); mActivateDesButton.SetActive(false); mMappingButtonPanel.SetActive(false); DropdownList.gameObject.SetActive(false); scanPopup.SetActive(false); selectDesPopUp.SetActive(false); waitPopUp.SetActive(false); destination = null; destinationList.Clear(); DropdownList.value = 0; DropdownList.options.Clear(); DropdownList.RefreshShownValue(); shapeManager.ClearShapes(); navController.ReSetParameter(); infoManager.Close(); StopAllCoroutines(); StartCoroutine(UIcheck()); }
public void OnStatusChange(LibPlacenote.MappingStatus prevStatus, LibPlacenote.MappingStatus currStatus) { Debug.Log("prevStatus: " + prevStatus.ToString() + " currStatus: " + currStatus.ToString()); if (currStatus == LibPlacenote.MappingStatus.RUNNING && prevStatus == LibPlacenote.MappingStatus.LOST) { Debug.Log("Localized: " + mSelectedMapInfo.metadata.name); GetComponent <CustomShapeManager>().LoadShapesJSON(mSelectedMapInfo.metadata.userdata); FeaturesVisualizer.DisablePointcloud(); } else if (currStatus == LibPlacenote.MappingStatus.RUNNING && prevStatus == LibPlacenote.MappingStatus.WAITING) { Debug.Log("Mapping"); } else if (currStatus == LibPlacenote.MappingStatus.LOST) { Debug.Log("Searching for position lock"); } else if (currStatus == LibPlacenote.MappingStatus.WAITING) { if (GetComponent <CustomShapeManager>().shapeObjList.Count != 0) { //GetComponent<CustomShapeManager>().ClearShapes(); } } }
public void OnLoadMapClick() { ConfigureSession(); if (!LibPlacenote.Instance.Initialized()) { Debug.Log("SDK not yet initialized"); return; } ResetSlider(); mLabelText.text = "Loading Map ID: " + mSelectedMapId; LibPlacenote.Instance.LoadMap(mSelectedMapId, (completed, faulted, percentage) => { if (completed) { mMapSelectedPanel.SetActive(false); mMapListPanel.SetActive(false); mInitPanel.SetActive(false); mExitButton.SetActive(true); mMappingPanel.SetActive(true); mMappingPanel.transform.Find("SaveMapButton").gameObject.SetActive(false); // Disable pointcloud FeaturesVisualizer.DisablePointcloud(); LibPlacenote.Instance.StartSession(); if (mReportDebug) { LibPlacenote.Instance.StartRecordDataset((datasetCompleted, datasetFaulted, datasetPercentage) => { if (datasetCompleted) { mLabelText.text = "Dataset Upload Complete"; } else if (datasetFaulted) { mLabelText.text = "Dataset Upload Faulted"; } else { mLabelText.text = "Dataset Upload: " + datasetPercentage.ToString("F2") + "/1.0"; } }); Debug.Log("Started Debug Report"); } mLabelText.text = "Loaded ID: " + mSelectedMapId; } else if (faulted) { mLabelText.text = "Failed to load ID: " + mSelectedMapId; } else { mLabelText.text = "Map Download: " + percentage.ToString("F2") + "/1.0"; } }); }
public void OnStatusChange(LibPlacenote.MappingStatus prevStatus, LibPlacenote.MappingStatus currStatus) { Debug.Log("prevStatus: " + prevStatus.ToString() + " currStatus: " + currStatus.ToString()); if (currStatus == LibPlacenote.MappingStatus.RUNNING && prevStatus == LibPlacenote.MappingStatus.LOST) { Debug.Log("Localized: " + mSelectedMapInfo.metadata.name); GetComponent <CustomShapeManager>().LoadShapesJSON(mSelectedMapInfo.metadata.userdata); FeaturesVisualizer.DisablePointcloud(); //Waypoint has been loaded readStatus.GetComponentInChildren <Text>().text = "Recognized"; readStatus.GetComponentInChildren <Text>().CrossFadeColor(Color.clear, 4f, false, true); readStatus.GetComponent <Image>().CrossFadeColor(Color.clear, 3.5f, false, true); } else if (currStatus == LibPlacenote.MappingStatus.RUNNING && prevStatus == LibPlacenote.MappingStatus.WAITING) { Debug.Log("Mapping"); } else if (currStatus == LibPlacenote.MappingStatus.LOST) { Debug.Log("Searching for position lock"); } else if (currStatus == LibPlacenote.MappingStatus.WAITING) { if (GetComponent <CustomShapeManager>().shapeObjList.Count != 0) { //GetComponent<CustomShapeManager>().ClearShapes(); } } }
// Toggle the Feature Point drawing mode private void ToggleModeFeature(bool modeFeatureOn) { if (modeFeatureOn) { // Turn on currentDrawingMode = DrawingMode.feature; if (pointCloudOn == false) { FeaturesVisualizer.EnablePointcloud(new Color(1f, 1f, 1f, 0.2f), new Color(1f, 1f, 1f, 0.8f)); pointCloudOn = true; Debug.Log("Point Cloud On"); } GetComponent <FeatureHighlightController>().ToggleHighlight(true); textLabel.text = "Highlight a Feature and Tap the Screen to Connect"; } else { // Turn off currentDrawingMode = DrawingMode.none; if (pointCloudOn == true) { FeaturesVisualizer.DisablePointcloud(); pointCloudOn = false; Debug.Log("Point Cloud Off"); } GetComponent <FeatureHighlightController>().ToggleHighlight(false); } }
void Start() { // Set up SerializableModel's sModels = ScriptableObject.CreateInstance <SerializeModels>(); sModels.Init(); sModels.prefabs[0] = modelPrefab; sPaintStrokes = ScriptableObject.CreateInstance <SerializePaintStrokes>(); sPaintStrokes.Init(); sPeople = ScriptableObject.CreateInstance <SerializePeople>(); sPeople.Init(); InitUI(); currentMapId = ""; mappingStarted = false; hasLocalized = false; mPNPlaneManager = GameObject.FindWithTag("PNPlaneManager").GetComponent <PlacenoteARGeneratePlane>(); Input.location.Start(); mSession = UnityARSessionNativeInterface.GetARSessionNativeInterface(); StartARKit(); FeaturesVisualizer.EnablePointcloud(); LibPlacenote.Instance.RegisterListener(this); paintManager = GameObject.FindWithTag("PaintManager").GetComponent <PaintManager>(); ARPlanePaintingStatus = mPlaneDetectionToggle.GetComponent <Toggle>().isOn; paintManager.ARPlanePainting = ARPlanePaintingStatus; paintManager.paintOnTouch = !ARPlanePaintingStatus; // TODO: make an enum to replace multiple bools }
public void OnPose(Matrix4x4 outputPose, Matrix4x4 arkitPose) { // we only care about the mapping mode here if (LibPlacenote.Instance.GetMode() != LibPlacenote.MappingMode.MAPPING) { return; } // get the full point built so far List <Vector3> fullPointCloudMap = FeaturesVisualizer.GetPointCloud(); // Check if either are null if (fullPointCloudMap == null) { Debug.Log("Point cloud is null"); return; } Debug.Log("Point cloud size = " + fullPointCloudMap.Count); saveButtonProgressBar.gameObject.GetComponent <Image>().fillAmount = fullPointCloudMap.Count / minMapSize; if (fullPointCloudMap.Count >= minMapSize) { mLabelText.text = "Minimum map created. Keep adding notes or save the map anytime."; // Check the map quality to confirm whether you can save if (LibPlacenote.Instance.GetMappingQuality() == LibPlacenote.MappingQuality.GOOD) { mapQualityThresholdCrossed = true; } } }
//------------------------------LoadMapPanel-------------------------------- private void StartMapping() { MessageManager.Instance.ShowMessage("Slowly move around the object."); //disable detected planes VirtualContentManager.Instance.SetARPlanesVisible(false); //reset progress status MappingFacade.Instance.ResetMappingProgress(); mapQualityThresholdCrossed = false; currentAnchorScanningProgress = 0f; // Enable pointcloud FeaturesVisualizer.EnablePointcloud(Const.FEATURE_POINT_WEAK, Const.FEATURE_POINT_STRONG); if (isNewExperience) { LibPlacenote.Instance.StartSession(); MessageManager.Instance.DebugMessage("New mapping started"); } else { LibPlacenote.Instance.RestartSendingFrames(); MessageManager.Instance.DebugMessage("Mapping resumed"); } }
public void OnStatusChange(LibPlacenote.MappingStatus prevStatus, LibPlacenote.MappingStatus currStatus) { Debug.Log("prevStatus: " + prevStatus.ToString() + " currStatus: " + currStatus.ToString()); if (currStatus == LibPlacenote.MappingStatus.RUNNING && prevStatus == LibPlacenote.MappingStatus.LOST) { //Debug.Log("Localized: " + mSelectedMapInfo.metadata.name); string[] mapNameArray = mapName.Split('/'); navigationPanelText.GetComponent <Text>().text = "Navigating to " + mapNameArray[0] + ", Floor " + mapNameArray[1] + ", " + mapNameArray[2]; GetComponent <CustomShapeManager>().LoadShapesJSON(mSelectedMapInfo.metadata.userdata); FeaturesVisualizer.DisablePointcloud(); } else if (currStatus == LibPlacenote.MappingStatus.RUNNING && prevStatus == LibPlacenote.MappingStatus.WAITING) { Debug.Log("Mapping"); } else if (currStatus == LibPlacenote.MappingStatus.LOST) { navigationPanelText.GetComponent <Text>().text = "Locating..."; //Debug.Log("Searching for position lock"); } else if (currStatus == LibPlacenote.MappingStatus.WAITING) { if (GetComponent <CustomShapeManager>().shapeObjList.Count != 0) { //GetComponent<CustomShapeManager>().ClearShapes(); } } }
// Save a map and upload it to Placenote cloud public void OnSaveMapClick() { mappingPanel.SetActive(false); initPanel.SetActive(true); localizedPanel.SetActive(false); FeaturesVisualizer.clearPointcloud(); if (!LibPlacenote.Instance.Initialized()) { notifications.text = "SDK not yet initialized"; return; } // save and upload the map LibPlacenote.Instance.SaveMap( (mapId) => { /* * savedMapID = mapId; * LibPlacenote.Instance.StopSession(); * WriteMapIDToFile(mapId); */ savedMapID = mapId; LibPlacenote.Instance.StopSession(); }, (completed, faulted, percentage) => { if (completed) { notifications.text = "Upload Complete:" + savedMapID; // upload meta data LibPlacenote.MapMetadataSettable metadata = CreateMetaDataObject(); LibPlacenote.Instance.SetMetadata(savedMapID, metadata, (success) => { if (success) { notifications.text = "Meta data successfully saved"; } else { notifications.text = "Meta data failed to save"; } }); GetComponent <ModelManager>().ClearModels(); } else if (faulted) { notifications.text = "Upload of Map: " + savedMapID + " failed"; } else { notifications.text = "Upload Progress: " + percentage.ToString("F2") + "/1.0)"; } } ); }
private void Start() { mRoomOptions = new RoomOptions() { MaxPlayers = 10 }; IsHost = false; IsPlaying = false; IsLocalized = false; // Allows for GPS custom property to be readable in Photon lobby mRoomOptions.CustomRoomPropertiesForLobby = new string[1] { "GPS" }; // Start GPS setup StartCoroutine(StartLocationService()); // Start connection to photon Connect(); // Required for OnStatusChange and OnPose to be called LibPlacenote.Instance.RegisterListener(this); // ARKit Initialization mSession = UnityARSessionNativeInterface.GetARSessionNativeInterface(); StartARKit(); if (mDebug) { FeaturesVisualizer.EnablePointcloud(); } }
void Awake() { sInstance = this; // This is required for OnPose and OnStatusChange to be triggered LibPlacenote.Instance.RegisterListener(this); }
private void CheckIfEnoughPointcloudCollectedForMap() { // get the full point built so far List <Vector3> fullPointCloudMap = FeaturesVisualizer.GetPointCloud(); // Check if either are null if (fullPointCloudMap == null) { Debug.Log("Point cloud is null"); return; } Debug.Log("Point cloud size = " + fullPointCloudMap.Count); saveButtonProgressBar.gameObject.GetComponent <Image>().fillAmount = fullPointCloudMap.Count / minMapSize; if (fullPointCloudMap.Count >= minMapSize) { if (LibPlacenote.Instance.GetMode() == LibPlacenote.MappingMode.MAPPING) { mLabelText.text = "Reeady to save the map."; } // Check the map quality to confirm whether you can save if (LibPlacenote.Instance.GetMappingQuality() == LibPlacenote.MappingQuality.GOOD) { mapQualityThresholdCrossed = true; } } }
// Use this for initialization void Start() { Input.location.Start(); mMapListPanel.SetActive(false); FeaturesVisualizer.EnablePointcloud(); LibPlacenote.Instance.RegisterListener(this); // Localization thumbnail handler. mLocalizationThumbnail.gameObject.SetActive(false); // Set up the localization thumbnail texture event. LocalizationThumbnailSelector.Instance.TextureEvent += (thumbnailTexture) => { if (mLocalizationThumbnail == null) { return; } RectTransform rectTransform = mLocalizationThumbnail.rectTransform; if (thumbnailTexture.width != (int)rectTransform.rect.width) { rectTransform.SetSizeWithCurrentAnchors( RectTransform.Axis.Horizontal, thumbnailTexture.width * 2); rectTransform.SetSizeWithCurrentAnchors( RectTransform.Axis.Vertical, thumbnailTexture.height * 2); rectTransform.ForceUpdateRectTransforms(); } mLocalizationThumbnail.texture = thumbnailTexture; }; }
// Use this for initialization void Start() { Mapnamestatus.SetActive(false); //cloudfeature = new FeaturesVisualizer(); Input.location.Start(); FeatureText.SetActive(true); Invoke("HideFeatures", 2.5f); mMapListPanel.SetActive(false); textmapname.SetActive(false); mSession = UnityARSessionNativeInterface.GetARSessionNativeInterface(); UnityARSessionNativeInterface.ARFrameUpdatedEvent += ARFrameUpdated; StartARKit(); FeaturesVisualizer.EnablePointcloud(); //newly added mPlaneDetectionToggle.GetComponent <Toggle>().isOn = false; LibPlacenote.Instance.RegisterListener(this); ResetSlider(); // for simulator #if UNITY_EDITOR mSimulatorAddShapeButton.SetActive(true); mPlaneDetectionToggle.SetActive(false); #endif }
void LoadMap() { ConfigureSession(); LibPlacenote.Instance.LoadMap(mSelectedMapInfo.placeId, (completed, faulted, percentage) => { if (completed) { // Disable pointcloud FeaturesVisualizer.DisablePointcloud(); LibPlacenote.Instance.StartSession(); mLocalizationThumbnail.gameObject.SetActive(true); mLabelText.text = "Loaded Map. Trying to localize..."; } else if (faulted) { mLabelText.text = "Failed to load ID: " + mSelectedMapId; } else { if (!float.IsNaN(percentage)) { mLabelText.text = "downloading map..." + (percentage * 100).ToString("N0") + "%"; } } } ); }
public void OnSelectCancel() { //Debug.Log("Cancelling. Moving to MainList Mode."); LibPlacenote.Instance.StopSession(); FeaturesVisualizer.clearPointcloud(); AM.instance.ClearAudioCues(); MM.instance.SwitchModes(mapListMode); }
void Start() { Input.location.Start(); mSession = UnityARSessionNativeInterface.GetARSessionNativeInterface(); StartARKit(); FeaturesVisualizer.EnablePointcloud(); LibPlacenote.Instance.RegisterListener(this); }
/** * Saves the current map. */ public void SaveMap(string name) { if (!LibPlacenote.Instance.Initialized()) { OutputPlacenoteText("SDK not yet initialized"); return; } bool useLocation = Input.location.status == LocationServiceStatus.Running; LocationInfo locationInfo = Input.location.lastData; OutputPlacenoteText("Saving scan."); LibPlacenote.Instance.SaveMap( (mapId) => { LibPlacenote.Instance.StopSession(); FeaturesVisualizer.clearPointcloud(); // Create metadata LibPlacenote.MapMetadataSettable metadata = new LibPlacenote.MapMetadataSettable(); metadata.name = name; JObject userdata = new JObject(); metadata.userdata = userdata; JObject audioCueList = AM.instance.AudioCuesToJSON(); userdata[AM.AUDIO_CUE_LIST_NAME] = audioCueList; AM.instance.ClearAudioCues(); if (useLocation) { metadata.location = new LibPlacenote.MapLocation(); metadata.location.latitude = locationInfo.latitude; metadata.location.longitude = locationInfo.longitude; metadata.location.altitude = locationInfo.altitude; } LibPlacenote.Instance.SetMetadata(mapId, metadata, (success) => { if (success) { Debug.Log("Meta data successfully saved"); } else { Debug.Log("Meta data failed to save"); } }); storedMapMetadata = metadata; }, (completed, faulted, percentage) => { if (completed) { OutputPlacenoteText("Upload Complete:" + storedMapMetadata.name); } else if (faulted) { OutputPlacenoteText("Upload of Map Named: " + storedMapMetadata.name + "faulted"); } } ); }
// Use this for initialization void Start() { downloadedMetaData = new LibPlacenote.MapMetadata(); Input.location.Start(); mSession = UnityARSessionNativeInterface.GetARSessionNativeInterface(); StartARKit(); FeaturesVisualizer.EnablePointcloud(); LibPlacenote.Instance.RegisterListener(this); }
void Start() { // Initialize ARKit session m_Session = UnityARSessionNativeInterface.GetARSessionNativeInterface(); StartARKit(); // Initialize Placenote FeaturesVisualizer.EnablePointcloud(); // For debugging - seeing the tracked points in the camera LibPlacenote.Instance.RegisterListener(this); }
void Start() { // Start ARKit using the Unity ARKit Plugin mSession = UnityARSessionNativeInterface.GetARSessionNativeInterface(); StartARKit(); FeaturesVisualizer.EnablePointcloud(); // Optional - to see the point features LibPlacenote.Instance.RegisterListener(this); // Register listener for onStatusChange and OnPose notifications.text = "Click New Map to start"; }
public void OnExitClicked() { LibPlacenote.Instance.StopSession(); FeaturesVisualizer.clearPointcloud(); GetComponent <MarkerManager>().ClearModels(); initPanel.SetActive(true); mappingPanel.SetActive(false); localizedPanel.SetActive(false); }
// Use this for initialization void Start() { mMapListPanel.SetActive(false); mSession = UnityARSessionNativeInterface.GetARSessionNativeInterface(); UnityARSessionNativeInterface.ARFrameUpdatedEvent += ARFrameUpdated; StartARKit(); FeaturesVisualizer.EnablePointcloud(); LibPlacenote.Instance.RegisterListener(this); }
public void OnExitClick() { mInitButtonPanel.SetActive(true); mExitButton.SetActive(false); mMappingButtonPanel.SetActive(false); LibPlacenote.Instance.StopSession(); FeaturesVisualizer.clearPointcloud(); GetComponent <ShapeManager>().ClearShapes(); }
public void OnExitClick() { mInitButtonPanel.SetActive(true); mExitButton.SetActive(false); mMappingButtonPanel.SetActive(false); LibPlacenote.Instance.StopSession(); FeaturesVisualizer.clearPointcloud(); mAudioCueManager.ClearAudioCues(); // CHANGED }
// Use this for initialization void Start() { MAP_NAME = PlayerPrefs.GetString("mapname"); Input.location.Start(); mSession = UnityARSessionNativeInterface.GetARSessionNativeInterface(); UnityARSessionNativeInterface.ARFrameUpdatedEvent += ARFrameUpdated; StartARKit(); FeaturesVisualizer.EnablePointcloud(); LibPlacenote.Instance.RegisterListener(this); }
// Use this for initialization void Start() { mSession = UnityARSessionNativeInterface.GetARSessionNativeInterface(); UnityARSessionNativeInterface.ARFrameUpdatedEvent += ARFrameUpdated; StartARKit(); FeaturesVisualizer.EnablePointcloud(); Debug.Log("return from enablepoint cloud"); LibPlacenote.Instance.RegisterListener(this); Debug.Log("start end"); }