Skip to content

Instantly share code, notes, and snippets.

@tgoossens
Created November 22, 2012 15:02
Show Gist options
  • Save tgoossens/4131595 to your computer and use it in GitHub Desktop.
Save tgoossens/4131595 to your computer and use it in GitHub Desktop.
mazeexplore quick fix
* Drives the robot in the requested direction. As always the direction is in the relative axis of the robot,
* instead of the absolute one.
* @param reqDir
*/
private void driveSectorLengthInDirection(Orientation reqDir) {
if(reqDir == currentOrientation.turnClockWise()){
getRobot().rotate(90, Rotation.CLOCKWISE);
}else if(reqDir == currentOrientation.turnAntiClockWise()){
getRobot().rotate(90, Rotation.COUNTERCLOCKWISE);
}else if(reqDir == currentOrientation.opposite() ) {
getRobot().rotate(180,Rotation.CLOCKWISE);
}
currentOrientation = reqDir;
RobotActivity a = ((Robot) getRobot()).getPilotProvider().active().getRobotActivity();
while(a != RobotActivity.IDLE){
a = ((Robot) getRobot()).getPilotProvider().active().getRobotActivity();
}
getRobot().drive(sectorLength, Direction.FORWARD);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment