File tree Expand file tree Collapse file tree 1 file changed +11
-7
lines changed
hardware_interface/include/hardware_interface Expand file tree Collapse file tree 1 file changed +11
-7
lines changed Original file line number Diff line number Diff line change @@ -187,6 +187,16 @@ class HardwareComponentInterface : public rclcpp_lifecycle::node_interfaces::Lif
187187 try
188188 {
189189 publish_rate = hardware_interface::stod (it->second );
190+
191+ if (publish_rate < 0.0 )
192+ {
193+ RCLCPP_ERROR (
194+ get_logger (),
195+ " 'status_publish_rate' cannot be negative (got %.lf). Please fix your hardware "
196+ " parameters." ,
197+ publish_rate);
198+ return CallbackReturn::ERROR;
199+ }
190200 }
191201 catch (const std::invalid_argument &)
192202 {
@@ -196,13 +206,7 @@ class HardwareComponentInterface : public rclcpp_lifecycle::node_interfaces::Lif
196206 }
197207 }
198208
199- if (publish_rate == 0.0 )
200- {
201- RCLCPP_INFO (
202- get_logger (),
203- " `status_publish_rate` is set to 0.0, hardware status publisher will not be created." );
204- }
205- else
209+ if (publish_rate > 0.0 )
206210 {
207211 control_msgs::msg::HardwareStatus status_msg_template;
208212 if (init_hardware_status_message (status_msg_template) != CallbackReturn::SUCCESS)
You can’t perform that action at this time.
0 commit comments