ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
0

gazebo msgs

asked 2014-04-20 05:10:41 -0500

RSA gravatar image

I want to publish a gazebo_msgs ( topic) NOT service using .cpp code as a node I wrote the code, but I dont know what to add in the Cmakelist in these sections:

  find_package(catkin REQUIRED COMPONENTS
  nav_msgs
  roscpp 
   ...../// what should I write here 
 }

// second

catkin_package(
#  INCLUDE_DIRS include
#  LIBRARIES rosaria_nav
 CATKIN_DEPENDS message_runtime nav_msgs roscpp sensor_msgs ***gazebo_msgs***
 // is it right ????? 
 #  DEPENDS system_lib
)

// third

generate_messages(
 DEPENDENCIES
 geometry_msgs  sensor_msgs nav_msgs visualization_msgs gazebo_msgs
)

// forth

I added the following

add_executable(SetModelState src/SetModelState.cpp)
add_dependencies(SetModelState ${PROJECT_NAME}_gencfg ${PROJECT_NAME}_generate_messages_cpp)  
target_link_libraries(SetModelState
 ${catkin_LIBRARIES}
 ${Boost_LIBRARIES}
)

//fifth in the .cpp file ( the node ), I added the following library

 #include <gazebo_msgs/SetModelState.h>
edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2014-04-20 23:06:26 -0500

fergs gravatar image

In the first section, you definitely need to add the "gazebo_msgs" package to the list of packages to find with "find_package" -- otherwise you won't be able to find the SetModelState.h

Adding "gazebo_msgs" to the CATKIN_DEPENDS in #2 is ok, but possibly not required. (technically this would be required if you had header files that referenced gazebo_msgs header files, and thus a package depending on yours would need to know about gazebo_msgs -- even if you aren't doing this, adding it to the CATKIN_DEPENDS really won't hurt anybody)

The third block is only required if you are actually creating new messages in this package -- are you? Even then, to actually required gazebo_msgs, you would have to have defined your own message that uses a gazebo_msgs message within it.

The fourth block seems fine -- again though, if you don't have custom messages, you won't need the "add_dependency" line.

edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2014-04-20 05:10:41 -0500

Seen: 1,203 times

Last updated: Apr 20 '14