무판자로 되있는 미로 (소나센서만 이용) 길찾는건데 일단 코드 던질게

수정해야할 부분은 그렇게 많지 않음/대신 기본틀은 유지한 채로 코드 작성해야함.

 

용돈 벌고싶으면 물어라. 계약금은 없고 중도금으로 5000원 완료금 10000원 쏠게. 이런걸로 장난 안해

카톡아이디는 AbleSong 친추해줘~

 

#pragma config(Sensor, S1,     sonar,          sensorSONAR)
#pragma config(Sensor, S2,     light,          sensorLightActive)
#pragma config(Sensor, S3,     touch,          sensorTouch)
#pragma config(Sensor, S4,     touch,          sensorTouch)
//*!!Code automatically generated by 'ROBOTC' configuration wizard               !!*//

const int cellSize = 40;        // the width and depth of each cell in MAZE is equal to 40 cm
const int speed = 20;           // robot's basic motor power level
                                // with P controller, the max power level could be 40 percent
const int thresholdForPath = cellSize - 10;  // should consider some noise while reading from sonar
                                // this variable is used in movement.h file

#include "odometry.h"
#include "sonarCorrection.h"
/********************************************************************************************************

int getSonarValue();       // e = error   r = within a range
void correctSonarError(int e, int r);  // so, when testing your sonar sensor,
                                          if your sonar sensor has more than 3 within 23 cm,

                                          then, correctSonarError(3, 23);

*********************************************************************************************************/
#include "movement.h"
/********************************************************************************************************

void forward(int cm);
void turnRight();
void turnLeft();
void turnAround();
void getMapInfoFromSonar(bool &lPath, bool &fPath, bool &rPath);
*********************************************************************************************************/

 

task main()
{
 bool leftPath = false;
 bool rightPath = false;
 bool fr>

 initRobot(13.7, 0, 0, 180);
 correctSonarError(3, 23);
 //StartTask(odometry);   // if you need to localize your robot, you can use this function.


 while( 1 )
 {
  getMapInfoFromSonar(leftPath, frontPath, rightPath);
  if( leftPath )
  {
   // since there is a path on your left hand side,
    // so your robot should go to the left. How can you make this happen?
    // HINT : use turnLeft and forward function.

  }
  else if( rightPath )
  {


  }
  else if( frontPath )
  {


  }
  else // facing a dead end so your robot has to turn around
  {


  }
 }

 

 //StopTask(odometry);
}