Hello classmates! My name is Tanner Zigrang. I am from a suburb of San Diego called Carlsbad. I am a CS, Games major.

My robot's name is Blinky based on the red ghost from Ms. Pacman. Right now he can't do anyhting as my bluetooth connection is not yet working.

Lab 1: After struggling most of class to get connected to the bluetooth, I didn't have that much time to work with turns, especially because we had only one bluetooth capable computer. Nonetheless I was able to change myrotest and get the robot to do something esle.

Lab 1 par 2: Sensor Testing:

• Lights (left, center right): 65403, 65281, 65283
• Line Sensor: 1, 0
• IR Sensors (left, right): 1, 1
• Fluke Sensors: 0, 0, 0
• Battery: 7.33987
• Lights (left, center right): 65322, 65192, 65284
• Line Sensor: 1, 0
• IR Sensors (left, right, center): 1, 1
• Fluke Sensors: 0, 0, 0
• Battery: 7.19688
• Lights (left, center right): 65151, 65288, 65056
• Line Sensor: 1, 0
• IR Sensors (left, right): 1, 1
• Fluke Sensors: 0, 0, 0
• Battery: 7.33987
• Lights (center): 65257
• Line Sensor: 0, 0
• IR Sensors (left, right): 1, 1
• Fluke Sensors: 640, 0, 0
• Battery: 7.29221
• Lab 2: For and While Loops

• The point of this lab was to use if and while statements in conjuction with the robot's sensors to have the robot check the environment and the perform some action.
• Some of the experiments we performed were:
• Checking battery levels and then beeping if it was above the threshold of 6.5.
• Checking the surfcae color using the line sensor and then moving when it was on dark or light surfaces.
• We even experimented with nesting if statements inside a while statements as well as using multiple control statements in the while statement.

Lab 3: Fibonacci Spiral

```#include
#include
#include
#include
#include
using namespace std;
int main()
{
connect("/dev/rfcomm0");
double x=-1, a=0, b=1, c;
for(int i=0; i<=5; i++)
{
c=a+b;
a=b;
b=c;
x=x+(c/10.0);
robot.motors(x,1.0);
wait(1.75);
}
disconnect();
}
```

Homework 1: Robots got Talent

1. The song my robot sings is the intro to Sleeping Lessons by The Shins. I used a for loop to repeat it 4 times as it is in the song.
2. For the drawing I used a while loop with constraints on the line and light sensors. I used function in order to find the time for turning and traveling specific distances. Also, if the obstacle or IR sensors were tripped, the loop would break. The robot often moves the paper on its own creating interesting designs based only on squares.
3. The random part of my robot's performance was random beeps. I used the random number generator and the modulus operator to get random frequencies.

Code

```#include
#include
#include
using namespace std;
double linear(int distance)
{
double rate = 15;
double time = distance/rate;
return time;
}
double clockwise(int degree)
{
double rate = 120;
double time = degree/rate;
return time;
}
int main()
{
connect("/dev/rfcomm0");
cout<<"line sensor: "<< robot.getLine()[1]<=6.0)
{
for(int i = 0; i<=3; i++)
{
robot.beep(.283, 659.26);
robot.beep(.283, 830.61);
robot.beep(.283, 987.77);
robot.beep(.283, 1108.73);
robot.beep(.283, 1244.51);
robot.beep(.283, 1108.73);
robot.beep(.283, 987.77);
robot.beep(.283, 830.61);
}
break;
}
while(robot.getLine()[1] == 0 && robot.getLight("center")>=30000)
{
robot.forward(1, linear(5));
robot.motors(1,-1);
wait(clockwise(90));
robot.forward(1, linear(5));
robot.motors(1,-1);
wait(clockwise(90));
robot.forward(1, linear(5));
robot.motors(1,-1);
wait(clockwise(90));
robot.forward(1, linear(5));
cout<<"Obstacle: "<= 1)
{
break;
}
if (robot.getIR()[0] == 0)
{
break;
}
}
for (int x = 0; x<=3; x++)
{
int tone= (rand() % 10) *1000;
robot.beep(1, tone);
}
disconnect();
}
```
Lab 4: Robot Behavior
• The objective of this lab was to make the robot act in different ways using functions. The three main behaviors we all made were alive (move faster with more light), coward (move away from light), and aggressive (move towards light). I chose to try the paranoid behavior for my fourth. The objective was for the robot to move faster with more light and turn around when it entered a shodow.
• Group: Mika, Kevin, Fangli
• ``` #include
#include
using namespace std;

double ambient;
double normalize (int newLight)
{
if (newLight >= ambient)
{
newLight = ambient;
}
return 1.0 - (newLight/ambient);
}

double normalize2 (int newLight)
{
return ambient/newLight;
}

void Coward()
{
ambient = (robot.getLight("left") + robot.getLight("center") + robot.getLight("right"))/3.0;
while (true)
{
int L = robot.getLight("left");
int R = robot.getLight("right");
robot.motors(normalize(R), normalize(L)); //coward
}
}

void Aggressive()
{
ambient = (robot.getLight("left") + robot.getLight("center") + robot.getLight("right"))/3.0;
while (true)
{
int L = robot.getLight("left");
int R = robot.getLight("right");
robot.motors(normalize(L), normalize(R)); //aggressive
}
}

void Alive()
{
ambient = robot.getLight("center");
while (true)
{
int light = robot.getLight("center");
robot.forward(normalize(light)); //alive
}
}

void Paranoid()
{
ambient = robot.getLight("center");
while (true)
{
int light = robot.getLight("center");
if (light > ambient)
{
robot.motors(-1*normalize2(light), normalize2(light));
}
else if (light <= ambient)
{
robot.forward(normalize(light));
}
}
}

int main()
{
connect("/dev/rfcomm0");
int input = 0;
cout<<"Enter 1 if you want me to act alive."<>input;
if(input == 1)
{
Alive();
}
else if (input == 2)
{
Coward();
}
else if (input == 3)
{
Aggressive();
}
else if (input ==4)
{
Paranoid();
}
else
{
cout<<"Input is invalid."<

Group Members:
Zach Zeff,
Kevin Yang,
Josh Chung
Prelab:
For the robot opening ceremony, we will use the W,A,S, and D keys to move the robot around. The F key will
be used to stop the robot, and the P key will have the robot sing the fight song. No sensors will be used for
this exercise because all of the robot's commands will be given manually through the keyboard.
For the line drawing event, the robot is moves backwards, since the line sensors are located near
the back of the robot; this allows for more precise movements. Inside a while-loop, the robot continuously
checks to see what value each line sensor is returning, and it feeds these values into the robot.move() function.
By treating the left line sensor as a negative value and the right line sensor as positive, and adding them
together to form the ROTATE_SPEED of the robot, the robot will move straight if both sensors detect a line(-1+1=0),
left if only the left sensor detects a line(-1+0=-1) and right if only the right sensor detects a line(0+1=1).
The robot moves slowly to prevent veering too far off the line, and in the case that neither sensors detect a line,
it will quickly move backwards in order to try to find the line again.
the robot moves forward until it gets to a certain distance from the wall. Then it turns right and checks or an
obstacle. If there is no obstacle, it moves forward. If there is, it turns 180 degrees and continues straight.
Make Tail, Turn Right 45 degrees, turn left 90 degrees go straight for distance, turn left 90 degrees, go straight
for distance, turn left 45 degrees, go straight for a distance, go back half distance, turn right 90 degrees, go
back for half distance, turn right 90 degrees, go straight for distance, turn left 45 degrees, go back for distance
We used a basic function structure.  By selecting a number from a menu and inputing that, it calls the
desired behavior function.  The opeing ceremony movement behavior is inside the main function though.
Code:  Robot Games Code

Final Project: User Input:

Our Computer Science topic is the importance of user input to the design process.  In modern technology, there are countless ways of interacting with technology such as touch screen, stylus, game controllers, and many others.  We want to demonstrate that it is important to design a user input device to meet the needs of the user.
Our programs will engage the user because they are hands on.  People like to play with things, so making a race with the robots will attract more attention.
The use of the robots creates a user-computer interface.  Our project, however, is showing that different input devices are inherently better or worse for the task at hand.
Once again, the user-computer interface is purposefully made to challenge the user for the sake of teaching the topic.
We will evaluate the users’ interaction by tracking the amount of people at the boot as well as a survey after participation.
Our programs do not directly take in user information, but our survey after will ask questions and the user will input information then.
We will generally ask multiple choice questions so the survey website will generate useful data.

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

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

```