Monday, September 11, 2017

How to simply merge turtlebot source code into one workspace?

When we are trying to install turtlebot on our own computer, we will follow Turtlebot Installation. In section 1.3 source installation, 1.3.2 workspaces, it simply writes "We are using chained workspaces here, but you could just as simply merge them into one." I have done this several times, but still there are some learner asking me how to do this. So here is a simple step by step tutorial and explanation how we could simply merge them into one workspace.

Let's have a look at the original command lines

> mkdir ~/rocon
> cd ~/rocon
> wstool init -j5 src https://raw.github.com/robotics-in-concert/rocon/release/indigo/rocon.rosinstall
> source /opt/ros/indigo/setup.bash
> rosdep install --from-paths src -i -y
> catkin_make

> mkdir ~/kobuki
> cd ~/kobuki
> wstool init src -j5 https://raw.github.com/yujinrobot/yujin_tools/master/rosinstalls/indigo/kobuki.rosinstall
> source ~/rocon/devel/setup.bash
> rosdep install --from-paths src -i -y
> catkin_make

> mkdir ~/turtlebot
> cd ~/turtlebot
> wstool init src -j5 https://raw.github.com/yujinrobot/yujin_tools/master/rosinstalls/indigo/turtlebot.rosinstall
> source ~/kobuki/devel/setup.bash
> rosdep install --from-paths src -i -y
> catkin_make
This is a very standard way to create three workspaces and compile one by one. -j5 is to define how many threads to do the installation work, so it is not compulsory, however it will speed up the compilation.

Pay attention to the source, if you have some background knowledge about the ROS workspace, the first step source /opt/ros/indigo/setup.bash may be omitted.

Here, every catkin_make should be executed in the right sequence. It is a must to chain the workspaces.

So if we want to merge the three workspaces into one, we should use wstool merge.

> mkdir ~/turtlebot_ws
> cd ~/turtlebot_ws 
> wstool init src https://raw.github.com/robotics-in-concert/rocon/release/indigo/rocon.rosinstall
> wstool merge -t src https://raw.github.com/yujinrobot/yujin_tools/master/rosinstalls/indigo/kobuki.rosinstall
> wstool merge -t src https://raw.github.com/yujinrobot/yujin_tools/master/rosinstalls/indigo/turtlebot.rosinstall
> wstool update -t src
> catkin_make

Some error: multiple packages, I choose to delete kobuki/kobuki_rapps.

Multiple packages found with the same name "kobuki_rapps": - kobuki/kobuki_rapps - rocon_rapps/kobuki_rapps

And delete another two packages: create_gazebo_plugins, kobuki_gazebo_plugins.

Now you should be able to compile successfully.