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

How to represent a 'char' in rosmsg files

asked 2013-08-16 03:11:25 -0500

micheal gravatar image

updated 2014-04-20 14:09:45 -0500

ngrennan gravatar image

I have to represent character(unsigned char) in ros msg files. As mentioned in the wiki, they have primitive types for string, integer, floats but not for the character.

However the wiki does say that char: deprecated alias for uint8 . I do not know what does that mean.

How can I represent something like unsigned char code[N]; from C++ where N=2; into msg format. Would it be uint8[] code. Where do I put in the '2' or I dont have to put it and msg fomat finds out the length of array itself.

Here is the link to wiki for ros msg

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
4

answered 2013-08-16 03:15:20 -0500

felix k gravatar image

Just use a uint8 to store a char in your message type.

edit flag offensive delete link more

Comments

@felix k how would i represent something like "unsigned char code[N];" from C++ where "N=2;" into msg format. Would it be "uint8[] code". Where do I put in the "2" or I dont have to put it and msg fomat finds out the length of array itself.

micheal gravatar image micheal  ( 2013-08-16 03:29:07 -0500 )edit
2

You can put the 2 or not. If you put it, it's fixed length array. If you don't put it, the data will be dynamic length.

dornhege gravatar image dornhege  ( 2013-08-16 03:47:40 -0500 )edit

Question Tools

1 follower

Stats

Asked: 2013-08-16 03:11:25 -0500

Seen: 1,950 times

Last updated: Aug 16 '13