play with ros

ros filesystem tools

first check ROS_PACKAGE_PATH, where defines all ROS packages that are within the directories.

1
2
3
4
5
6
7
8
9
10
11
rospack find [package-name]
rospack list
roscd [package-name]
```
take an example, to locate `rosbridge_websocket.launch`
```shell
rospack find rosbridge* #rosbridge_server
roscd rosbridge_server
cd launch

another tool to view ros-launch: roslaunch-logs

write a .launch file

launch files, which uses XML format, usually make a directory named “launch” inside the workspace to organize all launch files, and it provides a convenient way to start up multiple nodes and master, it processs in a depth-first tarversal order. usually launch files can be put a launch folder under a ros node project.

1
2
3
roslaunch package_name launch_file
#or
roslaunch /path/to/launch_file

an sample launch file:

1
2
3
<launch>
<node pkg="package_name" type=" " name=" " output=" " args=" " />
</launch>

args can define either env variables or a command.

node/type There must be a corresponding executable with the same name.

rviz

rviz can help to playback sensor rosbag at lab. and also the visualization tool in algorithm/simulation development.

someone(at 2014) said Google’s self-driving simulation has used rviz:

google simulation

a sample with rviz to visualize rosbag info:

1
2
3
4
5
# terminal 1
roscore
# terminal 2
rosbag play kitti.bag -l
rosrun rviz rviz -f kitti-velodyne

rosbag

the sensor ros node will collect data in rosbag during physical or vitual test, then playback rosbag to develop or verify the sensing algorithms. or use to build simulation scene.

a few common commands, and also rosbag support interactive C++/Python APIs.

1
2
3
4
rosbag record #use to write a bag file wit contents on the specified topics
rosbag info #display the contents of bag files
rosbag play #play back bag file in a time-synchronized fashion

kitti dataset

are we ready for autonoous driving? – the KITTI vision benchmark suite, which is a famous test dataset in self-driving sensing, prediction also mapping and SLAM algorithm development.

there are a few benchmars includes:

  • stereo, basically rebuild the 3D object from multi 2D images.

  • optical flow, used to detect object movement(speed, direction)

  • scene flow, include other 3D env info, and objects from optical flow
  • depth
  • visual odometry
  • object detection
  • object tracking
  • road/lane detection
  • semantic evaluation

catkin package

catkin is ros package build/manage tool.

mkdir -p ~/catkin_ws/src
cd ~/catkin_ws/src
catkin_create_pgk demo std_msgs rviz 
cd demo
mkdir launch
cat "<launch> <node  name="demo"  type="rviz" -d="ls `pwd`" /> </launch> " >  demo.launch
cd ~/catkin_ws
catkin_make --pkg demo

# add catkin_ws to 
cat "export ROS_PACKAGE_PATH=$ROS_PACKAGE_PATH:/path/to/catkin_ws/" >> ~/.bashrc