Skip to content

Commit

Permalink
fix build with updated ros container, clangd fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
henrygerardmoore committed Nov 26, 2024
1 parent 5182ec0 commit d7c8fae
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 4 deletions.
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ repos:
files: \.(yml|yaml)$

- repo: https://github.com/tcort/markdown-link-check
rev: v3.12.2
rev: v3.13.6
hooks:
- id: markdown-link-check
args:
Expand Down
23 changes: 22 additions & 1 deletion fuse_core/include/fuse_core/callback_wrapper.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,11 @@ namespace fuse_core
class CallbackWrapperBase
{
public:
virtual ~CallbackWrapperBase() = default;
CallbackWrapperBase(CallbackWrapperBase const&) = default;
CallbackWrapperBase(CallbackWrapperBase&&) = default;
CallbackWrapperBase& operator=(CallbackWrapperBase const&) = default;
CallbackWrapperBase& operator=(CallbackWrapperBase&&) = default;
/**
* @brief Call this function. This is used by the callback queue.
*/
Expand All @@ -109,7 +114,12 @@ template <typename T>
class CallbackWrapper : public CallbackWrapperBase
{
public:
virtual ~CallbackWrapper() = default;
using CallbackFunction = std::function<T(void)>;
CallbackWrapper(CallbackWrapper const&) = default;
CallbackWrapper(CallbackWrapper&&) = default;
CallbackWrapper& operator=(CallbackWrapper const&) = default;
CallbackWrapper& operator=(CallbackWrapper&&) = default;

/**
* @brief Constructor
Expand Down Expand Up @@ -153,7 +163,7 @@ inline void CallbackWrapper<void>::call()
class CallbackAdapter : public rclcpp::Waitable
{
public:
explicit CallbackAdapter(std::shared_ptr<rclcpp::Context> context_ptr);
explicit CallbackAdapter(std::shared_ptr<rclcpp::Context> const& context_ptr);

/**
* @brief tell the CallbackGroup how many guard conditions are ready in this waitable
Expand Down Expand Up @@ -183,6 +193,17 @@ class CallbackAdapter : public rclcpp::Waitable

void removeAllCallbacks();

void set_on_ready_callback(std::function<void(size_t, int)> /*callback*/) override
{
}
void clear_on_ready_callback() override
{
}
std::shared_ptr<void> take_data_by_entity_id(size_t /*id*/) override
{
return nullptr;
}

private:
rcl_guard_condition_t gc_; //!< guard condition to drive the waitable

Expand Down
4 changes: 2 additions & 2 deletions fuse_core/src/callback_wrapper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,12 @@
namespace fuse_core
{

CallbackAdapter::CallbackAdapter(std::shared_ptr<rclcpp::Context> context_ptr)
CallbackAdapter::CallbackAdapter(std::shared_ptr<rclcpp::Context> const& context_ptr)
: gc_(rcl_get_zero_initialized_guard_condition())
{
rcl_guard_condition_options_t guard_condition_options = rcl_guard_condition_get_default_options();

// Guard condition is used by the wait set to handle execute-or-not logic
gc_ = rcl_get_zero_initialized_guard_condition();
if (RCL_RET_OK != rcl_guard_condition_init(&gc_, context_ptr->get_rcl_context().get(), guard_condition_options))
{
throw std::runtime_error("Could not init guard condition for callback waitable.");
Expand Down

0 comments on commit d7c8fae

Please sign in to comment.