Gazebo | Ignition | Community
Ask Your Question

What are the things to be included in the CMakeLists.txt file for using gazebo plugins with ROS?

asked 2016-06-14 15:04:52 -0500

vatsal gravatar image

I want a plugin for using camera in gazebo with ros integration. I already have the .cpp file for the plugin but dont know what all is to be included in the CMakeLists.txt file. Please Help!

edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted

answered 2016-06-23 14:23:34 -0500

m4k gravatar image

updated 2016-06-23 14:31:36 -0500

if you are "just" looking for the CMakeList.txt see below. It also depends on your plugin what 'includes/packages' are required. In addition you need your program to be in a catkin / ros package. (see the tutorial link below)

cmake_minimum_required(VERSION 2.8.3)

# Load catkin and all dependencies required for this package
find_package(catkin REQUIRED COMPONENTS 

# Depend on system install of Gazebo
find_package(gazebo REQUIRED)

include_directories(${Boost_INCLUDE_DIR} ${catkin_INCLUDE_DIRS} ${GAZEBO_INCLUDE_DIRS})

add_library(${PROJECT_NAME} src/simple_world_plugin.cpp)
target_link_libraries(${PROJECT_NAME} ${catkin_LIBRARIES} ${GAZEBO_LIBRARIES})


As mentioned previously you should go through the tutorial. This is from where I got the above code:

To understand the CMakeList file, read here:

edit flag offensive delete link more

answered 2016-06-14 17:50:30 -0500

The tutorial on plugins demonstrates a simple CmakeLists.txt for a gazebo plugin

If you want to use ros as well you will some of the cmake from that as well. There are some examples, such as the hector and turtlbot gazebo plugins which you can look at as well.

edit flag offensive delete link more

Question Tools

1 follower


Asked: 2016-06-14 15:04:52 -0500

Seen: 4,317 times

Last updated: Jun 23 '16