apple

Albert Chin

My robot's name is Mango. It doesn't like moving very much but it sometimes does when . The coolest thing it can do is provide a human being with a delicious 150 calorie snack. (Also it can turn around and beep).

I like Computer Science because you can type up a bunch of code and, after running it through a compiler, see it directly turn into a program or some other more relatable executable immediately. Over the summer I took a few courses at a community college. I enjoy going out with friends, playing games, and petting cats in my free time.

apple

Eric Liu

David Zhang

Mika Aitbayeva

Albert Chin

apple apple apple apple

Eric Liu

Jesse Chand

David Zhang

Albert Chin

Introduction to "if", "else", "while"

apple

apple

Introduction to "for"

apple

apple

apple

Fibonacci Spiral

Group Members:

Eric Wu

David Zhang

Albert Chin

For this lab, we had to make the robot draw a fibonacci spiral. Here is a picture of our fibonacci spiral:

apple

This is the code for our lab.

Braitenburg Vehical Behaviors

Group Members:

Eric Wu

David Zhang

Albert Chin

For my vehical behavior, I did indecisive. In this behavior, my robot will move forward until it enters a shadow or darker area, then it will move back until it is back in the light. Once it is back in the light it will move forward again and repeatedly move backward and forward on the edge of the shadow.

Here is my code.

Song & Drawing Array Lab

For this lab, I made a program where the robot first initially asks the user whether they want to make a playlist or a drawlist. Once the user has selected one, the robot will randomly generate a playlist or drawlist (corresponding to the picked option) and display it to the user and ask if it is okay. If the user replies Y (yes), the robot will begin executing the playlist/drawlist. If the user replies N (no), the robot will then ask for user input to allow the user to create his or her own playlist of 5 songs. Afterwards, the robot will display the new playlist to the user again and ask if it is okay. (And the process repeats if necessary). If the user replies Shuffle (shuffle) when the user asks if the playlist is okay, the robot will randomly generate a new playlist/drawlist and display it the user and ask if it is okay again. The process repeats until the user replies Y (yes) to one of the robot's displayed playlists.

Here is my code.

Prelab Questions:

1. My robot will sing "Domino" by Jessie J. The song will be initiated after a small initial period once the robot checks that it is in a moderately bright location and has a decent battery life (batteries must be over 6).

2. My robot will draw 3 dominoes (long rectangles with a line in the middle of them). The drawing will be initiated once the robot checks and confirms that it is on a white/light surface (hopefully the dry-erase board) via the getLine sensors.

3. My robot's surprise ability will begin once it checks for obstacles around it using the obstacle and IR sensors. My robot's special ability is being able to follow and respond to commands the user types on the terminal. The robot will move forward when user types "forward", backward when user types "backward", turn right when user types "right" and turn left when user types "left". The robot also has a command to make it move randomly if the user types "random". The robot is programmed to execute a random number of actions (from 5 to 10 actions) and the actions it can do are robot.move, robot.forward, robot.backward, robot.turnleft, robot.turnright, and robot.motors. The actions are randomized, and the individual parameters for all the functions are also randomized.

4. My robot's performance will start automatically (with the song, then the drawing, then the surprise), as long as along each step of the way the initial sensor conditions are fulfilled (brightness and battery for the song, line for the drawing, and IR/Obstacle for the surprise). I wrote functions for each of the separate actions the robot must do (one for the song, one for the drawing, and one for the surprise), and I wrote a function for converting notes into frequencies that the robot can interpret and use. The song function is just a basic song made with robot beeps at different frequencies and rhythms, and the drawing function is a basic series of commands that makes the robot draw three rectangles utilizing robot.forward, robot.turnLeft, and robot.turnRight. The surprise function is coded with a while (cin >> input) loop, and inside the loop are nested if/else statements to determine the robot's actions based on commands the user enters. Within one of the else if statements is another set of if/else statements (for the random function, if the user enters "random") which is then initialized with a random number of spaces from 5 to 10. Then there is a for loop that fills the array with random numbers from 0 to 5, and another for loop with nested if/else statements to make the robot do randomized actions based on the number in each array slot.

Click here to view my code for the Robot Talent Show.

Prelab Questions:

1. For the opening ceremony, we will have a while >> cin loop to continuously collect input from the user to dictate how the robot moves. We will use a series of if/else if statements inside the while >> cin loop to decide what actions the robot takes depending on what the user enters. After the user has reached desire location and no longer wants to control the movement of the robot, they can leave the while >> cin loop by entering some combination of characters that will break the loop. Then the user can play the fight song (which will be coded with a series of many robot.beep's).

2. For the line following behavior, the robot will be stuck in a while loop and constantly collecting information from its left and right line sensors. The program will be coded for the robot to move "backwards" (which I will now refer to as forward, for simplicity's sake) The robot will move straight forward when both the left and right line sensors detect black underneath. On the other hand, if the right sensor detects black and left detects white, then the robot will turn right while moving forward. Similarly, if the left sensor detects black and right detects white, then the robot will turn left. If both line sensors somehow manage to suddenly go off the line, the robot will move back until it finds black again.

3. For the maze solving ability, our robot will use its front obstacle sensors to detect if there are any walls in front of it. If the robot sees a wall directly in front of it, it will stop and turn 90 degrees right and check again. If there are no obstacles it will then go forward. If there are still obstacles, then our robot will stop and turn 180 degrees and go straight. This will all be controlled in a while loop with nested if/else if statements.

4. For our robot's fastest drawer behavior, our robot will take the most efficient route possible by having no portions where it redraws an already previously existing line. It will also make the most acute turns possible using either left or right turning and backwards or forwards movement. There are no sensors involved in the fastest drawer function of our robot.

5. To structure our robot's behaviors, we put all the behaviors in separate void functions outside the main function. Then in our main function, we had a for loop run 5 times with a cin statement asking what function the user wants to run. Based on what the user enters, the program will execute one of the 5 functions.

Click here to view my code for the Robot Games.

Prelab Questions:

1. Our team's USAR strategy is to have all four robots go separate ways and spread out around the room to cover the most ground in the most efficient manner. We will primarily do this using move functions to control the robot continuously through input and get feedback back from the environment using sensors and taking pictures to see where the robot is. The robot uses all the sensors (IR, obstacle, light, camera) except line for this part and user input to determine where it goes.

2. While navigating the area, the robot will display messages if it gets too close to an obstacle so the user will know when he needs to turn or back up with the robot. The robot can then take pictures or take a string of black and white pictures to determine where it is and see if it can capture the lost robots. Again, the robot uses all sensors (IR, obstacle, light, camera) except line and user input for this part.

3. For locating the lost scribblers, my robot can take pictures continuously until it finds and has a picture for all the lost robots. It can then mark the pictures with lost robots in them so they can later be edited. The robot uses cameras for this.

4. To map, our team will use pictures of where the robots are and compare them to pictures of the environment to successfully map out the area where we believe the robots to be. Our team will make sure we have an array of marked pictures and an array of general pictures so we can compare them to each other later.

Click here to view my code for Urban Search and Rescue.

Prelab Questions:

1. In my search algorithm to find aliens in pictures for MARS, I have the program sort through all the pixels vertically (so by columns), and mark every green pixel that has a non-green pixel adjacent to it. (That way I only need to work with the border pixels of an alien). These pixels are stored in the "Point1" vector of a temporary "Alien", until the search algorithm detects an entire vertical column with no green pixels in it. At this point, if the previous column did have green pixels, the program will proceed to make a copy of the temporary Alien and all the Point1's stored in its vector, and push that vector to the back of another vector that stores all the Aliens. Then the temporary Alien is cleared and the process continues until all pixels have been searched.

2. My class Alien has data members height, width, center, and a vector of Point1's. The height, width, and center are pretty self-explanatory, and the vector of Point1's basically just includes all the Point1's (a class I made that just holds the x and y value of a pixel) that make up the outline of the Alien. Its member functions have the standard set and get functions for basically all the member data (except the vector) [setH(), setW(), etc.] It also has a member function to add a Point1 into the Point1 vector, and one to clear the Point1 vector. It has two member functions that cause the Point1 vector to get sorted from smallest to largest by X value, and then one by Y value, and have the height and width saved accordingly (using MergeSort).

3. I had to first think of how I would go about defining an Alien. I decided the most important thing to know would be the dimensions of the most extreme points of the alien (thus its height and width) and the center of the Alien (derived from the height and width, and the y/x value of the first green pixel). Then I realized that while I could store all the green pixels together easily into an array or vector, I would need an easy and reliable way to distinguish which pixels belonged to which alien (and just a way to separate the pixels into aliens in general). So, in my code, I wrote that if there were green pixels in the previous column but no green pixels in the current column, I would separate it as one alien.

4. I tested my algorithm with MARS2 first, because it seemed like it was the most complex (in my algorithm's case) for my problem, and I figured if it could do MARS2 well (with all the possible color conflicts), I probably had good bounds and a solid algorithm that could successfully complete the assigned task for the other pictures.

5. I used selection sort for sorting the aliens by size, and it saves the height of the first alien as a max value and continues comparing the height of all the other aliens in the array to that height. If there is a higher height value found, that index is saved and then at the end of the for loop, the index marked of the alien with the greatest height is swapped up to the first position. Then the loop does it again except this time swapping the next greatest height into the second position and so on until it runs through all the aliens in the array.

6. I used selection sort for sorting the aliens by closeness, and it saves the Y value of the center for the first alien. Similar to the selection sort for aliens by size, it checks the Y value of the center for every alien after that and compares it to the Y value of the first one. If it is less than that of the first (thus meaning the Alien is lower in the picture and closer), then the index is saved and it will be moved to the first position later. The for loop runs through it again and this time puts the next lowest center Y-value alien into the second position and so on until it runs through all the aliens in the array.

7. The Big O for my selection sort algorithm is (n^2), but for my merge sort algorithm (used in the member functions of my Alien's), the Big O is nlog(n).

Click here to view my code for Mars Rover: Alien recognition.

Prelab Questions:

1. We are trying to demonstrate "encryption". Encryption is often taken the wrong way (as in direct coding/hiding of messages and translating coherent sentences into seemingly incoherent strings of numbers and letters), we are demonstrating the broader definition of encryption. (Though we do have elements of the generic "encryption" in our demos). Encryption in computer science can refer to many things, including pre-programmed methods and ways that robots or external sources respond to certain cues (like their sensors). Because watching words get translated into numbers and vice versa is relatively uninteractive and boring, I decided to make keystrokes translate into actions in the robot and interacting with the robot (via blocking its sensors) translate into outputted text.

2. My program will first ask the user for some personal details (that it will later use in its response program). Then the program will ask the user if it wants to have the robot respond to keystrokes or have the robot display messages based on which of its sensors are covered.

3. For developing my human computer interface, I thought of what would be exciting and interesting to a middle schooler. I realized that robots talking back and talking to robots and having robots act based on direct command would be fairly captivating and appealing, so that is what I did.

4. I will evaluate my human-computer interface by keeping a log of the number of times the robot has responded to the user and by keeping a log of all the people who have used the program and inputted their personal information.

5. I will evaluate the user's interaction by checking to see how many times the robot has had to respond to their commands physically and how many times the robot has "verbally" (by displaying text) responded to their commands.

6. My program will have "cin" statements in each of the necessary functions that require user interaction info (which is basically all of them) whether it be for filling out personal information or giving commands to the robot.

7. I will read the information from the outputted file using input stream. Once I have the numbers associated with the different types of interaction, I will compare the numbers to each other and depending on the one that is largest, I will cout/display a certain statement, letting them know which type of encrypted-interaction they favored.

Click here to view my code for Final Project, Human-Computer Interface/Interaction.

Valid XHTML 1.0 Transitional!Valid CSS!

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