Having a robot in the home is a dream of many people. Science fiction has portrayed future life as being filled with autonomous robots that cook and clean up around the house. Today, robots are not quite as useful, but the Robosapien is an extremely successful humanoid that is found in many homes. Although the Robsapien serves mainly entertainment purposes, it was our goal to try to make it accomplish something useful. As a group, we decided that the most useful thing our Robosapien could do was stomping vile zombies. Our project involves using vision to identify “zombies” to walk on, and identify “Civilians” that it will not aim to step on.
The first step for our assignment was to be able to communicate with the robot through its Bluetooth adapter. We connected to the robot using a laptop and configured the sample program to be functional in controlling the robot. After experimenting with the sample code, we realized several things about controlling the robot. The Bluetooth tended to occasionally fail to send the desired command to the robot. This was especially apparent when trying to receive any information from the robot’s sensors. For this reason, we decided not to incorporate the sensors into our assignment.
The next step was to set up the vision. Attaching a camera to a Robosapien is inconvenient because of the erratic way in which it moves and because the camera is of low quality. There would be large amounts of distortion in images taken from a camera fixed to the robot. For these reason, we decided that we would use a “hovering” overhead camera that would move with the Robosapien, and always be oriented facing his direction of motion. This allows us to not have to identify the robot in the images we process, because the camera is always in the same place with relation to the Robosapien. A program was written that takes in images of a specific resolution and naming scheme and analyzes them for differences in color. The program can recognize the colors orange/pink and green. It then translates the image to an ASCII representation, with orange/pink regions appearing as P’s and green regions appearing as Z’s. Using simple trigonometry, the program can then determine where the center of the green region is in relation to the front of the robot. It outputs an angle by which the robot must turn to be facing the target, and also the linear distance it must travel. We deemed this as all the information that has to be known for the robot to successfully reach its target.
To translate the amount of rotation and distance to travel, we had to time how long the robot took to turn and move specific distances. After much trial and error, we determined that there was a fairly linear relationship between how long we tell it to walk or turn for, and how far it moves. Many factors make this a bit inaccurate, such as the odd acceleration patterns which we observed. Some times the robot would take short steps, and other times it would take very large steps, making this process quite tedious and frustrating.
The program takes this information, and outputs commands to the robot to turn for a specific amount of time, and then walk forward until it reaches the distance determined in the picture. The distance is converted into a time for which it needs to be walking. We determined that having the robot lean back before it starts walking makes it so that it walks in a nearly straight line. If all goes as planned, the robot walks to the green square. At this point it asks for the next image to process.
There are several problems with our system of vision. Firstly, lighting conditions and poor camera quality make it very difficult to differentiate color. We created a mat of white paper on which to work, but the program still had trouble because the images were dark. We got several sample images to work, and re-created these on the paper, as if we had just taken the picture. Although this is not a practical method of vision, it does show that we are able to identify targets. If a better camera was used, taking images any time we pleased would have the same effect. This is why our class demonstration did not fare so well.
Another problem we encountered was the loss of commands to the robot. We made the mistake of only sending each set of commands once per image, so that if a command is lost, the robot would not perform as desired. If the vision worked the way we planned, then this would not be a problem, because the next image would again give commands to get to the target. Since we only have one sample image for each scenario, if it does not work the first time, it has to move on to the next setup.
We also tried to incorporate use of sensors into the programming. We placed books under the green squares and told the robot to turn to face them and then walk until its foot sensor was triggered. The robot would hit the target, and keep going for quite some time until the program recognized that the sensor had been hit. For this reason, we disabled this part of the code.
In conclusion, Robosapiens are really not all that practical for use in anything but entertainment. Their movement is too inconsistent to do any task in an acceptable amount of time. But Robosapiens were not meant to be useful. The project, however was quite interesting.
To run the code open in a new project and add all the picture files to the directory where the project is stored.