Skip to content

Commit

Permalink
minor rebase corrections #2
Browse files Browse the repository at this point in the history
  • Loading branch information
VX792 committed Sep 9, 2021
1 parent 64ebdbe commit febf658
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,8 @@ class ControllerInterface : public rclcpp_lifecycle::node_interfaces::LifecycleN
std::vector<hardware_interface::LoanedStateInterface> state_interfaces_;
std::shared_ptr<rclcpp::Node> node_;
rclcpp_lifecycle::State lifecycle_state_;
int update_rate_ = 0;

};

using ControllerInterfaceSharedPtr = std::shared_ptr<ControllerInterface>;
Expand Down
9 changes: 9 additions & 0 deletions controller_interface/src/controller_interface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,9 @@ const rclcpp_lifecycle::State & ControllerInterface::configure()
case LifecycleNodeInterface::CallbackReturn::FAILURE:
break;
}

update_rate_ = node_->get_parameter("update_rate").as_int();

}
return lifecycle_state_;
}
Expand Down Expand Up @@ -170,4 +173,10 @@ std::shared_ptr<rclcpp::Node> ControllerInterface::get_node()
return node_;
}

int ControllerInterface::get_update_rate() const
{
return update_rate_;
}


} // namespace controller_interface
3 changes: 1 addition & 2 deletions controller_manager/src/controller_manager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1152,9 +1152,8 @@ controller_interface::return_type ControllerManager::update()
rt_controllers_wrapper_.update_and_get_used_by_rt_list();

auto ret = controller_interface::return_type::OK;
int main_update_rate = 100;
update_loop_counter_ += 1;
update_loop_counter_ %= main_update_rate;
update_loop_counter_ %= update_rate_;

for (auto loaded_controller : rt_controller_list) {
// TODO(v-lopez) we could cache this information
Expand Down

0 comments on commit febf658

Please sign in to comment.