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

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:

info:
    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

Comments

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
1

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

Comments

I tried here and look that it works fine.

Teo Cardoso gravatar image Teo Cardoso  ( 2020-04-05 12:36:27 -0500 )edit

Question Tools

1 follower

Stats

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

Seen: 456 times

Last updated: Apr 05 '20