Presentation is loading. Please wait.

Presentation is loading. Please wait.

Ramrod IV Micromouse 396. The Team  Andrew Igarashi – Programming  Kevin Li – Hardware  Amy Maruyama – Hardware  Stephen Nakamura – Hardware  Quang.

Similar presentations


Presentation on theme: "Ramrod IV Micromouse 396. The Team  Andrew Igarashi – Programming  Kevin Li – Hardware  Amy Maruyama – Hardware  Stephen Nakamura – Hardware  Quang."— Presentation transcript:

1 Ramrod IV Micromouse 396

2 The Team  Andrew Igarashi – Programming  Kevin Li – Hardware  Amy Maruyama – Hardware  Stephen Nakamura – Hardware  Quang Ngu – Programming

3 Project Overview  To design a fully autonomous robot, a “mouse”, that can move through a maze, know where in the maze it is, and find the center

4 System SoftwareHardware Decide Direction Read WallsMoveSensorsMotor

5 Hardware Module MotorSensors Rabbit ADC Converter Motor Driver Chips Move

6 New Changes to Hardware  New Circuit Board  5V Switching Regulator  3 Additional Programmable LEDs

7 RCM2000 Ports

8 PORT A 6/8 used for motors  Ports A0 and A5 are used for clock signal for motors.  Ports A1 and A4 chooses full step or half step control.  Ports A2 and A3 control the direction of the motors (either clockwise or counter- clockwise).

9 Outputs to ADC  Ports E0 and E2 selects sensor to read. 1 1 -> Left Sensor 1 0 -> Middle Sensor 0 1 -> Right Sensor  Port D0 must be low (logic 0) to read sensor’s analog output.

10 Inputs from ADC  Ports E1, E3, E5, E7 represent the upper four bits of the conversion value.  Ports D1, D3, D5, D7 represent the lower four bits of the conversion value. E1E3E5E7D1D3D5D7 0 0 1 0 0 1 0 1 0 0 1 0 0 1 0 1 = 1 + 4 + 32 = 37 = 1 + 4 + 32 = 37

11 Debugging Tool 7 Segment Display  Allows us to determine what the mouse sees and remembers.  Many ports used to implement A6 A7 B6 B7 D2 E4 E6

12

13 Software Modules Move Main() Read SensorsMapSolve

14 Main()  Define a lot of Macros and Global Variables  Initialize Ports A2,A3, A1,and A4 for motors  while(1) { Costate { move(); check_sensors(); map(); solve()} }

15 Macros  //Macros  #define RIGHT_FAST 4 //motor speeds  #define RIGHT_SLOW 10 //motor speeds  #define RIGHT_TRACK 6 //motor speeds  #define LEFT_FAST 2 //motor speeds  #define LEFT_SLOW 5 //motor speeds  #define LEFT_TRACK 3 //motor speeds  #define RIGHT 0 //read right sensor/track right  #define LEFT 1 //read left sensor/track left  #define MIDDLE 2 //read middle sensor/track  still got more to add….

16 Motor Macros  #define PORTA0ON BitWrPortI(PADR, &PADRShadow, 1, 0) //Clock for Right Motor  #define PORTA1ON BitWrPortI(PADR, &PADRShadow, 1, 1) //Half Step for Left Motor  #define PORTA2ON BitWrPortI(PADR, &PADRShadow, 1, 2) //Right Motor Backwards  #define PORTA3ON BitWrPortI(PADR, &PADRShadow, 1, 3) //Left Motor Forwards  #define PORTA0OFF BitWrPortI(PADR, &PADRShadow, 0, 0) //Clock for right Motor  #define PORTA1OFF BitWrPortI(PADR, &PADRShadow, 0, 1) //Full Step for Left Motor  #define PORTA2OFF BitWrPortI(PADR, &PADRShadow, 0, 2) //Right Motor Forwards  #define PORTA3OFF BitWrPortI(PADR, &PADRShadow, 0, 3) //Left Motor Backwards

17 More Motor Macros  #define PORTA4ON BitWrPortI(PADR, &PADRShadow, 1, 4) //Half Step for Right Motor  #define PORTA5ON BitWrPortI(PADR, &PADRShadow, 1, 5) //Clock for Left Motor  #define PORTA6ON BitWrPortI(PADR, &PADRShadow, 1, 6) //7-segment  #define PORTA7ON BitWrPortI(PADR, &PADRShadow, 1, 7) //7-segment  #define PORTA4OFF BitWrPortI(PADR, &PADRShadow, 0, 4) //Full Step for Right Motor  #define PORTA5OFF BitWrPortI(PADR, &PADRShadow, 0, 5) //Clock for Left Motor  #define PORTA6OFF BitWrPortI(PADR, &PADRShadow, 0, 6) //7-segment  #define PORTA7OFF BitWrPortI(PADR, &PADRShadow, 0, 7) //7-segment

18 Analog to Digital Converter Macros  // Output Macro for Sensor Select on ADC  #define PORTE0ON BitWrPortI(PEDR, &PEDRShadow, 1, 0)  #define PORTE2ON BitWrPortI(PEDR, &PEDRShadow, 1, 2)  #define PORTE0OFF BitWrPortI(PEDR, &PEDRShadow, 0, 0)  #define PORTE2OFF BitWrPortI(PEDR, &PEDRShadow, 0, 2)  // Output Macro for Sensor RD Input low to access data  #define PORTD0ON BitWrPortI(PDDR, &PDDRShadow, 1, 0)  #define PORTD0OFF BitWrPortI(PDDR, &PDDRShadow, 0, 0)

19 Analog to Digital Converter Macros  //Sensor Definitions  #define PORTE1ON BitRdPortI(PEDR,1) // MSB  #define PORTE3ON BitRdPortI(PEDR,3) // D6  #define PORTE5ON BitRdPortI(PEDR,5) // D5  #define PORTE7ON BitRdPortI(PEDR,7) // D4  #define PORTD1ON BitRdPortI(PDDR,1) // D3  #define PORTD3ON BitRdPortI(PDDR,3) // D2  #define PORTD5ON BitRdPortI(PDDR,5) // D1  #define PORTD7ON BitRdPortI(PDDR,7) // LSB

20 Global Variables  int left_sen;//sensor values  int middle_sen;//sensor values  int right_sen;//sensor values  int motor; //pick which motor to pulse  int pulse_delay; //delay for motor pulsing  int track_pick; //Pick direction to track  int sen_pick; //Pick which sensor to use  int i;//Counter/index for loops  and more to come...

21 Initialization 00 00 (0,0) 1 11 1 11 113 33 3 22 2 2 222 2 2 4 4 4 3 4 335 5 5 5 (0,1) (0,2) (0,3) (0,4) (0,5) (1,0) (1,1) (1,2) (1,3) (1,4) (1,5)(2,5) (2,4) (2,3) (2,2) (2,1) (2,0) (3,5) (3,4) (3,3) (3,2) (3,1) (3,0) (4,5) (4,4) (4,3) (4,2) (4,1) (4,0) (5,5) (5,4) (5,3) (5,2) (5,1) (5,0) C (X,Y) C = Shortest number of steps away from center (X,Y) = Coordinate of the Cell R F L What is 1 step? -moving 1 cell forward -90 degree turn left/right (without moving after turn) -180 degrees (without moving after turn) B

22 The Mapping System Orientation: W N S E Wall Orientation: L F B R

23 How do we store walls? 00 0 0 (0,0) 1 1 1 1 11 1 1 2 22 2 22 2 2 222 2 2 3 3 3 3 3 334 4 4 4 (0,1) (0,2) (0,3) (0,4) (0,5) (1,0) (1,1) (1,2) (1,3) (1,4) (1,5)(2,5) (2,4) (2,3) (2,2) (2,1) (2,0) (3,5) (3,4) (3,3) (3,2) (3,1) (3,0) (4,5) (4,4) (4,3) (4,2) (4,1) (4,0) (5,5) (5,4) (5,3) (5,2) (5,1) (5,0) Front Mouse

24 00 0 0 (0,0) 1 1 1 1 11 1 1 2 22 2 22 2 2 222 2 2 3 3 3 3 3 334 4 4 4 (0,1) (0,2) (0,3) (0,4) (0,5) (1,0) (1,1) (1,2) (1,3) (1,4) (1,5)(2,5) (2,4) (2,3) (2,2) (2,1) (2,0) (3,5) (3,4) (3,3) (3,2) (3,1) (3,0) (4,5) (4,4) (4,3) (4,2) (4,1) (4,0) (5,5) (5,4) (5,3) (5,2) (5,1) (5,0) Cont. Wall[0][1][R] = NoWall Wall[0][1][L] = Wall Wall[0][0][F] = NoWall

25 00 0 0 (0,0) 1 1 1 1 11 1 1 2 22 2 22 2 2 222 2 2 3 3 3 3 3 334 4 4 4 (0,1) (0,2) (0,3) (0,4) (0,5) (1,0) (1,1) (1,2) (1,3) (1,4) (1,5)(2,5) (2,4) (2,3) (2,2) (2,1) (2,0) (3,5) (3,4) (3,3) (3,2) (3,1) (3,0) (4,5) (4,4) (4,3) (4,2) (4,1) (4,0) (5,5) (5,4) (5,3) (5,2) (5,1) (5,0) Cont. Wall[1][1][F] = NoWall Wall[1][1][B] = Wall Wall[0][1][R] = NoWall Wall[0][1][L] = Wall

26 Move(); track_straight()turn_left()turn_right()180_right() move() Solve telling move where we want to go find_walls telling move where we can go Tell solve where we are going Did we move 1 cell? When can I move 1 cell?

27 track_Straight()  void track_straight(void) {  if ((right_sen > 70)) {  //printf("Going into right track loop\n");  for (i = 0;i < 50; i++)  forward(RIGHT);  }  else if ((left_sen > 80)) {  //printf("Going into left track loop\n");  for (i = 0;i < 50; i++)  forward(LEFT);  }  else {  //printf("Going into sraight loop\n");  for (i = 0;i < 50; i++)  forward(MIDDLE);  }

28 forward()  void forward(int motor) {  if (motor == MIDDLE) {  costate  {  PORTA0ON;  waitfor(DelayMs(RIGHT_FAST));  PORTA0OFF;  waitfor(DelayMs(RIGHT_FAST));  }  costate  {  PORTA5ON;  waitfor(DelayMs(LEFT_FAST));  PORTA5OFF;  waitfor(DelayMs(LEFT_FAST));  }  else if (motor == LEFT) {  //printf("In left loop");  costate  {  PORTA5ON;  waitfor(DelayMs(LEFT_TRACK));  PORTA5OFF;  waitfor(DelayMs(LEFT_TRACK));  }  costate  {  PORTA0ON;  waitfor(DelayMs(RIGHT_FAST));  PORTA0OFF;  waitfor(DelayMs(RIGHT_FAST));  } 

29 Check_Sensors  Check_sensor();  costate  {  read_sensor(RIGHT);  waitfor (DelayMs(50));  //printf("right_sen = %d\t",right_sen);  read_sensor(LEFT);  waitfor (DelayMs(50));  //printf("left_sen = %d\t",left_sen);  read_sensor(MIDDLE);  waitfor (DelayMs(50));  //printf("middle_sen/left_sen = %d\n",middle_sen);  }

30 Read_sensor  void read_sensor(int sen_pick) //initialzes a conversion for 1 sensor  {  int distance1; //variable for 4MSBs  int distance2; //variable for 4LSBs  int total; //representing distance without splitting in two creates  //invalid results  if (sen_pick == LEFT) {  PORTE0ON; PORTE2ON;  }  else if (sen_pick == RIGHT) {  PORTE0ON; PORTE2OFF;  }  else if (sen_pick == MIDDLE) {  PORTE0OFF; PORTE2ON;  }   costate {  PORTD0OFF;  waitfor(DelayMs(50)); //wait for conversion  distance1 = PORTE1ON*128 + PORTE3ON*64 + PORTE5ON*32 + PORTE7ON*16;  distance2 = PORTD1ON*8 + PORTD3ON*4 + PORTD5ON*2 +PORTD7ON;  total = distance1 + distance2;  if (sen_pick == LEFT) {  left_sen = total;  //printf("left_sen = %d\t",left_sen); }  else if (sen_pick == RIGHT) {  right_sen = total;  //printf("middle_sen = %d\n",middle_sen); }  else if (sen_pick == MIDDLE) {  middle_sen = total;  //printf("right_sen = %d\n",right_sen); }  PORTD0ON; } } 

31 Map find_walls()position() Did we move 1 cell yet? Sensors Move Tell solve where we are Tell solve where the walls are What moves are possible? Move Did we move 1 cell yet? This module also stores the walls with respect to position in an array Wall[x][y][side] = 0 or 1

32 Solve remember()filter()go_home() solving() Store moves we made go_center() Walls we found Moves we want to make Array of moves

33 Schedule

34 Questions ?


Download ppt "Ramrod IV Micromouse 396. The Team  Andrew Igarashi – Programming  Kevin Li – Hardware  Amy Maruyama – Hardware  Stephen Nakamura – Hardware  Quang."

Similar presentations


Ads by Google