Skip to content

Commit 2cfb1b5

Browse files
committed
fix qos
1 parent b4980cc commit 2cfb1b5

3 files changed

Lines changed: 31 additions & 24 deletions

File tree

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,25 @@
1+
import os
2+
3+
from ament_index_python.packages import get_package_share_directory
14
from launch import LaunchDescription
25
from launch_ros.actions import Node
3-
from ament_index_python.packages import get_package_share_directory
4-
import os
6+
57

68
def generate_launch_description():
79
config = os.path.join(
810
get_package_share_directory('vortex_utility_nodes'),
911
'config',
10-
'message_publisher.yaml'
12+
'message_publisher.yaml',
1113
)
1214

13-
return LaunchDescription([
14-
Node(
15-
package='vortex_utility_nodes',
16-
executable='message_publisher_node',
17-
name='message_publisher_node',
18-
parameters=[config],
19-
output='screen',
20-
),
21-
])
15+
return LaunchDescription(
16+
[
17+
Node(
18+
package='vortex_utility_nodes',
19+
executable='message_publisher_node',
20+
name='message_publisher_node',
21+
parameters=[config],
22+
output='screen',
23+
),
24+
]
25+
)

vortex_utility_nodes/package.xml

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,14 @@
99

1010
<buildtool_depend>ament_cmake</buildtool_depend>
1111

12-
<depend>eigen</depend>
13-
<depend>yaml-cpp</depend>
14-
<depend>rclcpp</depend>
15-
<depend>nav_msgs</depend>
16-
<depend>vortex_msgs</depend>
12+
<depend>eigen</depend>
13+
<depend>yaml-cpp</depend>
14+
<depend>rclcpp</depend>
15+
<depend>nav_msgs</depend>
16+
<depend>vortex_msgs</depend>
1717
<depend>vortex_utils</depend>
1818

1919
<export>
2020
<build_type>ament_cmake</build_type>
2121
</export>
2222
</package>
23-

vortex_utility_nodes/src/message_publisher.cpp

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@ class MessagePublisherNode : public rclcpp::Node {
1111
public:
1212
MessagePublisherNode() : Node("message_publisher_node") {
1313
this->declare_parameter<std::string>("input_type", "odometry");
14-
this->declare_parameter<std::string>("topics.odometry", "nautilus/odom");
14+
this->declare_parameter<std::string>("topics.odometry",
15+
"nautilus/odom");
1516
this->declare_parameter<std::string>("topics.waypoint",
1617
"nautilus/waypoint");
1718
this->declare_parameter<std::string>("topics.reference_filter",
@@ -22,13 +23,16 @@ class MessagePublisherNode : public rclcpp::Node {
2223
auto input_type = this->get_parameter("input_type").as_string();
2324
auto output_topic = this->get_parameter("topics.output").as_string();
2425

25-
rpy_pub_ =
26-
this->create_publisher<vortex_msgs::msg::RPY>(output_topic, 2);
26+
rclcpp::QoS qos_profile(2);
27+
qos_profile.best_effort();
28+
29+
rpy_pub_ = this->create_publisher<vortex_msgs::msg::RPY>(output_topic,
30+
qos_profile);
2731

2832
if (input_type == "odometry") {
2933
auto topic = this->get_parameter("topics.odometry").as_string();
3034
sub_ = this->create_subscription<nav_msgs::msg::Odometry>(
31-
topic, 2,
35+
topic, qos_profile,
3236
std::bind(&MessagePublisherNode::odom_callback, this,
3337
std::placeholders::_1));
3438
RCLCPP_INFO(this->get_logger(),
@@ -38,7 +42,7 @@ class MessagePublisherNode : public rclcpp::Node {
3842
} else if (input_type == "waypoint") {
3943
auto topic = this->get_parameter("topics.waypoint").as_string();
4044
sub_ = this->create_subscription<vortex_msgs::msg::Waypoint>(
41-
topic, 2,
45+
topic, qos_profile,
4246
std::bind(&MessagePublisherNode::waypoint_callback, this,
4347
std::placeholders::_1));
4448
RCLCPP_INFO(this->get_logger(),
@@ -50,7 +54,7 @@ class MessagePublisherNode : public rclcpp::Node {
5054
this->get_parameter("topics.reference_filter").as_string();
5155
sub_ = this->create_subscription<
5256
vortex_msgs::msg::ReferenceFilterQuat>(
53-
topic, 2,
57+
topic, qos_profile,
5458
std::bind(&MessagePublisherNode::ref_filter_callback, this,
5559
std::placeholders::_1));
5660
RCLCPP_INFO(this->get_logger(),

0 commit comments

Comments
 (0)