Skip to content

Commit

Permalink
got humble building
Browse files Browse the repository at this point in the history
  • Loading branch information
henrygerardmoore committed Dec 12, 2024
1 parent b1273fa commit 22cec8d
Show file tree
Hide file tree
Showing 28 changed files with 569 additions and 107 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ on:
# Run when a commit is pushed to main
push:
branches:
- main
- humble

permissions:
# Allow reading the source code
Expand Down Expand Up @@ -61,7 +61,7 @@ jobs:
steps:
- name: Unit test workspace
run: |
. /opt/ros/rolling/setup.sh
. /opt/ros/humble/setup.sh
. /colcon_ws/install/local_setup.sh
colcon test --event-handlers console_direct+ --packages-select-regex fuse*
working-directory: /colcon_ws
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/pre-commit.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ on:
pull_request:
push:
branches:
- main
- humble

jobs:
pre-commit:
Expand Down
6 changes: 3 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Docker setup that's used for CI.

FROM osrf/ros:rolling-desktop-full
FROM osrf/ros:humble-desktop-full

# Install external packages.
# hadolint ignore=DL3008
Expand All @@ -11,7 +11,7 @@ RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \
clang-tidy \
python3-vcstool \
# use cyclonedds instead of fastdds
ros-rolling-rmw-cyclonedds-cpp
ros-humble-rmw-cyclonedds-cpp

# Create the colcon ws. For now, copy the source files into the workspace
# so that we don't have to deal with cloning this repo, which is private.
Expand All @@ -22,7 +22,7 @@ WORKDIR /colcon_ws
RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \
--mount=type=cache,target=/var/lib/apt,sharing=locked \
apt-get update && apt-get upgrade -y && \
. /opt/ros/rolling/setup.sh && \
. /opt/ros/humble/setup.sh && \
rosdep install --from-paths src -y --ignore-src && \
colcon build --mixin compile-commands coverage-gcc coverage-pytest

Expand Down
2 changes: 1 addition & 1 deletion entrypoint.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/bash

source /opt/ros/rolling/setup.bash
source /opt/ros/humble/setup.bash

if [ -f /colcon_ws/install/local_setup.bash ]
then
Expand Down
6 changes: 3 additions & 3 deletions fuse_core/include/fuse_core/callback_wrapper.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -169,19 +169,19 @@ class CallbackAdapter : public rclcpp::Waitable
/**
* @brief tell the CallbackGroup that this waitable is ready to execute anything
*/
bool is_ready(rcl_wait_set_t const& wait_set) override;
bool is_ready(rcl_wait_set_t* wait_set) override;

/**
* @brief add_to_wait_set is called by rclcpp during NodeWaitables::add_waitable() and
* CallbackGroup::add_waitable()
waitable_ptr = std::make_shared<CallbackWrapper>();
node->get_node_waitables_interface()->add_waitable(waitable_ptr, (rclcpp::CallbackGroup::SharedPtr) nullptr);
*/
void add_to_wait_set(rcl_wait_set_t& wait_set) override;
void add_to_wait_set(rcl_wait_set_t* wait_set) override;

std::shared_ptr<void> take_data() override;

void execute(std::shared_ptr<void> const& data) override;
void execute(std::shared_ptr<void>& data) override;

void addCallback(const std::shared_ptr<CallbackWrapperBase>& callback);

Expand Down
148 changes: 124 additions & 24 deletions fuse_core/include/fuse_core/node_interfaces/node_interfaces.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,17 +17,7 @@

#include <memory>

#include <rclcpp/node_interfaces/node_interfaces.hpp>
#include <rclcpp/node_interfaces/node_base_interface.hpp>
#include <rclcpp/node_interfaces/node_clock_interface.hpp>
#include <rclcpp/node_interfaces/node_graph_interface.hpp>
#include <rclcpp/node_interfaces/node_logging_interface.hpp>
#include <rclcpp/node_interfaces/node_parameters_interface.hpp>
#include <rclcpp/node_interfaces/node_services_interface.hpp>
#include <rclcpp/node_interfaces/node_time_source_interface.hpp>
#include <rclcpp/node_interfaces/node_timers_interface.hpp>
#include <rclcpp/node_interfaces/node_topics_interface.hpp>
#include <rclcpp/node_interfaces/node_waitables_interface.hpp>
#include "fuse_core/node_interfaces/node_interfaces_helpers.hpp"

#define ALL_FUSE_CORE_NODE_INTERFACES \
fuse_core::node_interfaces::Base, fuse_core::node_interfaces::Clock, fuse_core::node_interfaces::Graph, \
Expand All @@ -39,19 +29,129 @@ namespace fuse_core
{
namespace node_interfaces
{
using Base = rclcpp::node_interfaces::NodeBaseInterface;
using Clock = rclcpp::node_interfaces::NodeClockInterface;
using Graph = rclcpp::node_interfaces::NodeGraphInterface;
using Logging = rclcpp::node_interfaces::NodeLoggingInterface;
using Parameters = rclcpp::node_interfaces::NodeParametersInterface;
using Services = rclcpp::node_interfaces::NodeServicesInterface;
using TimeSource = rclcpp::node_interfaces::NodeTimeSourceInterface;
using Timers = rclcpp::node_interfaces::NodeTimersInterface;
using Topics = rclcpp::node_interfaces::NodeTopicsInterface;
using Waitables = rclcpp::node_interfaces::NodeWaitablesInterface;

template <typename... InterfacesTs>
using NodeInterfaces = ::rclcpp::node_interfaces::NodeInterfaces<InterfacesTs...>;

/// TODO(CH3): Remove this once https://github.com/ros2/rclcpp/pull/2041 is merged and released

/// A helper class for aggregating node interfaces
template <typename... InterfaceTs>
class NodeInterfaces : public std::enable_shared_from_this<NodeInterfaces<InterfaceTs...>>, public InterfaceTs...
{
static_assert(0 != sizeof...(InterfaceTs), "Template parameters must be populated!");

public:
RCLCPP_SMART_PTR_DEFINITIONS(NodeInterfaces)

/// Create a new NodeInterfaces object with no bound node interfaces.
NodeInterfaces() : InterfaceTs()...
{
}

/// Create a new NodeInterfaces object bound with the passed in node-like object's interfaces.
/**
* Specify which interfaces you want to bind using the template parameters by specifying
* interface support classes to use. Any unmentioned interfaces will be unavailable to bind.
*
* You may use any of the available support classes in
* node_interfaces/node_interfaces_helpers.hpp:
* - Base: Supports NodeBaseInterface
* - Clock: Supports NodeClockInterface
* - Graph: Supports NodeGraphInterface
* - Logging: Supports NodeLoggingInterface
* - Parameters: Supports NodeParametersInterface
* - Services: Supports NodeServicesInterface
* - TimeSource: Supports NodeTimeSourceInterface
* - Timers: Supports NodeTimersInterface
* - Topics: Supports NodeTopicsInterface
* - Waitables: Supports NodeWaitablesInterface
*
* Or you can define your own interface support classes!
*
* Each of the support classes should define:
* - Default constructor
* - Templated constructor taking NodeT
* - get_node_<interface_name>_interface()
* - set_node_<interface_name>_interface()
*
* Usage example:
* - ```NodeInterfaces<rclcpp::node_interfaces::Base>(node)``` will bind just the
* NodeBaseInterface.
* - ```NodeInterfaces< rclcpp::node_interfaces::Base, rclcpp::node_interfaces::Clock>(node)```
* will bind both the NodeBaseInterface and NodeClockInterface.
*
* \param[in] node Node-like object to bind the interfaces of.
*/
template <typename NodeT>
NodeInterfaces(NodeT& node) // NOLINT(runtime/explicit)
: InterfaceTs(node)...
{
} // Implicit constructor for node-like passing to functions

/// SharedPtr Constructor
template <typename NodeT>
NodeInterfaces(std::shared_ptr<NodeT> node) // NOLINT(runtime/explicit)
: InterfaceTs(node ? *node : throw std::runtime_error("Passed in NodeT is nullptr!"))...
{
}
};

/// Create a new NodeInterfaces object bound with no node interfaces.
/**
* Specify which interfaces you want to bind using the template parameters by specifying
* interface support classes to use. Any unmentioned interfaces will be unavailable to bind.
*
* This method will return a NodeInterfaces with no bound interfaces. You must set them using
* ```NodeInterfaces->set_<interface_name>_interface(InterfaceT::SharedPtr interface)```
*
* See the rclcpp::node_interfaces::NodeInterfaces class for usage examples and support classes.
*
* \sa rclcpp::node_interfaces::NodeInterfaces
* \param[in] node Node-like object to bind the interfaces of.
* \returns a NodeInterfaces::SharedPtr supporting the stated interfaces, but bound with none of
* them
*/
template <typename... InterfaceTs>
typename NodeInterfaces<InterfaceTs...>::SharedPtr get_node_interfaces()
{
static_assert(0 != sizeof...(InterfaceTs), "Template parameters must be populated!");
return std::make_shared<NodeInterfaces<InterfaceTs...>>();
}

/// Create a new NodeInterfaces object bound with the passed in node-like object's interfaces.
/**
* Specify which interfaces you want to bind using the template parameters by specifying
* interface support classes to use. Any unmentioned interfaces will be unavailable to bind.
*
* See the rclcpp::node_interfaces::NodeInterfaces class for usage examples and support classes.
*
* \sa rclcpp::node_interfaces::NodeInterfaces
* \param[in] node Node-like object to bind the interfaces of.
* \returns a NodeInterfaces::SharedPtr bound with the node-like objects's interfaces
*/
template <typename... InterfaceTs, typename NodeT>
typename NodeInterfaces<InterfaceTs...>::SharedPtr get_node_interfaces(NodeT& node)
{
static_assert(0 != sizeof...(InterfaceTs), "Template parameters must be populated!");
return std::make_shared<NodeInterfaces<InterfaceTs...>>(node);
}

/// Create a new NodeInterfaces object bound with the passed in node-like shared_ptr's interfaces.
/**
* Specify which interfaces you want to bind using the template parameters by specifying
* interface support classes to use. Any unmentioned interfaces will be unavailable to bind.
*
* See the rclcpp::node_interfaces::NodeInterfaces class for usage examples and support classes.
*
* \sa rclcpp::node_interfaces::NodeInterfaces
* \param[in] node Node-like object to bind the interfaces of.
* \returns a NodeInterfaces::SharedPtr bound with the node-like objects's interfaces
*/
template <typename... InterfaceTs, typename NodeT>
typename NodeInterfaces<InterfaceTs...>::SharedPtr get_node_interfaces(std::shared_ptr<NodeT> node)
{
static_assert(0 != sizeof...(InterfaceTs), "Template parameters must be populated!");
return std::make_shared<NodeInterfaces<InterfaceTs...>>(node);
}

} // namespace node_interfaces
} // namespace fuse_core

Expand Down
Loading

0 comments on commit 22cec8d

Please sign in to comment.