Skip to content
Open
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
Original file line number Diff line number Diff line change
Expand Up @@ -461,25 +461,36 @@ namespace message_filters
/// underlying rclcpp::Node. Inherited upstream members (connectInput, registerCallback, ...)
/// are non-portable — they do not exist on the Agnocast-build Subscriber.
template <class M>
class Subscriber : public ::message_filters::Subscriber<M, rclcpp::Node>
class Subscriber : public ::message_filters::Subscriber<M>
{
public:
using Base = ::message_filters::Subscriber<M, rclcpp::Node>;
using Base = ::message_filters::Subscriber<M>;

Subscriber() = default;

Subscriber(
autoware::agnocast_wrapper::Node * node, const std::string & topic,
const rmw_qos_profile_t qos = rmw_qos_profile_default)
: Base(node->get_rclcpp_node().get(), topic, qos)
: Base(node->get_rclcpp_node().get(), topic, to_base_qos(qos))
{
}

void subscribe(
autoware::agnocast_wrapper::Node * node, const std::string & topic,
const rmw_qos_profile_t qos = rmw_qos_profile_default)
{
Base::subscribe(node->get_rclcpp_node().get(), topic, qos);
Base::subscribe(node->get_rclcpp_node().get(), topic, to_base_qos(qos));
}

private:
// message_filters on ROS 2 Lyrical and later takes rclcpp::QoS, and removed subscriber.h.
static auto to_base_qos(const rmw_qos_profile_t & qos)
{
#if __has_include(<message_filters/subscriber.h>)
return qos;
#else
return rclcpp::QoS(rclcpp::QoSInitialization::from_rmw(qos), qos);
#endif
}
};

Expand Down
14 changes: 12 additions & 2 deletions perception/autoware_ground_filter/src/ground_filter_node.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,16 @@ bool get_param(const std::vector<rclcpp::Parameter> & p, const std::string & nam
}
return false;
}

// message_filters on ROS 2 Lyrical and later takes rclcpp::QoS, and removed subscriber.h.
auto to_message_filters_qos(const rclcpp::QoS & qos)
{
#if __has_include(<message_filters/subscriber.h>)
return qos.get_rmw_qos_profile();
#else
return qos;
#endif
}
} // namespace

namespace autoware::ground_filter
Expand Down Expand Up @@ -189,9 +199,9 @@ void GroundFilterComponent::subscribe()
if (use_indices_) {
// Subscribe to the input using a filter
sub_input_filter_.subscribe(
this, "input", rclcpp::SensorDataQoS().keep_last(max_queue_size_).get_rmw_qos_profile());
this, "input", to_message_filters_qos(rclcpp::SensorDataQoS().keep_last(max_queue_size_)));
sub_indices_filter_.subscribe(
this, "indices", rclcpp::SensorDataQoS().keep_last(max_queue_size_).get_rmw_qos_profile());
this, "indices", to_message_filters_qos(rclcpp::SensorDataQoS().keep_last(max_queue_size_)));

if (approximate_sync_) {
sync_input_indices_a_ = std::make_shared<
Expand Down
Loading