void EmitTelemetry(SocketIOEvent obj) { //Debug.Log ("call thread"); UnityMainThreadDispatcher.Instance().Enqueue(() => { // Collect Data from the robot //print("Attempting to Send..."); // send only if robot is moving if (!sensor.Status()) { _socket.Emit("telemetry", new JSONObject()); } else { // Collect Data from the robot's sensors Dictionary <string, string> data = new Dictionary <string, string>(); data["lidar_measurement"] = sensor.Lidar_Measure(); data["radar_measurement"] = sensor.Radar_Measure(); data["hunter_x"] = player_controller.x.ToString("N4"); data["hunter_y"] = player_controller.y.ToString("N4"); data["hunter_heading"] = (player_controller.heading).ToString("N4"); _socket.Emit("telemetry", new JSONObject(data)); } }); }