ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | Q&A
Ask Your Question

yaml parse hex data error

asked 2020-04-04 10:37:53 -0500

andersonHu gravatar image

updated 2020-04-04 12:08:14 -0500

gvdhoorn gravatar image

I have a yaml file like this:

    id: 0x120

when i loaded the param in my cpp, i define a uint32_t variable id and set it based on the yaml file:

uint32_t id;
ros::param::get("/info/id", id);

when compile the project , the following errors occured: anyone can help me ,tks very much.

/home/888/xxx.cpp:64:69: error: no matching function for call to ‘get(const char [39], uint32_t&)’
     ros::param::get("/info/id", id_);
In file included from /opt/ros/melodic/include/ros/ros.h:54:0,
                 from /home/888/xxx.cpp:7:
edit retag flag offensive close merge delete


This is not a yaml parsing error, but a C++ compilation error.

gvdhoorn gravatar image gvdhoorn  ( 2020-04-04 12:08:47 -0500 )edit

1 Answer

Sort by » oldest newest most voted

answered 2020-04-05 08:18:10 -0500

Weasfas gravatar image

As @gvdhoorn commented,

This is a compilation issue regarding the definition of the get method in the ros::param namespace. If you take a look at the class documentation here, there is no get function matching the uint32_t data type. You way want to change that to int and then perform a static_cast to uint32_t.

edit flag offensive delete link more


I tried here and look that it works fine.

Teo Cardoso gravatar image Teo Cardoso  ( 2020-04-05 12:36:27 -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


Asked: 2020-04-04 10:37:53 -0500

Seen: 340 times

Last updated: Apr 05 '20