Ubuntu 12.04 Install Gazebo ROS Package (gazebo_ros_pkgs) 1.9 From source

Adam posted @ Tue, 13 Aug 2013 19:11:35 +0800 in C++ with tags linux c++ cmake boost robotics , 55923 readers

Ubuntu 12.04 Install Gazebo ROS Package (gazebo_ros_pkgs) 1.9 From source

Install ROS

Install ROS Here

Remove ROS’s Old Version of Gazebo ROS Integration

sudo apt-get remove ros-groovy-simulator-gazebo

Install Gazebo – Get the Gazebo pre-compiled packs

Get the repo

sudo sh -c 'echo "deb http://packages.ros.org/ros/ubuntu precise main" > /etc/apt/sources.list.d/ros-latest.list'
sudo sh -c 'echo "deb http://packages.osrfoundation.org/gazebo/ubuntu precise main" > /etc/apt/sources.list.d/gazebo-latest.list'

Install Gazebo

sudo apt-get update
sudo apt-get install gazebo

(Note: As of Gazebo 1.9 you no longer need to setup your .bashrc to always source Gazebo's setup.sh to export necessary paths.)

Check your installation

gzserver

Note:

The first time gzserver is executed requires the download of some models and it could take some time, please be patient. Wait until you see a message like Publicized address: … and then execute a gazebo client:

gzclient

Install Gazebo ROS Packages – gazebo_ros_pkgs

Test that stand-alone Gazebo works

Before attempting to install the gazebo_ros_pkgs, make sure the stand-alone Gazebo works by running in terminal:

gazebo

You should see the GUI open with an empty world. Also, test adding a model by clicking on the “Insert” tab on the left and selecting a model to add (then clicking on the simulation to select where to place the model).

Now Install gazebo_ros_pkgs from Source (on Ubuntu)

  • Set up a catkinworkspace

mkdir -p ~/catkin_ws/src
cd ~/catkin_ws/src
catkin_init_workspace
cd ~/catkin_ws
catkin_make

# Don't forget to source every time you open a terminal
source ~/catkin_ws/devel/setup.bash
  • Download gazebo_ros_pkgs code from git

cd ~/catkin_ws/src
# This is gazebo_ros_pkgs
git clone https://github.com/ros-simulation/gazebo_ros_pkgs.git

# ROS control and ROS controllers pkg new in hydro
git clone https://github.com/ros-controls/ros_control.git
git clone https://github.com/ros-controls/ros_controllers.git
git clone https://github.com/ros-controls/control_toolbox.git
git clone https://github.com/ros-controls/realtime_tools.git
  • Check ROS dependencies

rosdep update
rosdep check --from-paths . --ignore-src --rosdistro groovy
rosdep install --from-paths . --ignore-src --rosdistro groovy -y
  • If you are ready, Build the gazebo_ros_pkgs now

cd ~/catkin_ws/
catkin_make

  • Possible problems during building gazebo_ros_pkgs:

1. Boost linking problem in gazebo_plugins project:

${PROJECT_SOURCE_DIR}/devel/lib/libvision_reconfigure.so: error: undefined reference to 'boost::thread::start_thread_noexcept()'
${PROJECT_SOURCE_DIR}/devel/lib/libvision_reconfigure.so: error: undefined reference to 'boost::thread::join_noexcept()'

You can solve the problem following the instruction below:

  1. Go to your workspace, eg. cd ~/catkin_ws/
  2. Go to the relative directory: “src/gazebo_ros_pkgs/gazebo_plugins”
  3. Open CMakeLists.txt file
  4. Go to line 130
  5. Add the following code into CMakeLists.txt from line 131 to 143
### Boost Thread link error FIXED By {Adam_Basfop_Cavendish: GetbetterABC@yeah.net} 
# ERROR description:
# ${PROJECT_SOURCE_DIR}/devel/lib/libvision_reconfigure.so: error:\
#   undefined reference to 'boost::thread::start_thread_noexcept()'
# ${PROJECT_SOURCE_DIR}/devel/lib/libvision_reconfigure.so: error:\
#   undefined reference to 'boost::thread::join_noexcept()'
#
# ERROR raised reason:
# Linking only to libboost_thread-mt.so, but not {libboost_thread.so, libboost_thread-mt.so}
# 
# Solution: {
target_link_libraries(camera_synchronizer boost_thread)                                                 
# }(end solusion: Boost Thread link error)

2. Boost linking problem in controller_manager_tests/cm_test project:

    ${PROJECT_SOURCE_DIR}/devel/lib/libcontroller_manager.so: error: undefined reference to 'boost::filesystem::path::operator/=(boost::filesystem::path const&)'
    ${PROJECT_SOURCE_DIR}/devel/lib/libcontroller_manager.so: error: undefined reference to 'boost::filesystem::detail::status(boost::filesystem::path const&, boost::system::error_code*)'
    ${PROJECT_SOURCE_DIR}/devel/lib/libcontroller_manager.so: error: undefined reference to 'boost::filesystem::path::parent_path() const'
    ${PROJECT_SOURCE_DIR}/devel/lib/libcontroller_manager.so: error: undefined reference to 'boost::filesystem::path::filename() const'
    ${PROJECT_SOURCE_DIR}/devel/lib/libcontroller_manager.so: error: undefined reference to 'boost::filesystem::path::codecvt()'
    ${PROJECT_SOURCE_DIR}/devel/lib/librealtime_tools.so: error: undefined reference to 'boost::thread::start_thread_noexcept()'
    ${PROJECT_SOURCE_DIR}/devel/lib/librealtime_tools.so: error: undefined reference to 'boost::thread::join_noexcept()'

You can solve the problem following the instruction below:

  1. Go to your workspace, eg. cd ~/catkin_ws/
  2. Go to the relative directory: “src/ros_control/controller_manager_tests”
  3. Open CMakeLists.txt file
  4. Go to line 57
  5. Add the following code into CMakeLists.txt from line 58 to 82
### Boost thread and filesystem link error FIXED By {Adam_Basfop_Cavendish: GetbetterABC@yeah.net} 
# ERROR description:
# ${PROJECT_SOURCE_DIR}/devel/lib/libcontroller_manager.so: error: \
#   undefined reference to 'boost::filesystem::path::operator/=(boost::filesystem::path const&)'
# ${PROJECT_SOURCE_DIR}/devel/lib/libcontroller_manager.so: error: \
#   undefined reference to 'boost::filesystem::detail::status(boost::filesystem::path const&, boost::system::error_code*)'
# ${PROJECT_SOURCE_DIR}/devel/lib/libcontroller_manager.so: error: \
#   undefined reference to 'boost::filesystem::path::parent_path() const'
# ${PROJECT_SOURCE_DIR}/devel/lib/libcontroller_manager.so: error: \
#   undefined reference to 'boost::filesystem::path::filename() const'
# ${PROJECT_SOURCE_DIR}/devel/lib/libcontroller_manager.so: error: \
#   undefined reference to 'boost::filesystem::path::codecvt()'
# ${PROJECT_SOURCE_DIR}/devel/lib/librealtime_tools.so: error: \
#   undefined reference to 'boost::thread::start_thread_noexcept()'
# ${PROJECT_SOURCE_DIR}/devel/lib/librealtime_tools.so: error: \
#   undefined reference to 'boost::thread::join_noexcept()'
#
# ERROR raised reason:
# filesystem: Linking only to libboost_filesystem-mt.so, but not {libboost_filesystem.so, libboost_filesystem-mt.so}
# thread: Linking only to libboost_thread-mt.so, but not {libboost_thread.so, libboost_thread-mt.so}
# 
# Solution: {
  target_link_libraries(${PROJECT_NAME} boost_filesystem boost_thread)
  target_link_libraries(cm_test boost_thread boost_filesystem)
# }(end solusion: Boost thread and filesystem link error)

Finally Testing gazebo_ros_pkgs:

Testing Gazebo with ROS Integration

roscore &
rosrun gazebo_ros gazebo

The Gazebo GUI should appear with nothing inside the viewing window.

EmptyGazebo.png

To verify that the proper ROS connections are setup, view the available ROS topics:

rostopic list

You should see within the lists topics such as:

/gazebo/link_states
/gazebo/model_states
/gazebo/parameter_descriptions
/gazebo/parameter_updates
/gazebo/set_link_state
/gazebo/set_model_state

You can also verify the Gazebo services exist:

rosservice list

You should see within the list services such as:

/gazebo/apply_body_wrench
/gazebo/apply_joint_effort
/gazebo/clear_body_wrenches
/gazebo/clear_joint_forces
/gazebo/delete_model
/gazebo/get_joint_properties
/gazebo/get_link_properties
/gazebo/get_link_state
/gazebo/get_loggers
/gazebo/get_model_properties
/gazebo/get_model_state
/gazebo/get_physics_properties
/gazebo/get_world_properties
/gazebo/pause_physics
/gazebo/reset_simulation
/gazebo/reset_world
/gazebo/set_joint_properties
/gazebo/set_link_properties
/gazebo/set_link_state
/gazebo/set_logger_level
/gazebo/set_model_configuration
/gazebo/set_model_state
/gazebo/set_parameters
/gazebo/set_physics_properties
/gazebo/spawn_gazebo_model
/gazebo/spawn_sdf_model
/gazebo/spawn_urdf_model
/gazebo/unpause_physics
/rosout/get_loggers
/rosout/set_logger_level

Other ROS Ways To Start Gazebo

There are several rosrun commands for starting Gazebo:

  • rosrun gazebo_ros gazebo

Launched both the server and client together

  • rosrun gazebo_ros gzserver

Launches the Gazebo server only

  • rosrun gazebo_ros gzclient

Launches the Gazebo client only

  • rosrun gazebo_ros debug

Launches the Gazebo server only, in debug mode using GDB

Additionally, you can start Gazebo using roslaunch

 

Erwin said:
Fri, 19 Dec 2014 18:35:13 +0800

When I run sudo apt-get remove ros-groovy-simulator-gazebo, it also wants to remove ros-groovy-desktop-full along with ros-groovy-simulator-gazebo.
Is that right?

Avatar_small
Adam said:
Wed, 14 Jan 2015 23:43:23 +0800

Yes, that's right. 'ros-groovy-desktop-full' is just a dummy package that indicates that all groovy packages are installed.

Erwin said:
Thu, 15 Jan 2015 02:30:38 +0800

Is it ok to have all those removed? Would it cause any problem if I want to run groovy ROS alongside with Gazebo?


Login *


loading captcha image...
(type the code from the image)
or Ctrl+Enter