Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Humble #13

Draft
wants to merge 9 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 7 additions & 4 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 All @@ -23,6 +23,8 @@ jobs:
steps:
- name: Checkout source
uses: actions/checkout@v4
with:
submodules: 'true'

- name: Setup Docker Buildx
uses: docker/setup-buildx-action@v2
Expand Down Expand Up @@ -59,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 All @@ -72,7 +74,7 @@ jobs:
working-directory: /colcon_ws

clang_tidy:
if: github.ref != 'refs/heads/main'
if: github.ref != 'refs/heads/humble'
needs:
# Ensure the test job runs after the build job finishes instead of attempting to run in parallel
- build-ws
Expand All @@ -90,7 +92,8 @@ jobs:
files: |
**.cpp
**.hpp
- run: run-clang-tidy -j $(nproc --all) -p build/ -export-fixes clang-tidy-fixes.yaml -config-file src/fuse/.clang-tidy ${{ steps.changed-cpp-files.outputs.all_changed_files }}
- if: ${{ steps.changed-cpp-files.outputs.all_changed_files != '' }}
run: run-clang-tidy -j $(nproc --all) -p build/ -export-fixes clang-tidy-fixes.yaml -config-file src/fuse/.clang-tidy ${{ steps.changed-cpp-files.outputs.all_changed_files }}
working-directory: /colcon_ws
- uses: asarium/[email protected]
with:
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: 6 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
[submodule "dependencies/tf2_2d"]
path = dependencies/tf2_2d
url = https://github.com/locusrobotics/tf2_2d.git
[submodule "dependencies/covariance_geometry_ros"]
path = dependencies/covariance_geometry_ros
url = https://github.com/giafranchini/covariance_geometry_ros.git
9 changes: 4 additions & 5 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,9 +22,8 @@ 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 && \
vcs import src --input src/fuse/fuse.repos && \
rosdep install --from-paths src -y --ignore-src --skip-keys=mujoco && \
. /opt/ros/humble/setup.sh && \
rosdep install --from-paths src -y --ignore-src && \
colcon build --mixin compile-commands coverage-gcc coverage-pytest

# Set up final environment and entrypoint.
Expand Down
1 change: 1 addition & 0 deletions dependencies/covariance_geometry_ros
1 change: 1 addition & 0 deletions dependencies/tf2_2d
Submodule tf2_2d added at 41b3d5
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
13 changes: 0 additions & 13 deletions fuse.repos

This file was deleted.

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