Ask Your Question
3

Custom service with custom message

asked 2013-11-19 01:24:56 -0500

makokal gravatar image

updated 2013-11-20 05:21:51 -0500

tfoote gravatar image

Hi All,

I am trying to create a package in which I define my messages and use the same in defining services like

foo_msgs/msg/MS1.msg

foo_msgs/srv/SRV1/srv

where SRV1.srv contains a line with foo_msgs/MS1[] some_name

I have all the dependencies set in CMakeLists.txt file as

set( MESSAGE_DEPENDENCIES
std_msgs
geometry_msgs
)

find_package(catkin REQUIRED 
 COMPONENTS
 message_generation
 ${MESSAGE_DEPENDENCIES}
)

include_directories(${catkin_INCLUDE_DIRS})
link_directories(${catkin_LIBRARY_DIRS})

add_message_files( DIRECTORY msg
FILES
AgentState.msg
AllAgentsState.msg
)

# the services
add_service_files( DIRECTORY srv
  FILES
  SetAgentState.srv
  GetAgentState.srv
  SetAllAgentsState.srv
  GetAllAgentsState.srv
 )

# generate the messages
generate_messages(DEPENDENCIES ${MESSAGE_DEPENDENCIES})

#Declare package run-time dependencies
catkin_package( CATKIN_DEPENDS message_runtime ${MESSAGE_DEPENDENCIES})

But this always fails with this error

/opt/ros/hydro/share/genmsg/cmake/pkg-genmsg.cmake.em:50: error: <class 'genmsg.base.InvalidMsgSpec'>: Invalid declaration: pedsim_msgs/AgentState

I am using Hydro on Ubuntu 12.04.

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
2

answered 2013-11-19 05:56:42 -0500

Dirk Thomas gravatar image

Within you package your service file needs to refer to its own messages without the package name:

AgentState state

instead of:

pedsim_msgs/AgentState state
edit flag offensive delete link more

Comments

While the top example is the normal usage, the other should work, too. I am nearly certain it did with rosbuild. Is this a catkin migration issue that needs to be documented?

joq gravatar imagejoq ( 2013-11-21 04:29:07 -0500 )edit

It is definitely not related to catkin since catkin is not involved in message generation at all. But genmsg was rewritten between Electric and Fuerte. May be in that process this was changed. If someone would like to verify that it was possible before it can be reimplemented again.

Dirk Thomas gravatar imageDirk Thomas ( 2013-11-21 05:51:27 -0500 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2013-11-19 01:24:56 -0500

Seen: 2,660 times

Last updated: Nov 19 '13