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

Message Types Case Sensitve?

asked 2018-06-29 06:56:27 -0500

3Towers International gravatar image

Are message types or names in ROS supposed to be case sensitive? That is, are uint64 and Uint64 the same or different? Are Std_Msgs and std_msgs the same or different? Thank you.

edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted
1

answered 2018-06-29 09:28:54 -0500

updated 2018-06-29 13:33:37 -0500

Message types and package names are case sensitive in both C++ and Python in ROS, so each of the examples you give will be different. If you try to use different cases, you will get compile errors in C++ (saying it can't find the header file you're trying to include) and import errors in Python, so it won't let you get very far using a different case.

EDIT: As a summary of the comment thread, there is a difference between the message types (e.g. UInt64.msg) and the primitive types that define the data attributes on those messages (e.g. uint64). It is indicated on the documentation for the std_msgs package that those messages are not intended for long-term use, since they each name their data attributes "data", and that it is better to define your own with more descriptive names for the data stored on the message. It seems the std_msgs messages are more intended to show what primitive data types are available, and how to include them in your own message definitions.

edit flag offensive delete link more

Comments

That was my first belief. And if we look at the package names, this may hold because all of them are in lowercase chars, such as geometry_msgs.However, while the msg files are in First letter cap, or camel case, the specification is all in lowercase. Example Uint64.msg but uint64 in format specs.

3Towers International gravatar image 3Towers International  ( 2018-06-29 11:07:19 -0500 )edit
3

The two types you mention (UInt64.msg and uint64) are not the same. One is a message, the other a primitive.

gvdhoorn gravatar image gvdhoorn  ( 2018-06-29 11:43:28 -0500 )edit

When will you use the UInt64.msg? All I have seen are uint64 declaring field types? Maybe, we could use the UInt64 msg directly in some connections. It just makes me wonder, and confused, that all packages I saw would still create a userMessage defining one field of primitive type, tho name not data

3Towers International gravatar image 3Towers International  ( 2018-06-29 12:04:36 -0500 )edit
1

It says in the documentation for std_msgs that those messages are not intended for long-term use. I suspect they are intended to show you which primitive types are available and how to build up your own messages from them.

adamconkey gravatar image adamconkey  ( 2018-06-29 12:27:57 -0500 )edit

Thanks everyone!

3Towers International gravatar image 3Towers International  ( 2018-06-29 12:29:40 -0500 )edit

@aconkey: std_msgs is not really 'an example'. You cannot publish primitive types, so they need to be wrapped in a msg. If you do that, you get std_msgs. The remark about it being better to design your own msgs is about semantics: if you see a topic that carries a UInt64, can you tell ..

gvdhoorn gravatar image gvdhoorn  ( 2018-06-30 01:08:29 -0500 )edit

.. me what the data it carries means? I'm pretty sure your first question would be: "well, what does the uint64 encode?". And that is exactly the problem. Without asking the author, reading documentation or code, you wouldn't know.

Semantically meaningful msgs try to address this, as the ..

gvdhoorn gravatar image gvdhoorn  ( 2018-06-30 01:09:50 -0500 )edit

.. msg itself contains msg fields with descriptive names that on their own give you enough information to be able to interpret it.

That is obviously the idea, whether it always works is something else, but you'll at least stand a better chance with a proper msg than with a UInt64.

gvdhoorn gravatar image gvdhoorn  ( 2018-06-30 01:11:51 -0500 )edit
1

answered 2018-06-29 08:33:40 -0500

This is a programming language question as opposed to ROS question. Both C/C++ and Python are case sensitive, therefore messages types are as well.

edit flag offensive delete link more

Comments

That was my first belief. And if we look at the package names, this may hold because all of them are in lowercase chars, such as geometry_msgs.However, while the msg files are in First letter cap, or camel case, the specification is all in lowercase. Example Uint64.msg but uint64 in format specs.

3Towers International gravatar image 3Towers International  ( 2018-06-29 11:07:31 -0500 )edit

Question Tools

1 follower

Stats

Asked: 2018-06-29 06:56:27 -0500

Seen: 348 times

Last updated: Jun 29 '18