Quantcast
Viewing latest article 7
Browse Latest Browse All 40

String parameter is ignored if numeric, why?

I am requesting a string parameter from the parameter server in ROS Groovy like this: ros::NodeHandle node_ns("~"); std::string rotations; node_ns.param("rotations", rotations, std::string("0")); When I run my ROS node with the following command line, everything works fine: ./bin/testnode _rotations:='90 -90 0' i.e. if I check the value of the string "rotations", it is "90 -90 0". However, if I only input a single numeric value as the string's value, ./bin/testnode _rotations:='270' the supplied value is ignored and "rotations" has its default value of "0". I think this occurs because the single value is treated as an integer instead of a string. Is this a bug? This can have pretty nasty consequences! I was debugging my code for over an hour trying to figure out why my supplied parameter value was being ignored although it had worked perfectly in other cases...

Viewing latest article 7
Browse Latest Browse All 40

Trending Articles