Assignment
Contents
Assignment#
First set up the docker image following these instructions.
Creating a Publisher and Subscriber (50 points)#
Answer these questions in ros.txt
and submit the ROS package you create.
Read understanding nodes.
Start the
screen
session we use to fly the drone. (Look here to refresh about the screen environment.) Userosnode list
to display what nodes are running when you start the screen. If you wish, take a look at the software architecture diagram and look at all of the blue ROS topics to gain a visual understanding of all of the nodes that are running. Once again, do not worry about understanding everything now, or knowing what each topic is used for- you will learn this through experience as the course progresses. No answer is required for this questionUse
rosnode info
to find out more about as many nodes as you’d like. What is the name of the time of flight (tof) node and what topics does it publish?Do the ROS tutorial to create a package. Name your package
ros_assignment_pkg
. Create it in thecatkin_ws/src
directory on your drone.Do the building packages tutorial.
Follow the ROS publisher/subscriber tutorial using the workspace and package you created above. Hand in the entire package.
Start the
screen
session we use to fly the drone. Userostopic echo
androstopic hz
to examine the results of various topics. What is the rate at which we are publishing the range reading?
Messages (5 points)#
Make all modifications in your ROS package from Problem 1 and hand in the package
Read Creating a ROS msg. You do not need to read the section on services.
In your package from question 1, create a ROS message called
MyMessage
with a field for astring
, calledname
, and a field for an array offloat64
, calledcontents
. Edit files such asCMakeLists.txt
to ensure your message is compiled and available for use. Make these modifications in the package from problem 1 and hand it in.
Reading the TOF Sensor (15 points)#
Write a ROS subscriber on your drone to read the values from the time of flight sensor topic and print them to
stdout
. Name the filemy_echo.py
and submit it.Write a second ROS subscriber that listens to the time of flight sensor topic and calculates the mean and variance over a ten second window using NumPy. Print these values to
stdout
. Name the filemean_and_variance.py
and submit it.