Added publish period attribute as a parameter #71
Conversation
Thank you for the pull request! Would you need this parameter to not be read-only? For something like a publishing period, maybe it would be preferable to declare the parameter as read-only (see https://github.com/ros2/rcl_interfaces/blob/master/rcl_interfaces/msg/ParameterDescriptor.msg and |
Sure, where I should document the meaning and units of this parameter? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The parameter along with its default value should be documented within the README.
Otherwise this LGTM. Thanks for your contribution!
descriptor.read_only = true; | ||
declare_parameter("publish_period", publish_period_.count(), descriptor); | ||
if (get_parameter("publish_period", publish_period_param)) { | ||
publish_period_ = std::chrono::milliseconds(publish_period_param); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
publish_period_ = std::chrono::milliseconds(publish_period_param); | |
publish_period_ = std::chrono::milliseconds{publish_period_param}; |
int publish_period_param = 0; | ||
rcl_interfaces::msg::ParameterDescriptor descriptor; | ||
descriptor.read_only = true; | ||
declare_parameter("publish_period", publish_period_.count(), descriptor); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: It might be useful to extract "publish_period"
into a constant
We're working on making all the node constructors use |
Not sure if you're planning on it, but it would be great to have those changes in a separate PR :-) |
@ahcorde I think it would be good to document the parameter in the ParameterDescriptor directly. See the field |
closing this PR, this other PR #73 is more complete |
By default the publish rate is hardcoded to 1 minute
This PR allows to change this value using ROS 2 parameters