Links:

Lab 2

My program involves the age old tactic of RETREAT
        #include "Myro.h"
            #include "math.h"
                #include "stdio.h"
                    #include "iostream"
                        using namespace std;
                        
                        int main(int argc, char ** argv)
                        
                        {
                        int counter;
                        connect("/dev/tty.Fluke2-01C7-Fluke2");
                        robot.beep(0.2,990);
                        cout << robot.getBattery() << endl;
                            if(robot.getBattery() > 6 )
                                {
                                if(robot.getIR("right") == 0 || robot.getIR("left") == 0)
                                    {
                                    cout << "The IR is working?!?!?" << endl;
                                        }
                                else if(robot.getLine()[0] == 1)
                                        {
                                        robot.beep(1,1500);
                                        }
                                
                                        for(int i = 1; i < 5; i++)
                                            {
                                            if(robot.getLight("center") < 65282)
                                                {
                                                robot.beep(0.2,880);
                                                cout << robot.getLight("center") << endl;
                                                robot.forward(1,1.5);
                                                }
                                            }
                                
                                while(counter < 6)
                                        {
                                        if(robot.getObstacle("center") < 6400)
                                            {
                                            robot.getObstacle("center");
                                            robot.beep(0.2,990);
                                            robot.forward(1,1);
                                            }
                                        else if(robot.getObstacle("center") == 6400)
                                            {
                                            cout << "RUN AWAY!!!" << endl;
                                            robot.turnLeft(1,1.53);
                                            counter ++;
                                            cout << 6 - counter << endl;
                                            if(counter == 6)
                                                {
                                                cout << "I surrender" << endl;
                                                }
                                            }
                                        }
                                
                                    }
                                for(int n = 1; n < 5; n++)
                                        {
                                        robot.beep(0.5,1500);
                                        }
                                cout << robot.getBattery() << endl;
                                
                                disconnect();
                                return 0;
                                }
                                

    

When Ryan's robot Awesom-O used my code, it behaved in the same way as mine. This seems slightly odd since his light sensors apparently are calibrated differently than mine, but alas. He moved through the initial loop with no problems, and then passed the task of retreating from all obstacles with flying colors.

When Ena's robot Robby also seemed to have no issues with running my code. The one thing that seems to be different is that her robot's turning radius is slightly different than mine, so it doesn't alway complete the 180 degree turn exactly

Victoria's robot Stormy behaves in a different way from mine. Her light sensors are definitely calibrated in a different way from mine, since even in open light her robot skips straight to the main retreat portion.

The University of Southern California does not screen or control the content on this website and thus does not guarantee the accuracy, integrity, or quality of such content. All content on this website is provided by and is the sole responsibility of the person from which such content originated, and such content does not necessarily reflect the opinions of the University administration or the Board of Trustees