Ask Your Question
1

How to represent a 'char' in rosmsg files

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

micheal gravatar image

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

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 -0600

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 imagemicheal ( 2013-08-16 03:29:07 -0600 )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 imagedornhege ( 2013-08-16 03:47:40 -0600 )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: 2013-08-16 03:11:25 -0600

Seen: 914 times

Last updated: Aug 16 '13