Looking For Feedback On Maze Solving Robot

For an Engineering Class, we are constructing a maze solving Robot. I was hoping to see if I could get any feedback at a semi-early stage in the construction. We’re pretty much newbies, and could use any help.

We have a circular design, with two slots cut out on the base for the wheels. A third swivel wheel or some form of support will be used to prevent the robot from tipping over. I apologize for not knowing the technical specifications of the motors, we are stuck with what was provided for us by the instructor. With two I/O range sensors (One in Front, one on the left side) the robot can maneuver through the maze. We have an Digilent ChipKIT, and are going to use the following Program to run the robot using MPIDE:

[code]const int analogInPin = A2; // range sensor (Front)
const int analogInPin2 = A1; // range sensor 2 (Left)
const int DirR = 12;
const int EnR = 9; //Set Directions and Engaging pins
const int DirL = 13; //for H-Bridges
const int EnL = 11;

int sensorValue = 0; // Set Sensor
int outputValueF = 0; // Set output for Front
int sensorValue2 = 0; // Set Sensor 2
int outputValueL = 0; // Set output for Left
void setup() {
pinMode(12, OUTPUT);
pinMode(9, OUTPUT);
pinMode(13, OUTPUT);
pinMode(11, OUTPUT);
}

void loop() {
// read the Front Range sensor:
sensorValue = analogRead(analogInPin);
// map it to the range of the analog out:
outputValueF = map(sensorValue, 0, 1023, 0, 255);
// read the Left Range sensor:
sensorValue2 = analogRead(analogInPin2);
// map it to the range of the analog out:
outputValueL = map(sensorValue2, 0, 1023, 0, 255);

analogRead(outputValueF); //read Front sensor value
analogRead(outputValueL); //read Left sensor value

if((outputValueL>100)&&(outputValueF<100)){
// With a wall on the left and no obstacles in Front, the Robot
// Moves Forward.
digitalWrite(DirR, LOW); //Forward
digitalWrite(EnR, HIGH);
digitalWrite(DirL, LOW); //Forward
digitalWrite(EnL, HIGH);

}
else if((outputValueL>100)&&(outputValueF>100)){
// With a Wall on the left and an obstacle in front, The Robot
// Turns Right
digitalWrite(DirR, HIGH); //Backward
digitalWrite(EnR, HIGH);
digitalWrite(DirL, LOW); //Forward
digitalWrite(EnL, HIGH);
}
else{
// With no wall on the left side, the Robot Turns left while
// also moving slightly forward to accurately follow the turn.
digitalWrite(DirR, LOW); //Turn Left
digitalWrite(EnR, HIGH);
digitalWrite(DirL, HIGH); //Remains still
digitalWrite(EnL, LOW); }
}[/code]

The circuit itself is pretty much set, with two H Bridges being used to direct the motors. All the pins are wired up, but right now the circuit is on a breadboard and will be moved to an actual Circuit board soon.

Again, everything right now is in a very preliminary stage, and we would like any and all feedback before moving on. Thank you very much, and if there is any clarifications needed I would be happy to provide them.

The easy way, and the slowest unfortunately, is to keep your hand on the right wall and run. I’ve never entered a maze yet that this simple method did not work.

The mechanics seems really close to the Pololu Round Robot Chassis Kit. There are articles around maze solving which you can find online (theory as opposed to actual code). Sticking to the right works - but you won’t win.