Difference between revisions of "ME/CS 132a, Winter 2011, Lab 1"
Line 33: | Line 33: | ||
In Exercise #1, we see the simulated robot wander around, but now let's make it move in a controlled fashion by inserting our own controller (referred to as the ''client code''). | In Exercise #1, we see the simulated robot wander around, but now let's make it move in a controlled fashion by inserting our own controller (referred to as the ''client code''). | ||
# Follow the instructions as in Exercise #1, but this time use another world config file.:<BR> <TT>$ player lab0014.cfg -p <your_RPIN></TT> | # Follow the instructions as in Exercise #1, but this time use another world config file.:<BR> <TT>$ player lab0014.cfg -p <your_RPIN></TT> | ||
# Open another terminal window. Connect to the server, and change to the directory containing the tutorial code:<BR><TT>$ cd | # Open another terminal window. Connect to the server, and change to the directory containing the tutorial client code:<BR><TT>$ cd client_code </TT> | ||
# Compile the C++ code to generate the binaries (i.e. executables). You only need to do this once unless you change the source C++ code (<TT>.cc</TT> files): <BR><TT>$ make</TT> <BR> | # Compile the C++ code to generate the binaries (i.e. executables). You only need to do this once, unless you change the source C++ code (<TT>.cc</TT> files): <BR><TT>$ make</TT> <BR> | ||
# Run the following to start the client program. | # Run the following to start the client program. Take <TT>me132_tutorial_0</TT> as an example: <BR><TT>$ ./me132_tutorial_0 -p <your_RPIN></TT> | ||
#*You should see the robot moving in a circle in the Stage simulator. | |||
#* The reason that "./" (meaning "the current directory") is put before the executable is that Linux does not automatically look for the file in the current directory (unlike in Windows), so we need to explicitly tell its location. | #* The reason that "./" (meaning "the current directory") is put before the executable is that Linux does not automatically look for the file in the current directory (unlike in Windows), so we need to explicitly tell its location. |
Revision as of 05:52, 4 February 2011
Exercise #0: Linux Primer (skip this if you had prior experience)
If you have not used Linux (or any UNIX-like OS) before, go to http://imss.caltech.edu/cms.php?op=wiki&wiki_op=view&id=324 to learn the basics of command line operations. It is important to go through this since we will heavily rely on the command line for the labs.
Exercise #1: Running Player/Stage Remotely
In order to run Player/Stage remotely, you'll need to access the robotics server using the login information provided in class. You'll need to have X-forwarding enabled. This is pretty straight-forward if you're running UNIX-like systems. See below for special notes on how to run using Windows.
- Server address: tokyo.cds.caltech.edu
- Connection type: SSH
- We will use the dollar sign "$" as the command line prompt. You shouldn't include this as part of the commands below.
Logging into the Player/Stage remote server (Linux/Mac OS X)
- Open a terminal window (that is X-friendly).
- Connect to robotics via SSH:
$ ssh -X username@tokyo.cds.caltech.edu
and enter the password (where username needs to be replaced with the one given out in class).- The "-X" enables X11 forwarding, which is how you'll get the Stage windows and such to appear on your local machine.
- If this is your first login, be sure to change your password by running passwd in the command line.
Logging into the Player/Stage remote server (Windows)
In order to use Windows, you'll need to install X-Win32, which is freely available through Caltech's software service, as well as an SSH client, such as Putty.
- Once X-Win32 is installed on your machine, start up the X-Win server.
- This should put a little "X" icon in your system tray.
- Open up your SSH client program, and change the appropriate settings to enable X11 forwarding.
- For Putty, this is under "Connection-->SSH-->X11 forwarding"
- If this is your first login, be sure to change your password by running passwd in the command line.
Running Player/Stage
- Change directory to the appropriate path that contains the Robotics lab stage world file:
$ cd worlds - Start up Player, using the Robotics lab world config file:
$ player simple.cfg -p <your_RPIN>- your_RPIN is your robot port ID number which you were already assigned.
- You should see the Stage simulator and a simulated robot wandering around.
Exercise #2: Running Player/Stage with Your Own Client Code (Controller)
In Exercise #1, we see the simulated robot wander around, but now let's make it move in a controlled fashion by inserting our own controller (referred to as the client code).
- Follow the instructions as in Exercise #1, but this time use another world config file.:
$ player lab0014.cfg -p <your_RPIN> - Open another terminal window. Connect to the server, and change to the directory containing the tutorial client code:
$ cd client_code - Compile the C++ code to generate the binaries (i.e. executables). You only need to do this once, unless you change the source C++ code (.cc files):
$ make - Run the following to start the client program. Take me132_tutorial_0 as an example:
$ ./me132_tutorial_0 -p <your_RPIN>- You should see the robot moving in a circle in the Stage simulator.
- The reason that "./" (meaning "the current directory") is put before the executable is that Linux does not automatically look for the file in the current directory (unlike in Windows), so we need to explicitly tell its location.