How to convert XmlRpc::XmlRpcValue into string?
Hello All,
I am trying to extract topic name as strings from a "yaml" file. The goal is depicted here:
http://answers.ros.org/question/3289/how-to-write-and-parse-yaml-file-for-ros
I think that I have succeeded to receive the list as XmlRpc::XmlRpcValue class, but I am not succeeding to convert this to a string format.
I have tried to do it in two different ways:
for (int32_t i = 0; i < my_list.size(); ++i)
{
printf ( "Topic %d is: %s.\n", i, static_cast<std::string>(my_list[i]) );
}
if ( my_list.stringFromXml ( topicsList, &offset ) == TRUE )
{
printf ("\"topic_list = \"%s", topicsList );
}
The first way doesn´t compiles, and the second doesn´t run...
The two relevant links, I have found, that are connected to this problem are:
- http://www.ros.org/wiki/roscpp/Overview/Parameter%20Server (roll till the end of the page).
- http://xmlrpcpp.sourceforge.net/doc/classXmlRpc_1_1XmlRpcValue.html
Both of them doesn´t really help me.
Here is also the code for getting my_list:
ros::NodeHandle nh;
XmlRpc::XmlRpcValue my_list;
nh.getParam("topic_list", my_list);
if ( my_list.stringFromXml ( topicsList, &offset ) == TRUE )
{
printf ("\"topic_list = \"%s", topicsList );
}
While topic_list is the name of the list in "yaml" file:
topic_list:
- /bb2/left/image_rect
- /bb2/right/image_rect
Thanks in advance, Felix.