Ask Your Question
0

Message definition namespaces

asked 2016-06-28 12:51:42 -0500

vschmidt gravatar image

In message definition naming is the syntax always: package/messagedef.msg

Suppose one wants to have sets of messages for different vehicles (perhaps the hardware is sufficiently different that this makes sense). Is this possible? package/vehicle1/messagedef.msg package/vehicle2/messagedef.msg

Or even package/vehicle1/status/electrical/messagedef.msg package/vehicle2/status/electrical/messagedef.msg

Or does message naming not work in this way?

Thanks,

-Val

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
1

answered 2016-06-28 15:26:14 -0500

updated 2016-06-28 15:29:38 -0500

According to the ROS Messages page:

Message types use standard ROS naming conventions: the name of the package + / + name of the .msg file. For example, std_msgs/msg/String.msg has the message type std_msgs/String.

In your example, it could make sense to make a generic vehicle message say pkgname/GenericVehicle.msg and then create vehicle specific messages for vehicle1 and vehicle2. These specific messages could then have a field entry that is the pkgname/GenericVehicle.msg. In this way you could compose messages that hierarchically depend on each other such that, when used in a client library, could become something like:

msg = pkgname.msg.Vehicle2()
msg.status.electrical.core_electrical_value = 1.0
edit flag offensive delete link more

Comments

Ooo. I didn't see that in the ROS Messages page. And your idea makes sense to me I think. Thanks!

vschmidt gravatar image vschmidt  ( 2016-06-29 05:46:43 -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: 2016-06-28 12:51:42 -0500

Seen: 569 times

Last updated: Jun 28 '16