Rosanswers logo

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, StateError messages 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 :)

Originally posted by kane_choigo on ROS Answers with karma: 195 on 2019-11-11

Post score: 0


1 Answer 1


Rosanswers logo

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/

Originally posted by mali with karma: 146 on 2019-11-12

This answer was ACCEPTED on the original site

Post score: 1

Original comments

Comment by kane_choigo on 2019-11-12:
Thank you so much for your short and clear advice. I really appreciate it.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.