Hi,
I want to extract some lists with double values.
Because it is a nested array, it is not readable with NodeHandle getParam?
ros::NodeHandle nh;
XmlRpc::XmlRpcValue box;
nh.getParam("test/values", box);
if(box.getType() == XmlRpc::XmlRpcValue::Type::TypeArray && box.size() > 0 )){
if(box[0].getType() == XmlRpc::XmlRpcValue::Type::TypeArray && box[0].size() > 0){
for(int i = 0; i < box[0].size(); i++) {
ROS_INFO("value %f ",box[0][i]);
}
}}
yaml file:
test:
values:
- [ 0.0, 0.1, 0.2]
- [ 0.0, -0.1, -0.2]
At this point, how can I get the double value?
Error message:
warning: format ‘%f’ expects argument of type ‘double’, but argument 8 has type ‘XmlRpc::XmlRpcValue’ [-Wformat=]
box[0][i].getDoubleFormat() returned %.16g, so it should be correct.
But an assert failed with
ROS_ASSERT(box[0][i].getType() == XmlRpc::XmlRpcValue::TypeDouble);
Originally posted by zFnq9 on ROS Answers with karma: 3 on 2020-04-19
Post score: 0