How to parameterize a duration?
I have used the following pattern a number of times, across a variety of packages:
double my_param_seconds;
ros::param::get("~my_param", my_param_seconds);
my_param_ = ros::Duration(my_param_seconds);
This seems awkward compared to parameterizing integers or doubles. It's fine if it's only one or two, but for a safety state machine which has a half-dozen parameterized timeouts, this is a drag. I can write my own little wrapper function, but perhaps something standard already exists?
Alternatively, is it better to simply store the seconds value, and convert that to a ros::Duration
at the point of use?
Thanks.
Can you define "awkward" in this context? I am not sure to understand what you would like to see improved here... Having the possibility to directly retrieve a ros::Duration object from the parameter API?
Sure, have attempted to clarify the question. I know that parameter types are constrained by the XMLRPC types, but I'm wondering if a general Time/Duration helper already exists before I roll my own.