Skip to content

Commit

Permalink
Merge pull request NVIDIA-ISAAC-ROS#1 from robotperf/main
Browse files Browse the repository at this point in the history
Updated the ros2_benchmark for PR
  • Loading branch information
alexMarFar authored Jun 2, 2023
2 parents 8c10325 + 8c77e2e commit 4709046
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 2 deletions.
4 changes: 4 additions & 0 deletions ros2_benchmark/include/ros2_benchmark/common.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,10 @@ namespace ros2_benchmark
/// ROS 2 intraprocess communications is only compatible with keep_last policy
const rclcpp::QoS kQoS{{RMW_QOS_POLICY_HISTORY_KEEP_LAST, 1000}};

/// Quality-of-Service policy that
const rclcpp::QoS sensorQoS{
{RMW_QOS_POLICY_HISTORY_KEEP_LAST, 1000}, rmw_qos_profile_sensor_data};

/// Quality-of-Service policy that will not drop any messages
const rclcpp::QoS kBufferQoS{
{RMW_QOS_POLICY_HISTORY_KEEP_LAST, 1000}, rmw_qos_profile_parameters};
Expand Down
3 changes: 3 additions & 0 deletions ros2_benchmark/include/ros2_benchmark/monitor_node.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,9 @@ class MonitorNode : public rclcpp::Node
/// A service object for StartMonitoring.
rclcpp::Service<ros2_benchmark_interfaces::srv::StartMonitoring>::SharedPtr
start_monitoring_service_;

/// Setting for matching QoS profile between publisher and monitor node
std::string qos_type;
};

} // namespace ros2_benchmark
Expand Down
10 changes: 8 additions & 2 deletions ros2_benchmark/src/monitor_node.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,8 @@ MonitorNode::MonitorNode(
std::placeholders::_1,
std::placeholders::_2),
rmw_qos_profile_default,
service_callback_group_)}
service_callback_group_)},
qos_type(this->declare_parameter<std::string>("qos_type", "default"))
{
}

Expand All @@ -62,10 +63,15 @@ void MonitorNode::CreateGenericTypeMonitorSubscriber()
this,
std::placeholders::_1);

auto monitor_subs_qos = kQoS;
if (qos_type == "sensor"){
monitor_subs_qos = sensorQoS;
}

monitor_sub_ = this->create_generic_subscription(
"output", // topic name
monitor_data_format_, // message type in the form of "package/type"
kQoS,
monitor_subs_qos,
monitor_subscriber_callback);

RCLCPP_INFO(
Expand Down

0 comments on commit 4709046

Please sign in to comment.