This assignment focuses on ROS (Robot Operating System). ROS is a framework used to program robots. It is quite complicated (some might say too complicated). However it is widely used on both industrial and commercial settings.
GNU/Linux uses environment variables to store configuration
information about a variety of things. You can use
to view the environment variables in your shell on the Rasberry Pi.
In bash (and most shells), environment variables are local to your
bash session, so they are often set in configuration files that are
run every time your shell starts, such as
X=3to set the value of an environment variable named
Xto the value
echo $Xto display the variable. Note that you must prepend
$to the variable name when reading it, but not when setting it.
echo $Xto see the value of the environment variable
X. What happens? Does this work? Why or why not?
envto see all the environment variables set in your shell. Pick one. Research the one that you picked. Describe 1) What program sets the environment variable and 2) What the variable controls. For example, the
EDITORenvironment variable is set in the
.bashrcfile when you log in. 2) It is the name of the program called by sudoedit, git commit, and other programs when they need to edit a file.
setup.shscript sets the ROS_MASTER_URI and ROS_HOSTNAME or ROS_IP environment variables in your session. In a second SSH session in which you have not run screen (so just after you log in), assess the value of the environment variables. Are they set to the correct values? What is setting ROS_MASTER_URI? What is setting ROS_IP or ROS_HOSTNAME? How did you figure this out? (You might find the
grepcommand useful. Use
man grepto find out how to use it.)
For this section, commit the package into the git repository you use for handing in the assignment. You do not need to commit the whole workspace; just the package.
rosnode listto display what nodes are running when you start the screen session. Use
rosnode infoto find out more about each node. What topics does
rostopic listto examine the publisher and subscriber you wrote (while they are running). Use
rostopic echoto display the results of the publishing topic. Submit a screenshot showing the results of these two commands.
screensession we use to fly the drone. Use
rostopic hzto examine the results of various topics. What is the frame rate we are publishing images from the camera?
Now write a ROS subscriber to read the values from the infrared sensor
rostopic list to determine the value of the
infrared topic. Compute the mean and variance of the sensor values
over a ten second window. You can store the data in memory in your
Python program and then compute statistics based on the stored data.
(For longer windows, you might want to log to disk.) What is the
standard deviation of the sensor when pointed at the same surface for
ten seconds? You can use NumPy to
compute the statistics.
ROS also supports services with a more traditional function call abstraction so that you can send a remote procedure call and receive a response. Describe when services might be a good idea to use? Describe problems that services might have related to robotics? Especially think through issues such as timing and failure modes.
Hand in your answers using this link. For problems 1, 2, and 3, we would like you to upload a screenshot for each question that asks you to do some action in the command line. For each question that asks you to write code, we would like you to upload the raw code. For problem 4, we would like a written response in a pdf.