ROS Webcam demo on Macbook running Ubuntu

  1. Instructions to install Ubuntu on an external SSD (takes about an hour).
  2. Run this shell script to (takes about 10-15 min):
    • Install ROS (and a few other things)
    • Set up your Macbook’s built in webcam (more detail)
  3. Demo rostopic pub / echo:
    $ roscore # starts roscore
    $ rostopic pub test std_msgs/String 'this is a test' # publishes a message to a topic
    $ rostopic list # lists all active topics
    $ rostopic echo /test # live feed of data on topic
  4. Demo multiple machines: note both machines must have full connectivity (ssh)
    • On master:
      $ ifconfig # take note of your master’s ip address
      $ export ROS_IP=master.ip.address # can put in ~/.bashrc to make persistent
      $ echo $ROS_IP # check to see what that environmental variable is set to
      $ roscore # start roscore
    • On client:
      $ ifconfig # take note of the client’s ip address
      $ export ROS_IP=client.ip.address
      $ export ROS_MASTER_URI=http://master.ip.address:11311
    • Accessing a remote machine:
      $ ssh username@ip.address # must have openssh-server installed on remote machine
  5. Follow these instructions to set up a catkin_workspace
  6. The catkin instructions above do not mention to do this, but for most simple purposes, I suggest editing your .bashrc file:
    • The .bashrc file is a shell script that is run every time you open a new terminal window. Use a text editor (like gedit, nano, vim) to edit the ~/.bashrc file (gedit ~/.bashrc).
    • Add this line to the bottom (replace USERNAME):
      source /home/USERNAME/catkin_ws/devel/setup.bash
    • Reload your .bashrc by opening a new terminal window, or typing
      $ . ~/.bashrc
  7. Get ROS access to the webcam with usb_cam:
    • Check that camera is working
      $ guvcviewer
    • Install usb_cam
      $ cd ~/catkin_ws/src
      $ git clone
      $ cd ~/catkin
      $ catkin_make
    • Run usb_cam:
      $ cd ~/catkin_ws/src/usb_cam/launch
      $ roslaunch usb_cam-test.launch
    • Explore ROS environment:
      $ rosnode list
      $ rqt_graph
      $ rostopic list
      $ rostopic echo imagetopic
      $ roshz imagetopic
  8. Live image processing
    • Download optic flow example
      $ cd ~/catkin_ws/src
      $ git clone
      $ cd ~/catkin
      $ catkin_make
    • Explore directory structure (more detail)
    • Explore mono conversion node
    • Run mono conversion node
      $ rosrun optic_flow_example
      $ rostopic list
      $ rosrun image_view image_view image:=/imagetopic
    • Explore optic flow node
    • Run optic flow node
    • Edit optic flow node to also publish a single average value
  9. Remotely control a motor with live image data
  10. Real-time multi-target blob tracking
  11. Rosbag record, rosbag play, load data as hdf5
    • $ python ./ ~/2018-05-01-16-43-29.bag --out=~/2018-05-01-16-43-29.hdf5 --topic=/optic_flow_mean_vx
    • Analyze example
  12. Highlight modularity