private void Update() { if (initialized) { filteredRSSI = Mathf.Round((float)kf.KalmanUpdate(wifiSignal.GetCurrSignal())); UpdateUserPosition(Mathf.RoundToInt(filteredRSSI)); user.position = Vector3.Lerp(user.position, desiredPosition, Time.deltaTime * 4f); } }
// Update is called once per frame void Update() { //print current signal currSignal = Mathf.Lerp(currSignal, wifiSignal.GetCurrSignal(), Time.deltaTime * 10f); frameCount++; if (frameCount % 10 == 0) { frameCount = 0; distance = CalcDistance() * METERS_TO_FEET; } set_value(); show_value(); }
// Update is called once per frame void Update() { if (Input.GetMouseButtonDown(0)) { LoadSnapShot(); } //print current signal currSignal = Mathf.Lerp(currSignal, wifiSignal.GetCurrSignal(), Time.deltaTime * 10f); frameCount++; if (frameCount % 10 == 0) { frameCount = 0; textList [0].text = "Dist: " + CalcDistance() * METERS_TO_FEET; } }
void CreateNode() { numNodes++; Debug.Log("Node: " + numNodes); //get node info Vector2 pos = positionalTracker.GetPosition(); int rssi = wifiSignal.GetCurrSignal(); string mac = wifiSignal.GetMacAddress(); //add node info to json string jsonFileWriter.AddNode(mac, rssi, pos); //instantiate node Vector3 worldNodePos = new Vector3(pos.x, Camera.main.transform.position.y, pos.y); GameObject node = Instantiate(nodePrefab, worldNodePos, Quaternion.identity); node.transform.position -= new Vector3(0, .1f, 0); string nodeText = "Mac: " + mac + "\n" + "RSSI: " + rssi + "dB"; node.GetComponent <NodeBehavior>().Init(nodeText, numNodes); }