ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | Q&A
Ask Your Question

Question about custom-made message

asked 2019-11-11 08:02:34 -0500

kane_choigo gravatar image

updated 2019-11-11 08:02:56 -0500

Hello! I'm using ROS kinetic on ubuntu 16.04.

And I'm going to make my own message consisting of many sub-custom messages.

The sub-messages are in the right directory where any other messages are defined.

Below is a sample of the messages.

my_msgs/StateError          stateError              # error for state
my_msgs/EvalCovariance      evalCovariance          # validate covariance

and my_msgs is the name of the directory. (In other words, StateErrormessages and EvalCovariance messages are all in the my_msgs directory.)

In this case, is it mandatory to drop my_msgstags because they're all in the same directory?? (like this)

EvalCovariance      evalCovariance          # validate covariance
StateError          stateError              # error for state

Thanks in advance :)

edit retag flag offensive close merge delete

1 Answer

Sort by » oldest newest most voted

answered 2019-11-12 04:41:05 -0500

mali gravatar image

to define a message based on different messages (sub-messages) that are defined in same package you have two options:

  1. you drop the package name before these messages because the sub-messages are defined in same package
StateError         stateError
EvalCovariance     evalCovariance
  1. you indicate the package_name before these sub-messages (not the directory_name) :
package_name/StateError         stateError
package_name/EvalCovariance     evalCovariance

so, if my_msgs is your package_name, both samples you wrote in the question are valid. But, if my_msgs is just a directory_name then you need to use the second sample without attaching my_msgs/

edit flag offensive delete link more


Thank you so much for your short and clear advice. I really appreciate it.

kane_choigo gravatar image kane_choigo  ( 2019-11-12 18:01:46 -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


Asked: 2019-11-11 08:02:34 -0500

Seen: 100 times

Last updated: Nov 12 '19