|
TEAMS Academy Wiki
THS
Explore TEAMS!
for visiting sophomores & juniors
Robotics
EnvBioTech
Bat Design
Assistive Tech
Students
Instructors
TEAMS Forum
TEAMS Calendar
TEAMS Web Site
Wiki Info
edit Robots.SideBar
|
- The best way to calibrate the light sensors is to probably have the robot to do it right before the competition.
- First, we point the light sensors at the blue ball and let the robot get a threshold of values and then find the average of that. Then we press play to indicate we are done calibrating blue.
- Then we point the sensors at the yellow ball, letting the robot find an average of values of those.
- Thirdly, we point the sensors at the wall, and let the robot find an average of those.
- We now take the average of those three values and store it as a variable. We find the percent difference between this average and the averages of individual objects. Then we decide what color an object is by the percent difference its closest to. This may be confusing, but here is the psuedocode.
Pseudocode
- Wait for Play Button to be pressed
- int BlueReading = Light Sensor Input //Point light sensor towards a blue object
- Flash LED //Indicates that it is done calibrating blue
- Wait for Play Button to be Pressed
- int YellowReading = Light Sensor Input //Point light sensor towards a yellow object
- Flash LED //Indicates that it is done calibrating yellow
- Wait for Play Button to be Pressed
- int WallReading = Light Sensor Input //Point light sensor towards the wall
- Flash LED //Indicates that it is done calibrating yellow
- int Average = (WallReading + YellowReading + BlueReading)/ 3 //The average of the three readings
- int BlueDifference = (Average - BlueReading)*100/Average //Shows how much percentage blue is off from the average
- int YellowDifference = (Average - YellowReading)*100/Average //Shows how much percentage yellow is off from the average
- int WallDifference = (Average - WallReading)*100/Average //Shows how much percentage wall is off from the average
...
...
...
- Input = LightSensorReading
- if (Average-LightSensorReading*100)/Average = closest to blue
- else if (Average-LightSensorReading*100)/Average = closest to yellow
- else
|