100 likes | 204 Views
Overview of Project 3 Slides are available at : http://www.pages.drexel.edu/~mjm46 Updated 1/28 Due Date for project has been extended to next Friday 2/6. Matthew Murach. Project 3: The Wall. For this project, you are hard coding a set path to avoid an oncoming wall.
E N D
Overview of Project 3Slides are available at : http://www.pages.drexel.edu/~mjm46Updated 1/28Due Date for project has been extended to next Friday 2/6 Matthew Murach
Project 3: The Wall • For this project, you are hard coding a set path to avoid an oncoming wall. • The timing methods used from the last project will be used again in this project for distance estimation • If the code works the robot should detect the oncoming wall and pass-through the finish line
Project 3: The Wall • For this project your code should be organized roughly as follows: void right(){} /* do right turn */ void left(){} /* do left turn */ void forward(){} /* go forward 1 unit */ void backward(){} /* go backward 1 unit */ void main(){} /* Call series of directions */ • For this project the distance to the wall is unknown. A persistent global variable should be declared to calculate the time needed by the robot to travel from start to finish.
Distance Algorithm • The distance from start to finish is roughly 3 cells. So dividing the calibration time by 3.0 should yield the time to travel forward one cell. • Turn times should be hard coded • ****In addition to the original requirements the robot should be able to circumnavigate the wall with left or right openings.
Wall Navigation • When the robot hits the wall it should now implement the following pseudo-code. If(hit){ /* test right for opening first default to right state*/ backup(); right(); forward 1 U; left(); While (time < 1U){ forward(); if (hit) { r_flag = 1 /* indicates no opening at right use left state */ backup(); left(); forward 2 U; right(); forward(); } }
Project 3: The Wall • Basic robot parameters • The robot contains two motors and two sensors • To go forward both motors should be turned on i.e. fd(0) and fd(1) • To go right, the left motor should go forward and the right motor should go backward. fd(0); /* left motor forward */ bk(1); /* right motor backward */
Project 3: The Wall • There are times when a variable power level for the motor is desired. Using the motor() sub-function allows this. motor(0,50); /* 50% of power for motor 0 in forward */ motor(0,-33); /* 33% power for motor 0 in reverse */ • The usage of sensors is simple just place your sensors connections in a digital port. Operation is the same as before. • The motor should be connected as follows on the next slide
Motor Connection 2 1 3 Pins 1 and 3 should be connected to the motor. The bank of pins corresponding to each motor.
Project 3: The Wall • Additional notes • Your machine should ONLY require one calibration period to run the course. Hard coding of distances is NOT permitted. • The robot should travel the length of the course and store this time as a global variable i.e. persistent int a; • The robot after determining this value should run the course flawlessly…well maybe…
Project 3: The Wall • This project will require the following. • Each design team consisting of 1-2 students should submit a brief 2-3 page report detailing the design and implementation that was chosen. • In addition, all C files needed for this project should be well commented and readable. • Also each team will be required to show that the design works 3 out of 4 times (this maybe increased) on the course.