File tree Expand file tree Collapse file tree 3 files changed +12
-2
lines changed
include/controller_interface Expand file tree Collapse file tree 3 files changed +12
-2
lines changed Original file line number Diff line number Diff line change @@ -155,6 +155,8 @@ class ControllerInterface : public rclcpp_lifecycle::node_interfaces::LifecycleN
155155 std::vector<hardware_interface::LoanedStateInterface> state_interfaces_;
156156 std::shared_ptr<rclcpp::Node> node_;
157157 rclcpp_lifecycle::State lifecycle_state_;
158+ int update_rate_ = 0 ;
159+
158160};
159161
160162using ControllerInterfaceSharedPtr = std::shared_ptr<ControllerInterface>;
Original file line number Diff line number Diff line change @@ -64,6 +64,9 @@ const rclcpp_lifecycle::State & ControllerInterface::configure()
6464 case LifecycleNodeInterface::CallbackReturn::FAILURE:
6565 break ;
6666 }
67+
68+ update_rate_ = node_->get_parameter (" update_rate" ).as_int ();
69+
6770 }
6871 return lifecycle_state_;
6972}
@@ -170,4 +173,10 @@ std::shared_ptr<rclcpp::Node> ControllerInterface::get_node()
170173 return node_;
171174}
172175
176+ int ControllerInterface::get_update_rate () const
177+ {
178+ return update_rate_;
179+ }
180+
181+
173182} // namespace controller_interface
Original file line number Diff line number Diff line change @@ -1152,9 +1152,8 @@ controller_interface::return_type ControllerManager::update()
11521152 rt_controllers_wrapper_.update_and_get_used_by_rt_list ();
11531153
11541154 auto ret = controller_interface::return_type::OK;
1155- int main_update_rate = 100 ;
11561155 update_loop_counter_ += 1 ;
1157- update_loop_counter_ %= main_update_rate ;
1156+ update_loop_counter_ %= update_rate_ ;
11581157
11591158 for (auto loaded_controller : rt_controller_list) {
11601159 // TODO(v-lopez) we could cache this information
You can’t perform that action at this time.
0 commit comments