コード例 #1
0
    void WindowsManager::addUrdfObjects (const char* urdfNameCorba,
            const char* urdfPathCorba,
            const char* urdfPackagePathCorba,
            bool visual)
    {
        const std::string urdfName (urdfNameCorba);
        const std::string urdfPath (urdfPathCorba);
        const std::string urdfPackagePath (urdfPackagePathCorba);
        if (urdfName == "") {
            throw std::runtime_error ("Parameter nodeName cannot be empty in "
                    "idl request addUrdfObjects.");
        }
        if (nodes_.find (urdfName) != nodes_.end ()) {
            std::ostringstream oss;
            oss << "You need to chose an other name, \"" << urdfName
                << "\" already exist.";
            throw std::runtime_error (oss.str ());
        }
	mtx_.lock();
        GroupNodePtr_t urdf = urdfParser::parse
            (urdfName, urdfPath, urdfPackagePath,
             visual ? "visual" : "collision", "object");
        NodePtr_t link;
        for (int i=0; i< urdf->getNumOfChildren (); i++) {
            link = urdf->getChild (i);
            nodes_[link->getID ()] = link;
        }
        WindowsManager::initParent (urdfName, urdf);
        addGroup (urdfName, urdf);
	mtx_.unlock();
    }
コード例 #2
0
 bool WindowsManager::addUrdfCollision (const char* urdfNameCorba,
         const char* urdfPathCorba, const char* urdfPackagePathCorba)
 {
     const std::string urdfName (urdfNameCorba);
     const std::string urdfPath (urdfPathCorba);
     const std::string urdfPackagePath (urdfPackagePathCorba);
     if (nodes_.find (urdfName) != nodes_.end ()) {
         std::cout << "You need to chose an other name, \"" << urdfName
             << "\" already exist." << std::endl;
         return false;
     }
     else {
         mtx_.lock();
         GroupNodePtr_t urdf = urdfParser::parse
             (urdfName, urdfPath, urdfPackagePath, "collision");
         NodePtr_t link;
         for (int i=0; i< urdf->getNumOfChildren (); i++) {
             link = urdf->getChild (i);
             nodes_[link->getID ()] = link;
         }
         WindowsManager::initParent (urdfName, urdf);
         addGroup (urdfName, urdf);
         mtx_.unlock();
         return true;
     }
 }