16
Team 3 David Letteer Greg Broadwell Kathryn della Porta BE 1200 – Basic Engineering Final Report Final Report [Clarify Objectives] Design, build, and program a robot that will acknowledge the presence of ping-pong balls in an enclosed arena. The robot must be able to differentiate between the green balls and the white balls. The robot must retrieve the green balls and place them outside of the enclosed arena while keeping the white balls in the enclosed arena. [Identify Constraints] Creation of the robot is limited to the parts available in the LEGO Mindstorms kit and the control abilities of the NQC software. One major constraint is lack of available LEGO pieces. [Establish User Requirements] User must be able to press the “run” button on the robot, as well as use the NQC software. [Establish Functions] This robot begins wherever the tester places the robot in the enclosed arena (preferably the center). The robot then drives forward until one or both of the touch sensors is released. At this point the robot reads the values of the light sensor. If the light sensor reads a value designated as a green ball value, the robot lifts the drives in reverse and lifts the ball with the lift, dropping it into the dumpster while playing an upward chromatic scale. If the robot reads a value that is not a green value, the robot turns randomly. Whenever one of the robot’s touch sensors is released the robot drives in reverse and turns randomly, as it has most likely hit a wall. Whenever both touch sensors are simultaneously released, the robot drives in reverse for a longer duration of time and turns approximately 90 degrees. After 2 minutes and 50 seconds the robot drives in reverse, which presses the lever that opens the dumpster.

webpages.eng.wayne.eduwebpages.eng.wayne.edu/~en4166/Team 3 Final Report.docx · Web viewIf the light sensor reads a value designated as a green ball value, the robot lifts the drives

Embed Size (px)

Citation preview

Team 3David LetteerGreg BroadwellKathryn della PortaBE 1200 – Basic EngineeringFinal Report

Final Report

[Clarify Objectives]Design, build, and program a robot that will acknowledge the presence of ping-pong balls in an enclosed arena. The robot must be able to differentiate between the green balls and the white balls. The robot must retrieve the green balls and place them outside of the enclosed arena while keeping the white balls in the enclosed arena.

[Identify Constraints]Creation of the robot is limited to the parts available in the LEGO Mindstorms kit and the control abilities of the NQC software. One major constraint is lack of available LEGO pieces.

[Establish User Requirements]User must be able to press the “run” button on the robot, as well as use the NQC software.

[Establish Functions]This robot begins wherever the tester places the robot in the enclosed arena (preferably the center). The robot then drives forward until one or both of the touch sensors is released. At this point the robot reads the values of the light sensor. If the light sensor reads a value designated as a green ball value, the robot lifts the drives in reverse and lifts the ball with the lift, dropping it into the dumpster while playing an upward chromatic scale. If the robot reads a value that is not a green value, the robot turns randomly. Whenever one of the robot’s touch sensors is released the robot drives in reverse and turns randomly, as it has most likely hit a wall. Whenever both touch sensors are simultaneously released, the robot drives in reverse for a longer duration of time and turns approximately 90 degrees. After 2 minutes and 50 seconds the robot drives in reverse, which presses the lever that opens the dumpster. This dumpster sits on an angle and when the lever door is pressed, the balls are released, ending the performance.

[Establish Design Specifications]The robot known as “Lobsterbot” utilizes two touch sensor “feelers” mounted to a lifting arm to navigate to arena. The arm also houses the dual light sensors which determine the color of the ball. When the arm lifts the ball, it falls down onto rails which guide it into the basket. The back of the basket acts as a ramp to drop the balls out of the arena when backed against a wall without the use of any motors. The chassis utilizes a wide wheel base and large rear wheels to move the robot. The wheels are geared down to reduce speed, though the robot maintains the agility of the large wheels. In the front is a fixed cam that slides in turns, but keeps the robot on a straight path while navigating the arena.

[Generate Alternatives]In preparing the design, we originally intended to pursue a very different robot. Our initial design worked like a vacuum cleaner, using conveyor belts to hoist the balls up to a color detector and sorting mechanism, which would either return the ball to the arena, or store the ball to be dumped later. This design was rejected based on the constraints of the RCX, as we found gearing all of the mechanisms difficult. This design was also not supported by the sensor limitations, as we needed several more ports than are available on the RCX. Finally, we could not devise a way to efficiently move such a robot, as so many of our available pieces were lost to the complex mechanisms in the other functions.

Throwing bots were also rejected due to the difficulty of creating enough speed and torque to get a heavy arm to throw a ball out of the arena.

[Model or Analyze Design]

Macros DescriptionL Output corresponding to left drive motor. (OUT_A)R Output corresponding to right drive motor. (OUT_C)ARM Output corresponding to front arm motor. (OUT_B)BUMP_L Input corresponding to left touch sensor. (SENSOR_1)BUMP_R Input corresponding to right touch sensor. (SENSOR_3)EYE Input corresponding to two stacked light sensors. (SENSOR_2)TIME_LIMIT Time limit on search task. (2 minutes, 50 seconds)TIME Timer identifier. (0)BUMP_TIME Timer identifier. (1)BALL_COUNT Number of green balls to be collected. (5)GREEN_MIN Minimum light sensor value corresponding to ‘green.’ (638)GREEN_MAX Maximum light sensor value corresponding to ‘green.’ (648)WHITE_MIN Minimum light sensor value corresponding to ‘white.’ (572)WHITE_MAX Maximum light sensor value corresponding to ‘white.’ (612)FOUND_GREEN Indicator sound. (SOUND_UP)FOUND_WHITE Indicator sound. (SOUND_DOWN)CORNER Indicator sound. (SOUND_CLICK)DUMP Indicator sound. (SOUND_FAST_UP)DONE Indicator sound. (SOUND_DOUBLE_BEEP)

Variables Descriptionballs Counter to hold the number of green balls collected.bump Counter to hold the number of bumps for corner detection.

Functions Descriptionraise_arm() Raises the front arm of the robot in order to deposit a green ball into the ball

bin.random_turn() Turns the robot in a pseudo-random direction.

Tasks Description

mainsearch Executes a pseudo-random search of the arena.check Checks whether a ball caught by the front arm of the robot is green or white.

If it is green, the ball is lifted into the ball bin. If it is white, the ball is released.dump Drives the robot in reverse into the retaining wall of the arena in order to

engage a mechanical lever causing the ball bin to dump its cargo.log Datalogging task used during debugging to improve the check task.

[Test and Evaluate Design]Here “version” refers to a major step in the testing process. Sometimes the differences between versions are minute and immediate, while others are an extended period of testing apart. Typically, a new version is noted once the “bugs” of the previous version have been “fixed” and new “bugs” have been identified.

Version 1 bugs FixesWhen one of the feelers encounters a wall, the robot does not turn to adjust. This error occurred 15/15 times.

The motor that was previously only stopped when the feeler for its side is triggered has been set now to reverse direction for a snappier turn.

The turn the robot executes after rejecting a ball places the robot at an odd angle to the wall, causing the error above to occur. This will be fixed by fixing the above error.The green ball is only detected 5/15 times. This is likely due to other timing errors in the program, but still must be addressed.

A wait is added to the checking procedure to allow time for the light sensor to get an accurate reading.

11/15 times the arm does not lift high enough after detecting green and then drops too low, lifting the cam and producing turning errors.

Time for arm lift extended, dropping function changed from a time-controlled drop to a brake release by using a float command.

The bugs with version 1 do not have any apparent tie to robot design and should be fixable with coding changes.

Version 2 bugs FixesWhen robot encounters the wall at all, it simply bounces along the wall.

The backup time for a wall encounter is reduced and the turn time is increased.

Version 3 bugs FixesWhen robot encounters wall, it pushes into the wall too much before initializing a turn. This error occurs 15/15 times.

The backup time for a wall encounter is extended.

Robot gets stuck in a corner as it works its way down the wall. This error occurred 10/15 times.

A random direction selector is added after a wall encounter.

Version 4 bugs FixesRobot does not navigate the entire arena. It gets hung up in one general area of about 4 in. of wall space. This may be attributed to over correcting to face the wall. This error occurred 15/15 times.

Reverse times extended for a wall encounter and turn times reduced.

Robot does not stay in contact with the wall long enough to corral a ball into the checking area. This error occurred 15/15 times.

Wait time extended for ball checking.

Version 5 bugs FixesThe robot still gets hung up in a single area 10/15 after both feelers encounter the wall.

The turn time and the backup time for when both feelers are triggered were both increased.

The ball corral area faces frequent errors from gathering too many balls.

The axels inside the antennae are shortened to reduce sensitivity and a blocking piece is added to prevent too many balls from entering the detection area.

Version 6 bugs FixesBalls are detected only 4/15 times. The check function has been added to a while true

loop in the search function to have the robot constantly sampling for ball color.

Version 7 bugs FixesFalse positives instantaneously trigger an end to the program 15/15 times.

The check function can only control robot operations if one of the feelers is triggered.

Version 8 bugs FixesFalse positives occur every time with the white balls.

Multiple checks are in place for the green value with a wait of 5 between each check.

Robot still tends to hang out in one area. Turning and backing up times extended in navigation portions.

Version 9 bugs Fixes7/15 times white balls are still perceived as green false positives.

Light sensor is converted from percent to raw mode and new ranges are put in places. A shield is added to the light sensor to restrict ambient light and define values.

Version 10 bugs Fixes10/15 times the robot perceives the empty corral as green false positive, and 2/15 times the robot perceives white balls as green false positives.

A second light sensor is added onto the same port as the first, giving more definite ranges. A second check is also added to cut down on false positives.

Version 11 bugs* FixesRobot spends too long in the corners. A bump counter is added that forces the robot to

sample a different area after a certain number of bumps within 5 seconds.

*At this point the robot runs well enough, anything done beyond this point is for fine tuning and efficiency only.

[Refine and Optimize Design]The only major change to this design were adding a second light sensor to adjust the voltage draw of the light sensor port and refine the values of the colors of the balls to reduce the number of false positives.

During the debugging process, the value of the light sensor was logged while the robot searched the arena in order to better refine the checking algorithm. With a single light sensor, as illustrated in the graph below, the light sensor registered values a wide range of values accounting for green ping-pong balls, white ping-pong balls, and the empty arm at various positions within the arena, with the three

ranges overlapping. The major drops in value occurred when the light sensor was pointed at the ceiling while the arm was raised, after the ping-pong ball was released. With a single light sensor, the program was registering a significant number of false positives, both from white ping-pong balls, and the empty arm at various points within the arena.

-100 100 300 500 700 900 1100 1300 1500625

675

725

775

825

875

Light Sensor Values While Searching the Arena with a Single Light Sensor

Since this variation could not be eliminated by changing the robot’s programming, a second light sensor was added, with its input stacked above the first light sensor in parallel. With a second light sensor, the variation in light sensor readings was reduced, but the distinction between values corresponding to ‘green’ and values corresponding to ‘white’ or ‘empty’ was increased. A major drop of approximately 30 units occurred when the arm was raised, after the ping-pong ball was released.

-100 100 300 500 700 900 1100 1300 1500645

647

649

651

653

655

657

Light Sensor Values While Searching the Arena with Two Stacked Light Sensors

There was also a minor change to the front caster wheel. The original caster rotated freely, but took so long to adjust that it often led the robot on a curved path in its navigation of the arena. It was

exchanged for a fixed cam as the torque of the driving wheels is enough to slide the cam from side to side, while keeping the robot on s straight path while driving in a straight line.

[Design Communication/Document Design]

[Code] /* final_v5.nqc

Team 3 David Letteer Greg Broadwell Kathryn della Porta

BE 1200 - Basic Engineering I

14 December 2010

Final Exam Lobsterbot searches the arena for ping-pong balls. Lobsterbot determines the color of any ping-pong ball it finds. Lobsterbot collects green ping-pong balls, and releases white ones. Lobsterbot dumps the collected green ping pong balls over the side of the arena.*/

// define macros#define L OUT_A#define R OUT_C#define ARM OUT_B

#define BUMP_L SENSOR_1#define BUMP_R SENSOR_3#define EYE SENSOR_2

#define TIME_LIMIT 1700#define TIME 0#define BUMP_TIME 1#define BALL_COUNT 5

#define GREEN_MIN 638#define GREEN_MAX 648#define WHITE_MIN 572#define WHITE_MAX 612

// 638-648 green// 572-612 white// 646-659 no ball

#define FOUND_GREEN SOUND_UP#define FOUND_WHITE SOUND_DOWN#define CORNER SOUND_CLICK

#define DUMP SOUND_FAST_UP#define DONE SOUND_DOUBLE_BEEP

// declare and initialize variablesint balls = 0; // counter to hold number of green balls collectedint bump = 0; // counter to hold number of bumps for corner detection

task main(){ // begin 3-minute countdown ClearTimer(TIME);

// clear timer for corner detection ClearTimer(BUMP_TIME);

// declare sensors SetSensor(BUMP_L, SENSOR_TOUCH); SetSensor(BUMP_R, SENSOR_TOUCH); //SetSensor(EYE, SENSOR_LIGHT);

SetSensorType(EYE, SENSOR_TYPE_LIGHT); SetSensorMode(EYE, SENSOR_MODE_RAW);

//start log; start search; start check; // wait for robot to collect 6 balls or for 2.5 minutes to elapse //until(Timer(TIME) >= TIME_LIMIT || balls == BALL_COUNT); until(Timer(TIME) >= TIME_LIMIT); stop search; stop check; PlaySound(DUMP); start dump;}

task search(){ while(true) { OnFwd(L + R); until(BUMP_L == 0 || BUMP_R == 0); bump++; OnRev(L + R); Wait(30); random_turn();

// corner detection if(Timer(BUMP_TIME) <= 50 && bump >= 4) { PlaySound(CORNER); OnRev(L + R); Wait(60); random_turn(); bump = 0; ClearTimer(BUMP_TIME); } else if(Timer(BUMP_TIME) > 50) { ClearTimer(BUMP_TIME); bump = 0; } }}

task check(){ while(true) { if(BUMP_L == 0 || BUMP_R == 0) { if(EYE >= GREEN_MIN && EYE <= GREEN_MAX) { stop search; Wait(15); if (EYE >= GREEN_MIN && EYE <= GREEN_MAX) { Off(L + R); PlaySound(FOUND_GREEN); raise_arm(); balls++; Wait(100); } else { PlaySound(FOUND_WHITE); Rev(L + R); Wait(30); random_turn(); } start search;

} else if(EYE >= WHITE_MIN && EYE <= WHITE_MAX) { stop search; PlaySound(FOUND_WHITE); Rev(L + R); Wait(30); random_turn(); start search; } } }}

task dump(){ OnRev(L + R); Wait(500); Off(L + R); Wait(500); PlaySound(DONE); StopAllTasks();}

task log(){ CreateDatalog(0); CreateDatalog(1500); int a = 0; for(a; a < 1500; a++) { AddToDatalog(EYE); }}

void raise_arm(){ OnFwd(ARM); // raise arm with ball Wait(80); Off(ARM); // stop arm, deposit ball Wait(25);

OnRev(L + R); // lobsterbot backs up Wait(80); Off(L + R); // lobsterbot stops OnRev(ARM); // lower arm Wait(5); Float(ARM); // stop arm}

void random_turn(){ int i = Random(1); if(i == 0) { Off(L); OnFwd(R); Wait(50 + Random(50)); } else { Off(R); OnFwd(L); Wait(50 + Random(50)); }}