i'm using XmlRpc::XmlRpcValue
to receive data from .yaml file, but it seems that the received data order is different from the order in .yaml file.
here is my .yaml file:
wheelsets:
left_front:
position: [ 0.585, 0.557 ]
<<: &default
steer_offset: 0.0
wheel_radius: 0.1175
right_front:
position: [ 0.585, -0.557 ]
<<: *default
left_back:
position: [ -0.585, 0.557 ]
<<: *default
right_back:
position: [ -0.585, -0.557 ]
<<: *default
and here is my code:
XmlRpc::XmlRpcValue wheelsets;
nh_.getParam("wheelsets", wheelsets);
ROS_ASSERT(wheelsets.getType() == XmlRpc::XmlRpcValue::TypeStruct);
for (const auto& wheelset : wheelsets)
{
ROS_ASSERT(wheelset.second.hasMember("position"));
ROS_ASSERT(wheelset.second["position"].getType() == XmlRpc::XmlRpcValue::TypeArray);
ROS_ASSERT(wheelset.second["position"].size() == 2);
ROS_ASSERT(wheelset.second.hasMember("steer_offset"));
ROS_ASSERT(wheelset.second["steer_offset"].getType() == XmlRpc::XmlRpcValue::TypeDouble);
ROS_ASSERT(wheelset.second.hasMember("wheel_radius"));
ROS_ASSERT(wheelset.second["wheel_radius"].getType() == XmlRpc::XmlRpcValue::TypeDouble);
}
the code can run successfully, but the data i receive is in order of left_back
, left_front
, right_back
, right_front
, which i guess is alphabetical order.
Is there any way to receive data in order same as .yaml file?