Skip to content

Commit d67f041

Browse files
committed
Fix: Override all profile options when using .qos
Signed-off-by: Michael X. Grey <[email protected]>
1 parent 98b8ea2 commit d67f041

File tree

1 file changed

+32
-1
lines changed

1 file changed

+32
-1
lines changed

rclrs/src/node/primitive_options.rs

Lines changed: 32 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,21 @@ pub trait IntoPrimitiveOptions<'a>: Sized {
5050

5151
/// Override all the quality of service settings for the primitive.
5252
fn qos(self, profile: QoSProfile) -> PrimitiveOptions<'a> {
53-
self.into_primitive_options().history(profile.history)
53+
let mut options = self
54+
.into_primitive_options()
55+
.history(profile.history)
56+
.reliability(profile.reliability)
57+
.durability(profile.durability)
58+
.deadline(profile.deadline)
59+
.lifespan(profile.lifespan)
60+
.liveliness(profile.liveliness)
61+
.liveliness_lease(profile.liveliness_lease);
62+
63+
if profile.avoid_ros_namespace_conventions {
64+
options.avoid_ros_namespace_conventions = Some(true);
65+
}
66+
67+
options
5468
}
5569

5670
/// Use the default topics quality of service profile.
@@ -160,6 +174,23 @@ pub trait IntoPrimitiveOptions<'a>: Sized {
160174
self.deadline(QoSDuration::Infinite)
161175
}
162176

177+
/// Override the default [`QoSProfile::liveliness`] for the primitive.
178+
fn liveliness(self, liveliness: QoSLivelinessPolicy) -> PrimitiveOptions<'a> {
179+
let mut options = self.into_primitive_options();
180+
options.liveliness = Some(liveliness);
181+
options
182+
}
183+
184+
/// Set liveliness to [`QoSLivelinessPolicy::Automatic`].
185+
fn liveliness_automatic(self) -> PrimitiveOptions<'a> {
186+
self.liveliness(QoSLivelinessPolicy::Automatic)
187+
}
188+
189+
/// Set liveliness to [`QoSLivelinessPolicy::ManualByTopic`]
190+
fn liveliness_manual(self) -> PrimitiveOptions<'a> {
191+
self.liveliness(QoSLivelinessPolicy::ManualByTopic)
192+
}
193+
163194
/// Override the default [`QoSProfile::liveliness_lease`] for the primitive.
164195
fn liveliness_lease(self, lease: QoSDuration) -> PrimitiveOptions<'a> {
165196
let mut options = self.into_primitive_options();

0 commit comments

Comments
 (0)