Updated: It also turns out the https://github.com/mjshiggins/ros-examples code can work with ros kinetic/ubuntu 16.04. So you do not need to use docker if you don’t want to.

In part.4.a, we learned about using RViz in docker to view Didi data. Here we see how we can use a subscriber node to output data from rosbag playback node. We want to run the code from https://github.com/mjshiggins/ros-examples in docker environment.

Before we run the github code above, it would be good to learn about the basics of ros. We are going to implement a “hello world” python example from http://www.thushv.com/ros/getting-feet-wet-with-ros/, which has a publisher and a subscriber node. Here it goes!

  1. Modify the startup script run_ros.sh from part.4.a to include the environment varables for ROS network.
nvidia-docker run -it \
-e ROS_HOSTNAME=localhost \
-e ROS_MASTER_URI=http://localhost:11311/ \
-e QT_X11_NO_MITSHM=1\

2. We need multiple terminals. Hence I install tmux inside dhttps://github.com/udacity/didi-competition/tree/master/trackletsocker.

apt-get install tmux  

To enable mouse support for tmux, create ~/.tmux.conf file.

touch /root/.tmux.conf

Add the following lines in .tmux.conf. The settings are different for various versions of tmux! To check the tmux version, use the command “tmux -V”.

## set mouse for tmux 1.8 as shipped with Ubuntu 14.04
set -g mode-mouse on
set -g mouse-resize-pane on
set -g mouse-select-pane on
set -g mouse-select-window on

I use a tmux startup script start_tmux.sh to create 4 windowed terminals.

echo 'start tmux'#set session name
export SESSION=xxx
tmux -2 new-session -d -s $SESSION
tmux split-window -v -t $SESSION
tmux split-window -v -t $SESSION
tmux split-window -h -t $SESSION

tmux attach -t $SESSION

You should setup your ros enirovnment before you start tmux. For example,

export CATKIN_WS=/root/share/project/didi/data/catkin_ws/indigo/my_test
source /opt/ros/indigo/setup.bash
source $CATKIN_WS/devel/setup.bash

And this is what you get in the docker container

3. Follow instructions from. http://www.thushv.com/ros/getting-feet-wet-with-ros/. For running ros without lanuch file, use the commands:

  • terminal1 : # start the master
  • terminal2: # start the publisher node
    python ros_hello_publisher.py
  • terminal3: # start the subscriber node
    python ros_hello_subscriber.py

(Note that I modify the subscriber print message from the example in the tutorial website)

https://github.com/omgteam/Didi-competition-solutionNow, you have basically setup the following ystem in ros.

If everything works well, we can proceed to to run the code from https://github.com/mjshiggins/ros-examples. Likewise, we use:

export CATKIN_WS=/root/share/project/didi/data/catkin_ws/indigo/mjshiggins
source /opt/ros/indigo/setup.bash
source $CATKIN_WS/devel/setup.bash
ln /dev/null /dev/raw1394


And the results!

Other resources for extracting data from rosbag are:

[1] https://github.com/linfan/DiDi-Udacity-Data-Reader
[2] https://github.com/redlinesolutions/Udacity-Didi-Challenge-ROSBag-Reader
[3] http://ronny.rest/blog/ (see ROS and ROS bags part1,2,3)
[4] https://github.com/udacity/didi-competition/tree/master/tracklets
[5] https://github.com/omgteam/Didi-competition-solution