robotology / icub-models

Official URDF and SDF models of the iCub humanoid robot.
Creative Commons Attribution Share Alike 4.0 International
33 stars 34 forks source link

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

Open traversaro opened 3 years ago

traversaro commented 3 years ago

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.