void getNextCommand() { mazeCoverageStr = exploration.GetCoverage().ToString(); pointsScoredStr = exploration.GetPoints().ToString(); mazeCoverage = Int32.Parse(mazeCoverageStr); pointsScored = Int32.Parse(pointsScoredStr); if (checkRunTimeStatus()) { int matrixSize = (currentSensor == 1 || currentSensor == 5)? 3:5; sensor.Update_Maze_Data(getMazeData(matrixSize), robotDirection); updateUISensorData(getMazeData(matrixSize)); int[,] sensorReading = sensor.Get_Obstacle_Matrix(); updateUISensorData(sensorReading); String robotCommand = exploration.GetNextCommand(sensorReading, currentSensor, currentAlgorithm); moveInDirection(robotCommand); } else { CancelInvoke("getNextCommand"); isSimulationComplete = true; endTime = DateTime.Now.ToString(@"hh\:mm\:ss"); runTime = calculateRunTime(); backButton.interactable = true; Debug.Log("END TIME : " + runTime); Debug.Log("Battery Life : " + batteryLife); Debug.Log("Points : " + pointsScored); sendDateToExpDesign(); Debug.Log("Maze Coverage : " + mazeCoverage); } }
//returns the sensor data and update it on the screen int[,] getSensorData() { int matrixSize = (currentSensor == 1 || currentSensor == 5)? 3:5; sensor.Update_Obstacles(robotMain, getMazeData(matrixSize), robotDirection); int[,] sensorReading = sensor.Get_Obstacle_Matrix(); if (currentSensor == 3) { sensorReading = Exploration.RotateSensorData(sensorReading, robotDirection); } updateUISensorData(sensorReading); return(sensorReading); }
void getNextCommand() { healthBar.value = batteryLife; mazeCoverageStr = exploration.GetCoverage().ToString(); pointsScoredStr = exploration.GetPoints().ToString(); mazeCoverage = Int32.Parse(mazeCoverageStr); pointsScored = Int32.Parse(pointsScoredStr); if (checkRunTimeStatus()) { int matrixSize = (currentSensor == 1 || currentSensor == 5)? 3:5; Debug.Log(robotMain); sensor.Update_Obstacles(sensor.GetRoverObject(), getMazeData(matrixSize), robotDirection); //updateUISensorData(getMazeData(matrixSize)); int[,] sensorReading = sensor.Get_Obstacle_Matrix(); updateUISensorData(sensorReading); String robotCommand = exploration.GetNextCommand(sensorReading, currentSensor); moveInDirection(robotCommand); } else { CancelInvoke("getNextCommand"); isSimulationComplete = true; endTime = DateTime.Now.ToString(@"hh\:mm\:ss"); runTime = calculateRunTime(); //enable back button backButton.interactable = true; // calculate end time Debug.Log("END TIME : " + runTime); // store the info in DB Debug.Log("Battery Life : " + batteryLife); Debug.Log("Points : " + pointsScored); sendDateToExpDesign(); Debug.Log("Maze Coverage : " + mazeCoverage); mazeCreated = false; currentX = 1; currentY = 1; mazeCoverage = 0; batteryLife = 3600; pointsScored = 0; GameObject[] mazeObjects = arrayOfGameObjects[arrayCounter]; //Destroy UI for (int i = 0; i < mazeObjects.Length; i++) { Destroy(mazeObjects[i]); } arrayCounter++; if (expCounter < PlayerPrefs.GetInt("Iteration")) { Begin(); } else { experimentText.text = ""; statusText.text = "Trails are completed."; } } }
// Update is called once per frame void Update() { changePosRover(); sensor.Update_Obstacles(Cube); int[,] matrix = sensor.Get_Obstacle_Matrix(); testProximityMatrix(matrix); //Debug.Log("Getting matrix of Size:"+matrix.Length); }
void getNextCommand() { healthBar.value = batteryLife; mazeCoverageStr = exploration.GetCoverage().ToString(); pointsScoredStr = exploration.GetPoints().ToString(); mazeCoverage = Int32.Parse(mazeCoverageStr); pointsScored = Int32.Parse(pointsScoredStr); if (checkRunTimeStatus()) { updateSensorsData(getSensorsData()); // updateSensorsTeamData(); int[,] sensorMatrix = sensor.Get_Obstacle_Matrix(); int[,] matrix = getSensorsData(); updateSensorMaze(sensorMatrix, matrix); Int32 unixTimestamp = (Int32)(DateTime.UtcNow.Subtract(new DateTime(1970, 1, 1))).TotalSeconds; // update SensorType here resultcode = dbm.SetSensorMatrixById(unixTimestamp, 1, sensorMatrix); String robotCommand = exploration.GetNextCommand(sensorMatrix); moveInDirection(robotCommand); } else { CancelInvoke("getNextCommand"); isSimulationComplete = true; endTime = DateTime.Now.ToString(@"hh\:mm\:ss"); runTime = calculateRunTime(); // Debug.Log("RUN TIME : " + calculateRunTime()); //enable back button backButton.interactable = true; // calculate end time Debug.Log("END TIME : " + runTime); // store the info in DB Debug.Log("Battery Life : " + batteryLife); Debug.Log("Points : " + pointsScored); sendDateToExpDesign(); Debug.Log("Maze Coverage : " + mazeCoverage); if (resultcode == 1) { Debug.Log("Sensors Data has been successfully logged into rover.db"); } else { Debug.LogError("Could not log Sensor Data to rover.db"); } } }
void getNextCommand() { updateSensorsData(getSensorsData()); // updateSensorsTeamData(); int[,] sensorMatrix = sensor.Get_Obstacle_Matrix(); int[,] matrix = getSensorsData(); updateSensorMaze(sensorMatrix, matrix); String robotCommand = exploration.GetNextCommand(sensorMatrix); moveInDirection(robotCommand); // if(checkRunTimeStatus()){ // updateSensorsData(getSensorsData()); // // updateSensorsTeamData(); // int[,] sensorMatrix = sensor.Get_Obstacle_Matrix(); // int[,] matrix = getSensorsData(); // updateSensorMaze(sensorMatrix, matrix); // String robotCommand = exploration.GetNextCommand(sensorMatrix); // moveInDirection(robotCommand); // } // else{ // CancelInvoke("getNextCommand"); // } }
void getNextCommand() { healthBar.value = batteryLife; mazeCoverageStr = exploration.GetCoverage().ToString(); pointsScoredStr = exploration.GetPoints().ToString(); mazeCoverage = Int32.Parse(mazeCoverageStr); pointsScored = Int32.Parse(pointsScoredStr); if (checkRunTimeStatus()) { updateSensorsData(getSensorsData()); // updateSensorsTeamData(); int[,] sensorMatrix = sensor.Get_Obstacle_Matrix(); int[,] matrix = getSensorsData(); updateSensorMaze(sensorMatrix, matrix); Int32 unixTimestamp = (Int32)(DateTime.UtcNow.Subtract(new DateTime(1970, 1, 1))).TotalSeconds; // update SensorType here //dbm.SetSensorMatrixById(unixTimestamp, 1, sensorMatrix); String robotCommand = exploration.GetNextCommand(sensorMatrix); moveInDirection(robotCommand); } else { CancelInvoke("getNextCommand"); isSimulationComplete = true; endTime = DateTime.Now.ToString(@"hh\:mm\:ss"); runTime = calculateRunTime(); // Debug.Log("RUN TIME : " + calculateRunTime()); //enable back button backButton.interactable = true; // calculate end time Debug.Log("END TIME : " + runTime); // store the info in DB Debug.Log("Battery Life : " + batteryLife); Debug.Log("Points : " + pointsScored); sendDateToExpDesign(); Debug.Log("Maze Coverage : " + mazeCoverage); mazeCreated = false; currentX = 1; currentY = 1; mazeCoverage = 0; batteryLife = 3600; pointsScored = 0; GameObject[] mazeObjects = arrayOfGameObjects[arrayCounter]; //Destroy UI for (int i = 0; i < mazeObjects.Length; i++) { Destroy(mazeObjects[i]); } arrayCounter++; if (expCounter < PlayerPrefs.GetInt("Iteration")) { Begin(); } /* if (expCounter == PlayerPrefs.GetInt("Iteration")) * expCounter = 0;*/ } }