ros / ros_comm

ROS communications-related packages, including core client libraries (roscpp, rospy, roslisp) and graph introspection tools (rostopic, rosnode, rosservice, rosparam).
http://wiki.ros.org/ros_comm
747 stars 914 forks source link

Where ParameterServer determines parameter type while filling XmlRpcValue? #2276

Open standmit opened 1 year ago

standmit commented 1 year ago

Example code:

#include <ros/ros.h>

int main(int argc, char** argv) {
  ros::init(argc, argv, "paramtype");
  ros::NodeHandle nh;
  XmlRpc::XmlRpcValue value;
  nh.getParam("/ns", value);
  std::cout << value.toXml() << std::endl;
  return 0;
}

Example launch:

<launch>
  <rosparam ns="/ns">
    abc: 2
    def: 3.14
  </rosparam>
  ...
</launch>

Output is:

<value><struct><member><name>abc</name><value><i4>2</i4></value></member><member><name>def</name><value><double>3.1400000000000001</double></value></member></struct></value>

If launch file is just a text. How parameters types was determinated? Where is the related code?