15-494 Cognitive Robotics Spring 2010 |
|
Part I: Looking Glass "Hello World"
1. Compile the behavior LGdemo:
#include "Behaviors/StateMachine.h" #nodeclass LGdemo : StateNode, LGmixin() #shortnodeclass DisplayMessage : LGNode : DoStart displayHtmlText("<html><body>Hello world!</body></html>"); #nodemethod setup #statemachine StateNode =B(GreenButOffset)=> DisplayMessage #endstatemachine #endnodeclass REGISTER_BEHAVIOR(LGdemo); Notice that when you upload a file from the robot to the Looking Glass client you must give the path name beginning with the ms directory. The Looking Glass client stores uploaded files in a temporary directory on the workstation, and does not know the path they originated from on the robot. So when you display a file that has been uploaded this way, (e.g. displayHtmlFile()) do not include path name information. 2. On the robot (not your AFS directory) create the subdirectory ~/project/ms/lg. Then create the file ~/project/ms/lg/file1.htm with the following content: 3. Run Tekkotsu on the robot and start the LGdemo behavior, but do not push the green button yet.<html><body> <center><font size=+5 color=red>You pressed the yellow button.</center> </body></html> 4. In a separate terminal window, cd to Tekkotsu/tools/mon, then type: where the robot name is something like chiara3 or an IP address. Nothing will happen until the next step.java org.tekkotsu.mon.LGClient <robot_name> 5. Now make sure the robot is un-stopped, and press the green button. A Looking Glass screen should pop up on your workstation. 6. Modify the demo to also respond to a press of the yellow button by displaying the file file1.htm. By alternating green and yellow button presses, the user should be able to switch between messages. Part II: Speech
Modify your LGdemo program to speak some words when it displays the message
on the Looking Glass. To do this you must use a SpeechNode, or write:
#include "Sound/SoundManager.h" ... sndman->speak("Look at my display"); Part III: "Both Sides Now"
In this exercise you are going to take pictures of a landmark
configuration viewed from two locations. Start by reviewing the
LGmixin::uploadCameraImage function, which takes a snapshot and
uploads it to the Looking Glass client as a JPEG file.
Turn in your answers by Friday, April 2.
Set up two dissimilar landmarks, such as an orange can and a green game piece, so that one is to the left of the other, with a gap in between. Write a behavior to do the following:
Dave Touretzky and Ethan Tira-Thompson |