18 #include <boost/algorithm/string.hpp> 27 std::vector<qi::AnyValue> vector_qi;
28 vector_qi.reserve(vector.size());
29 vector_qi.resize(vector.size());
31 std::vector<std::string>::const_iterator it = vector.begin();
32 std::vector<qi::AnyValue>::iterator it_qi = vector_qi.begin();
33 for(; it != vector.end(); ++it, ++it_qi)
35 *it_qi = qi::AnyValue(qi::AnyReference::from(*it),
false,
false);
37 res = qi::AnyValue(qi::AnyReference::from(vector_qi),
false,
false);
39 catch(
const std::exception& e)
41 std::cout <<
"Could not convert to qi::AnyValue \n\tTrace: " << e.what() << std::endl;
51 std::vector<qi::AnyValue> vector_qi;
52 vector_qi.reserve(vector.size());
53 vector_qi.resize(vector.size());
55 std::vector<double>::const_iterator it = vector.begin();
56 std::vector<qi::AnyValue>::iterator it_qi = vector_qi.begin();
57 for(; it != vector.end(); ++it, ++it_qi)
59 *it_qi = qi::AnyValue(qi::AnyReference::from(static_cast<float>(*it)),
false,
false);
61 res = qi::AnyValue(qi::AnyReference::from(vector_qi),
false,
false);
63 catch(
const std::exception& e)
65 std::cout <<
"Could not convert to qi::AnyValue \n\tTrace: " << e.what() << std::endl;
72 std::vector<float> result;
73 qi::AnyReferenceVector anyrefs = value.asListValuePtr();
75 for(
int i=0; i<anyrefs.size(); ++i)
79 result.push_back(anyrefs[i].content().toFloat());
81 catch(std::runtime_error& e)
83 result.push_back(0.0
f);
84 std::cout << e.what() <<
"=> set to 0.0f" << std::endl;
92 std::vector<int> result;
93 qi::AnyReferenceVector anyrefs = value.asListValuePtr();
95 for(
int i=0; i<anyrefs.size();i++)
99 result.push_back(anyrefs[i].content().toInt());
101 catch(std::runtime_error& e)
103 result.push_back(-1);
104 std::cout << e.what() <<
"=> set to -1" << std::endl;
110 std::string
print(
const std::vector <std::string> &vector)
112 std::stringstream ss;
113 if (vector.size() > 0)
115 std::copy(vector.begin(), vector.end()-1, std::ostream_iterator<std::string>(ss,
", "));
116 std::copy(vector.end()-1, vector.end(), std::ostream_iterator<std::string>(ss));
121 std::vector <std::string>
toVector(
const std::string &input)
123 std::vector <std::string> value;
124 boost::split (value, input, boost::is_any_of(
" "));
128 for(std::vector<std::string>::iterator it=value.begin(); it != value.end(); ++it)
138 std::vector <std::string> *joints)
140 if (topicList.
size() == 0)
142 ROS_WARN(
"Mentioned controller does not have joints");
145 for (
int i = 0; i < topicList.
size(); ++i)
147 std::string tmp =
static_cast<std::string
>(topicList[i]);
148 if (tmp.compare(
"") != std::string::npos)
149 joints->push_back(tmp);