icub-models icon indicating copy to clipboard operation
icub-models copied to clipboard

Document in the README how the models can be find using YARP and ROS in C++ code

Open traversaro opened this issue 4 years ago • 0 comments

This repo contains models for the iCub robots and installs them to be found easily by YARP and ROS resource locator infrastructure. However, for a novice user it may be not obvious how to find such models in YARP and ROS from C++. It would be nice to document this with simple snippets in the README, for example for YARP:

// This is typically set in the environment and not set in code
// See https://github.com/robotology/yarp/issues/593 for a related issue
setenv("YARP_ROBOT_NAME", "iCubGazeboV2_5_visuomanip");
std::string pathToModel =  yarp::os::ResourceFinder::getResourceFinderSingleton().findFileByName("model.urdf");

Or ROS1:

std::string icub_package_path = ros::package::getPath("iCub");
std::string icub_model_path = icub_package_path + "robots/iCubGazeboV2_5_visuomanip/model.urdf"

And so on so forth.

traversaro avatar Jun 05 '21 12:06 traversaro