ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

Revision history [back]

Unfortunately there is not such as direct conversion. However this sounds like a nice improvement.

The get function is defined in rosparam.h.

If you add the missing overloading:

ROSCPP_DECL bool get(const std::string& key, ros::Duration& s);

...the templated get will automagically use it. This should even work if you define this function in your own C++ source file (considering you keep the same namespace). Hence, you can fork the project on GitHub, submit a pull request providing the additional getter. In the meanwhile (i.e. until a new version of roscomm is released), you can check the ROS version and provide the overloading yourself for older ROS versions.

As ROS relies on Boost.DateTime to store time-related values, I suggest you use the Boost.DateTime API in the get function to ensure a consistent parsing.