27 catch(YAML::ParserException& e)
29 ROS_ERROR(
"Parse AR markers file failed: %s", e.what());
32 catch(YAML::RepresentationException& e)
34 ROS_ERROR(
"Parse AR Markers file failed: %s", e.what());
37 catch(std::string& e) {
38 ROS_ERROR(
"Parse AR Markers file failed: %s",e.c_str());
44 void getYamlNode(
const std::string& filename, YAML::Node& node)
46 std::ifstream ifs(filename.c_str(), std::ifstream::in);
47 if (ifs.good() ==
false)
49 throw std::string(
"file not found");
52 #ifdef HAVE_NEW_YAMLCPP 53 node = YAML::Load(ifs);
56 parser.GetNextDocument(node);
60 void parseMarkers(
const YAML::Node& node, ar_track_alvar_msgs::AlvarMarkers& ams)
64 for(i = 0; i < node.size(); i++)
67 ar_track_alvar_msgs::AlvarMarker m;
69 node[i][
"id"] >> m.id;
70 node[i][
"frame_id"] >> m.header.frame_id;
71 node[i][
"frame_id"] >> m.pose.header.frame_id;
72 node[i][
"confidence"] >> m.confidence;
73 node[i][
"pose"][
"position"][
"x"] >> m.pose.pose.position.x;
74 node[i][
"pose"][
"position"][
"y"] >> m.pose.pose.position.y;
75 node[i][
"pose"][
"position"][
"z"] >> m.pose.pose.position.z;
76 node[i][
"pose"][
"orientation"][
"x"] >> m.pose.pose.orientation.x;
77 node[i][
"pose"][
"orientation"][
"y"] >> m.pose.pose.orientation.y;
78 node[i][
"pose"][
"orientation"][
"z"] >> m.pose.pose.orientation.z;
79 node[i][
"pose"][
"orientation"][
"w"] >> m.pose.pose.orientation.w;
81 ams.markers.push_back(m);
void getYamlNode(const std::string &filename, YAML::Node &node)
void parseMarkers(const YAML::Node &node, ar_track_alvar_msgs::AlvarMarkers &ams)
bool loadAlvarMarkersFromYaml(const std::string &filename, ar_track_alvar_msgs::AlvarMarkers &ams)