Skip to content

Commit bc0dea4

Browse files
committed
re-advertise topic if the ros client has changed
1 parent 97d6f49 commit bc0dea4

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

CHANGELOG.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ Unreleased
2121
**Fixed**
2222

2323
* Fixed DH params for analytical IK solver of UR3e and UR10e.
24+
* Fixed ``Publish to topic`` Grasshopper component when the ``ros_client`` has been replaced (eg. disconnected and reconnected).
2425

2526
**Deprecated**
2627

src/compas_fab/ghpython/components/Cf_RosTopicPublish/code.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@ def RunScript(self, ros_client, topic_name, topic_type, msg):
2525
topic = st.get(key, None)
2626

2727
if ros_client and ros_client.is_connected:
28-
if not topic:
29-
topic = Topic(ros_client, topic_name, topic_type)
28+
if not topic or topic.ros != ros_client:
29+
topic = Topic(ros_client, topic_name, topic_type, reconnect_on_close=False)
3030
topic.advertise()
3131
time.sleep(0.2)
3232

0 commit comments

Comments
 (0)