From aa276d06ad5317582d9bb5fc9098567098c58ce2 Mon Sep 17 00:00:00 2001 From: Naoki-Hiraoka Date: Thu, 6 Oct 2022 17:52:51 +0900 Subject: [PATCH] [euscollada/collada2eus_urdfmodel.cpp] set limb_candidates from "limbs" key in yaml --- euscollada/src/collada2eus_urdfmodel.cpp | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/euscollada/src/collada2eus_urdfmodel.cpp b/euscollada/src/collada2eus_urdfmodel.cpp index d34aee2c..4087f8cb 100644 --- a/euscollada/src/collada2eus_urdfmodel.cpp +++ b/euscollada/src/collada2eus_urdfmodel.cpp @@ -593,7 +593,7 @@ void ModelEuslisp::printMesh(const aiScene* scene, const aiNode* node, const Vec bool limb_order_asc(const pair& left, const pair& right) { return left.second < right.second; } void ModelEuslisp::readYaml (string &config_file) { // read yaml - std::vector limb_candidates; // limb names is given from yaml fiels + std::vector limb_candidates{"torso", "larm", "rarm", "lleg", "rleg", "head"}; // default candidates of limb names vector > limb_order; #ifndef USE_CURRENT_YAML @@ -609,14 +609,13 @@ void ModelEuslisp::readYaml (string &config_file) { // yaml-cpp is greater than 0.5.0 doc = YAML::LoadFile(config_file.c_str()); #endif - // set limb_candidates from yaml fiels - for(YAML::const_iterator it=doc.begin();it != doc.end();++it) { - // -end-coords, *-vector - if ( boost::algorithm::ends_with(it->first.as(), "-coords") || - boost::algorithm::ends_with(it->first.as(), "-vector") ) { - } else { - limb_candidates.push_back(it->first.as()); - } +#ifdef USE_CURRENT_YAML + if (doc["limbs"]) { +#else + if ( doc.FindValue("limbs") ) { +#endif + // set limb_candidates from yaml files + limb_candidates = doc["limbs"].as >(); } /* re-order limb name by lines of yaml */ BOOST_FOREACH(string& limb, limb_candidates) {