how send .xml or .yaml to rosserver in c++?

asked 2019-06-22 08:56:47 -0600

yueweiliang gravatar image

updated 2019-06-22 09:53:40 -0600

gvdhoorn gravatar image

hi, I want to send params in .xml or .yaml to the ros param server in my c++ code ? how can I do that, I know ros::param::set() can using a xmlrpcvalue. but I fail to load a .yaml or .xml to a xmlrcpvalue var.or is there other way to make it in c++ ?below is part of my test code.:

  std::string dir = "~/ros_ws/src/laser_filters/params/laser_filters.xml";
  int offset = 0;
  XmlRpc::XmlRpcValue a;
  if(!a.fromXml(dir, &offset)){
    ROS_ERROR("XML FAIL");
    return 0;
  }
  ros::param::set("laser_filters", a);

it always "XML FAIL".the laser_filters.xml is as follow:

<scan_filter_chain>
  <name>right</name>
  <type>laser_filters/LaserScanAngularBoundsFilterInPlace</type>
  <params>
    <lower_angle>-3.15</lower_angle>
    <upper_angle>-2.650496328347194</upper_angle>
  </params>
</scan_filter_chain>
<scan_filter_chain>
  <name>left</name>
  <type>laser_filters/LaserScanAngularBoundsFilterInPlace</type>
  <params>
    <lower_angle>2.680496328347194</lower_angle>
    <upper_angle>3.15</upper_angle>
  </params>
</scan_filter_chain>

anyone any idea?

edit retag flag offensive close merge delete