Exemple #1
0
bool treeFromUrdfFile(const string& file, Tree& tree,const bool consider_root_link_inertia)
{
    ifstream ifs(file.c_str());
    std::string xml_string( (std::istreambuf_iterator<char>(ifs) ),
                       (std::istreambuf_iterator<char>()    ) );

    return treeFromUrdfString(xml_string,tree,consider_root_link_inertia);
}
bool sensorsListFromURDFString(const std::string& urdf_string,
                               iDynTree::SensorsList& output)
{
    // we get first the KDL::CoDyCo::UndirectedTree object,
    // and then we used it to parse also sensors informations.
    KDL::Tree tree;
    bool ok = treeFromUrdfString(urdf_string,tree);

    if( !ok )
    {
        std::cerr << "iDynTree::sensorsListFromURDFString : error in loading urdf  string "
                  << urdf_string << std::endl;
        return false;
    }

    KDL::CoDyCo::UndirectedTree undirected_tree = KDL::CoDyCo::UndirectedTree(tree);

    output = sensorsListFromURDFString(undirected_tree,urdf_string);

    return ok;
}