wstool: ROS Workspace Tool

# install wstool
sudo apt-get install python-wstool

# create a workspace
mkdir -p ~/catkin_ws/src
cd ~/catkin_ws
catkin init
#catkin config --merge-devel
#echo 'source ~/catkin_ws/devel/setup.bash' >> ~/.bashrc

# approach one: in src level
cd ~/catkin_ws/src
git clone <ros_package>.git
wstool init
#wstool init . <ros_package>/ssh.rosinstall
wstool merge <ros_package>/ssh.rosinstall
wstool update

# approach two: in workspace level
cd ~/catkin_ws
wstool init src   # will create an empty .rosinstall file 
#wstool init src PATH_TO_ROSINSTALL_FILE.rosinstall  # initialize with a .rosinstall file
wstool merge -t src PATH_TO_ROSINSTALL_FILE.rosinstall
wstool update -t src   # -t specify targer folder

# example: use rosinstall_generator
cd ~/catkin_ws
wstool init src
rosinstall_generator --rosdistro kinetic mavlink | tee /tmp/mavros.rosinstall
rosinstall_generator --upstream mavros | tee -a /tmp/mavros.rosinstall # -a: append
wstool merge -t src /tmp/mavros.rosinstall
wstool update -t src -j4
rosdep install --from-paths src --ignore-src -y

# compile code and refresh workspace
catkin build
source ~/catkin_ws/devel/setup.bash


Last updated