void poseStrSplit(const std::string& str, const std::string& splits, std::vector<double>& pose)
{
std::vector<std::string> res{};
if (str == "")
return;
std::string strs = str + splits;
size_t pos = strs.find(splits);
int step = splits.size();
while (pos != strs.npos) {
std::string temp = strs.substr(0, pos);
res.push_back(temp);
strs = strs.substr(pos + step, strs.size());
pos = strs.find(splits);
}
for (auto s : res) {
double c = atof(s.c_str());
pose.push_back(c);
}
pose.pop_back();
}
int main()
{
std::string pose = "0.5,-0.1,0.3,-3.13,0,1.57,";
std::vector<double> res{};
poseStrSplit(pose, ",", res);
for (int i = 0; i < res.size(); i++) {
std::cout << res[i] << std::endl;
}
}