Meeting on Friday with George Sullivan
Analog - Digital Converter: How it works
Written Notes: https://drive.google.com/file/d/0B-46Wb6HXkEETmJ6bXp4NjJ2UHc/edit?usp=sharing
The Stellaris has a 12-bit input/output range. So for the maximum voltage input (5V), it would output the number 4096 (= 2^12). Then for 0V input, it would output the number 0. The relationship is linear. Testing is need to verify this.
For example,
We are using two of these
http://www.karlssonrobotics.com/cart/infrared-proximity-sensor-short-range-sharp-gp2d120xj00f/ on the sides. We placed it in the maze, in the middle of a block/square. We decided that 1V outputted from the sensor would be a good threshold for whether or not there was a wall in front of the sensor. Less than 1V means there's no wall, and greater than 1V means there is a wall. The highest output from the sensor is around 3V.
So 1V (outputted from sensor, inputted into Stellaris) would be about 819 (=(2^12) /5) outputted from Stellaris since the relationship is linear. We'll also need other thresholds in the future. If the mouse veers to the side, slowly running towards a wall, we can use the sensors to correct it.
Note: We want to avoid having the robot completely up against the wall. If the sensor is roughly less than 1cm away from the wall, the voltage drops. I say roughly because, when tested, all the sensors work slightly different, some will be better candidates. The datasheet on the second to last page shows their standard graph of voltage and distance. Using the 1V threshold, the robot would record this as no wall.
Mapping the Maze
Written Notes:
https://drive.google.com/file/d/0B-46Wb6HXkEEWkZYUlU0SG9aeEU/edit?usp=sharing
In order to solve the maze and write the movement logic, first we'll need to figure out how to store the maze: break the maze into blocks, or walls. No matter the method, everything will have pros and cons.
Blocks
The robot would have to enter every single block on the maze to record if there are walls or not. This takes up time, but it would be easier to code and potentially solve.
Walls
Slightly different approach. We would want the robot to avoid redundantly exploring blocks where it has already recorded that wall, but from the other side. In videos, I've seen many robots skip over sections of the maze.
In the notes, George wrote down realistic problems that we may encounter when running the robot through the maze.
The Next Steps
ADC
- Write code to read the sensors
- Assign pins on the Stellaris for the sensors
- Read ADC values (function* see below)
- Find/Test ADC #s for important values
- Make UART/Serial debug connection for computer, so we can get a log of values displayed. We thought this would be a good way to verify that everything is working up to this point.
George drew a bubble map/flow chart in the notes.
Start with a move function, like move forward into a block, then in the middle of the block, read the sensor value. Read the sensor data (is there a wall or not, this would be the function* above) and store it in an array or vector of some sort. Next make a decision: should the mouse keep moving forward, turn left/right, or turn completely around. Finally, we are back to the move function.
Things that can be done without sensors in the mean time
- Make the robot go a path
- Figure out how long a block is (for now, breaking the maze into blocks seems to be simpler)
- Test turning & "1 block" motion to make sure motion & turning is consistent
- Start testing prototypes of mapping ideas