ros message type conversion to c++ type

asked 2014-05-29 21:09:48 -0500

dalishi gravatar image

updated 2014-05-29 21:14:44 -0500


Simply put my question.

I have a myself defined message locally using the date type uint32


uint32 id

and with the auto-generated c++ code I can have a message object defined in my source code, just like IDMessage msg; Now I want to fetch some value from the parameter server and give it to the id of the msg object, something like

int id_int;

ros::NodeHandle::getParam("ID", id_int); = id_int;

The problem is the getParam can only take in parameter types like int, so I can not define a uint32 id_uint32 and get the value from the server.

So is there any way can solve this conversion = id_int;, which is from int to uint32? Should I do some cast?

edit retag flag offensive close merge delete


What's wrong with casting to an unsigned int?

sterlingm gravatar image sterlingm  ( 2014-05-30 08:58:14 -0500 )edit