Skip to content

Commit f546e3b

Browse files
authored
Merge pull request #369 from compas-dev/fix-publish
Re-advertise topic if the ros client has changed
2 parents 770a1bf + bc091eb commit f546e3b

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
@@ -23,6 +23,7 @@ Unreleased
2323

2424
* Fixed DH params for analytical IK solver of UR3e and UR10e.
2525
* Fixed Kinetic support on IK, FK, and motion planning calls.
26+
* Fixed ``Publish to topic`` Grasshopper component when the ``ros_client`` has been replaced (eg. disconnected and reconnected).
2627

2728
**Deprecated**
2829

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)