ros2 qos

Typically: "How do I... ", "How can I... " questions
Post Reply
Noname
Posts: 3
Joined: 27 Dec 2023, 15:53

ros2 qos

Post by Noname »

How can i change the qos (quality of service) in subscriber/publisher (simROS2.createSubscription/simROS2.createPublisher)?

coppelia
Site Admin
Posts: 10375
Joined: 14 Dec 2012, 00:25

Re: ros2 qos

Post by coppelia »

Hello,

this is currently not directly possible. You'd have to slightly modify the ROS2 plugin and recompile. Or, if running via Python, you could use the ROS client library for Python (rclpy) instead of the ROS2 plugin.

Cheers

Noname
Posts: 3
Joined: 27 Dec 2023, 15:53

Re: ros2 qos

Post by Noname »

Hello, so i found this in sim_ros2_interface "rclcpp::QoS qos = 10;
subscriptionProxy->subscription = node->create_subscription<`interface.cpp_type`>(in->topicName, qos, cb);"
What does it means qos=10?)
How can i modify it to usually qos settings (History, Depth, Reliability etc.)?


fferri
Posts: 1230
Joined: 09 Sep 2013, 19:28

Re: ros2 qos

Post by fferri »

Experimental support for QoS has been added to simROS2.

You can create a qos struct in lua:

Code: Select all

--lua
local qos = {
        history = simROS2.qos_history_policy.system_default,
        depth = 10,
        reliability = simROS2.qos_reliability_policy.system_default,
        durability = simROS2.qos_durability_policy.system_default,
        deadline = {sec = 0, nanosec = 0},
        lifespan = {sec = 0, nanosec = 0},
        liveliness = simROS2.qos_liveliness_policy.system_default,
        liveliness_lease_duration = {sec = 0, nanosec = 0},
        avoid_ros_namespace_conventions = false,
}
and pass it as last argument of simROS2.createPublisher and simROS2.createSubscription.

Noname
Posts: 3
Joined: 27 Dec 2023, 15:53

Re: ros2 qos

Post by Noname »

Thank you

Post Reply