Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add missing unsubscribe support #163

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

bpotokar
Copy link

Currenlty unsubscribing from a topic is not possible. Unity side actually has unsubscribe method, but ROS side does not implement that functionality. As a result, calling unsubscribe causes the AttributeError: 'SysCommands' object has no attribute 'remove_subscriber' exception.

This PR adds the missing method remove_subscriber, which unregisters ROS subscriber so new messages are not sent to Unity anymore.

This bug is reported in this issue on Unity-Robotics-Hub repository.

Here is described the call stack, that causes the exception, in more detail:

If Unity script calls the Unsubscribe function, which calls UnsubscribeAll. This calls SendSubscriberUnregistration, which sends the remove_subscriber command. That results in the following error:

Exception in thread Thread-2:
Traceback (most recent call last):
  File "/usr/lib/python3.8/threading.py", line 932, in _bootstrap_inner
    self.run()
  File "ros_tcp_endpoint/client.py", line 225, in run
    self.tcp_server.handle_syscommand(destination, data)
  File "ros_tcp_endpoint/lib/python3.8/site-packages/ros_tcp_endpoint/server.py", line 114, in handle_syscommand
    function = getattr(self.syscommands, topic[2:])
AttributeError: 'SysCommands' object has no attribute 'remove_subscriber'

@unity-cla-assistant
Copy link

unity-cla-assistant commented Apr 14, 2023

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.


Blaž Potokar seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account.
You have signed the CLA already but the status is still pending? Let us recheck it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants