Skip to content

Commit febf658

Browse files
committed
minor rebase corrections #2
1 parent 64ebdbe commit febf658

File tree

3 files changed

+12
-2
lines changed

3 files changed

+12
-2
lines changed

controller_interface/include/controller_interface/controller_interface.hpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff 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

160162
using ControllerInterfaceSharedPtr = std::shared_ptr<ControllerInterface>;

controller_interface/src/controller_interface.cpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff 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

controller_manager/src/controller_manager.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff 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

0 commit comments

Comments
 (0)