Closed Gescheld closed 1 year ago
Hi @Gescheld
you will have to modify UnitySubscriber.
This basic version just subscribes on Start()
.
You have to add e.g. the following functionality in e.g. Update()
:
if your doChangeSubscription
condition is satisfied: unsubscribe and resubscribe
Hi @MartinBischoff,
Thank you for the fast answer. I don't have the opportunity to try this at the moment, but I will test it next time :)
I have a question!
Here is my question: I want to unsubscribe from my current joint state topic and subscribe to an other joint state topic at runtime with the same robot game object. Is there a way to this at runtime?
So far I wait unitl I press a button to subscribe to a joint state topic. But I couldn't figure out how to unsubscribe and re-subscribe. I tried to remove/destroy the comoponents and to add them again with the different topic name, but that didn't work either. Also, I tried to disable the JointStateSubscriber varibale (SetSubscribeJointStates(false)) and enable it again with a different topic at the JointStateSubscriber.cs component.
Those are the scripts components that are added at runtime:
Relevant Code: