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

rook's profile - activity

2021-06-11 09:10:10 -0500 received badge  Good Question (source)
2020-12-18 12:36:00 -0500 received badge  Nice Question (source)
2018-02-15 00:31:11 -0500 received badge  Famous Question (source)
2017-09-12 20:17:09 -0500 marked best answer getParam a nested std::map

I am writing a node that will read a YAML file (loaded from roslaunch) with the following structure:

home:
  1:
    "x": 0.0
    "y": 0.0
    "z": 0.0
    "qx": 0.0
    "qy": 0.0
    "qz": 0.0
    "qw": 0.0
  2:
    "x": 0.0
    "y": 0.0
    "z": 0.0
    "qx": 0.0
    "qy": 0.0
    "qz": 0.0
    "qw": 0.0

This is the relevant code on the node side:

class RouteParserNode
{
    public:
        RouteParserNode() :
            nh_private_("~")
        {
            nh_private_.getParam("home", route_home);
        };
        ~RouteParserNode();
     private:
        std::map<int, std::map<std::string, double>> route_home;
        ros::NodeHandle nh_private_;
};

However, the above node cannot be compiled and gives the following error:

error: no matching function for call to ‘ros::NodeHandle::getParam(const char 
[5], std::map<int, std::map<std::basic_string<char>, double> >&)’
             nh_private_.getParam("home", route_home);

which I assume is because getParam does not work for nested std::maps.

I am currently on ROS Indigo.

Is there a workaround for this, or another way for me to parse the file? My ultimate goal is to supply a list of goals (geometry_msgs/PoseStamped, but only primitive types were allowed for the std::map method hence the above yaml structure).

2017-07-16 02:36:42 -0500 received badge  Notable Question (source)
2017-07-16 02:26:50 -0500 received badge  Popular Question (source)
2017-07-11 08:11:52 -0500 received badge  Student (source)
2017-07-11 05:43:32 -0500 asked a question getParam a nested std::map

getParam a nested std::map I am writing a node that will read a YAML file (loaded from roslaunch) with the following str

2017-07-11 05:42:56 -0500 received badge  Organizer (source)
2017-06-16 05:31:12 -0500 received badge  Enthusiast