|
Explore TEAMS!
|
Student /
MatthewFrykenbergsEgghuntPurpose: The purpose of this lab is to create a robot that successfully captures as many balls of designated color and return it to the "goal" within the alloted time period. Concept: Taylor and my strategy is a simple retrieve strategy: locate the ball, determine if it is of the appropriate color. If not, turn around and keep searching, if it is, lower trapper and search for goal. This is done basically by light following, once the goal is located, drive towards, lift trapper, and stop. I got the find the ball part of the code, or retrieval part, while Taylor got choosing the right ball and getting back to the goal, or scoring part. My strategy is to use the distance senssors (mountedon the back of the robot and pointing forward from under the green cr8 box) to keep the ball almost directly behind it, and drive backwards. When it reaches the distance where the light sensor senses the color, the ball will be trapped by the trapper (also located on the back), or rejected (taylor's part of code). Sensors:
Code: cr8_adc_enable(ADC_RIGHT_1);
cr8_adc_enable(ADC_LEFT_1);
cr8_adc_enable(ADC_CENTER_1);
cr8_adc_enable(ADC_LEFT_2);
cr8_adc_enable(ADC_RIGHT_2);
cr8_dig_enable(DIG_RIGHT_3,DIG_INPUT_PULLUP);
cr8_dig_enable(DIG_CENTER_3,DIG_INPUT_PULLUP);
while (1)
{
if(cr8->adc_right2>300 && cr8->adc_left2>300)
{
cr8_drive_direct(100,0);
cr8_delay(3000);
}
if(cr8->adc_right2>70)
{
cr8_drive_direct(-150,0);
cr8_delay(250);
}
if(cr8->adc_left2>150)
{
cr8_drive_direct(0,-100);
cr8_delay(25);
cr8_drive_direct(0,0);
}
cr8_cricket_display(cr8->adc_right2,0,0);
cr8_update(cr8);
}
|