From baa463a1327ee404946dfdc711e9683ad332942a Mon Sep 17 00:00:00 2001 From: Brad Martin <52003535+bmartin427@users.noreply.github.com> Date: Wed, 14 Aug 2024 23:18:29 -0400 Subject: [PATCH 1/3] Avoid stale subscription when unsubscribing during resubscription (#947) (#948) If a client asks to subscribe to the same topic more than once, then disconnects, only a pending 'new' subscription may get deleted, leaving the 'old' subscription active indefinitely. Signed-off-by: Brad Martin --- rosbridge_library/src/rosbridge_library/internal/subscribers.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rosbridge_library/src/rosbridge_library/internal/subscribers.py b/rosbridge_library/src/rosbridge_library/internal/subscribers.py index 0bb94a809..c698c0b79 100644 --- a/rosbridge_library/src/rosbridge_library/internal/subscribers.py +++ b/rosbridge_library/src/rosbridge_library/internal/subscribers.py @@ -196,7 +196,7 @@ def unsubscribe(self, client_id): with self.rlock: if client_id in self.new_subscriptions: del self.new_subscriptions[client_id] - else: + if client_id in self.subscriptions: del self.subscriptions[client_id] def has_subscribers(self): From 996fddd6d4c4e60c78d11f2df61a892d2164cea3 Mon Sep 17 00:00:00 2001 From: ManuETR <37251724+ManuETR@users.noreply.github.com> Date: Thu, 15 Aug 2024 05:27:13 +0200 Subject: [PATCH 2/3] docs: update ROSBRIDGE_PROTOCOL.md - correcting indentation (#949) Add whitespace in front of all ROS action operations -- for correct indentation in Markdown --- ROSBRIDGE_PROTOCOL.md | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/ROSBRIDGE_PROTOCOL.md b/ROSBRIDGE_PROTOCOL.md index e58850d61..4a7e82468 100644 --- a/ROSBRIDGE_PROTOCOL.md +++ b/ROSBRIDGE_PROTOCOL.md @@ -93,12 +93,12 @@ ROS operations: * **call_service** - a service call * **service_response** - a service response * Actions: - * **advertise_action** - advertise an external action server - * **unadvertise_action** - unadvertise an external action server - * **send_action_goal** - a goal sent to an action server - * **cancel_action_goal** - cancel an in-progress action goal - * **action_feedback** - feedback messages from an action server - * **action_result** - an action result + * **advertise_action** - advertise an external action server + * **unadvertise_action** - unadvertise an external action server + * **send_action_goal** - a goal sent to an action server + * **cancel_action_goal** - cancel an in-progress action goal + * **action_feedback** - feedback messages from an action server + * **action_result** - an action result In general, actions or operations that the client takes (such as publishing and subscribing) have opcodes which are verbs (subscribe, call_service, unadvertise From febe1c46df9066ff468932924f99cec52b04517e Mon Sep 17 00:00:00 2001 From: Dimitri Nikitopoulos Date: Thu, 15 Aug 2024 08:53:03 -0400 Subject: [PATCH 3/3] fix: update new subs with dds from publisher (#940) --- .../src/rosbridge_library/internal/subscribers.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/rosbridge_library/src/rosbridge_library/internal/subscribers.py b/rosbridge_library/src/rosbridge_library/internal/subscribers.py index c698c0b79..a64c90b7f 100644 --- a/rosbridge_library/src/rosbridge_library/internal/subscribers.py +++ b/rosbridge_library/src/rosbridge_library/internal/subscribers.py @@ -176,6 +176,11 @@ def subscribe(self, client_id, callback): # In any case, the first message is handled using new_sub_callback, # which adds the new callback to the subscriptions dictionary. self.new_subscriptions.update({client_id: callback}) + infos = self.node_handle.get_publishers_info_by_topic(self.topic) + if any(pub.qos_profile.durability == DurabilityPolicy.TRANSIENT_LOCAL for pub in infos): + self.qos.durability = DurabilityPolicy.TRANSIENT_LOCAL + if any(pub.qos_profile.reliability == ReliabilityPolicy.BEST_EFFORT for pub in infos): + self.qos.reliability = ReliabilityPolicy.BEST_EFFORT if self.new_subscriber is None: self.new_subscriber = self.node_handle.create_subscription( self.msg_class,