Two nodelet overwrite themselves?
Hi
I run two nodelets of the same name. They subcribe and publish to different topics, but they define the same variables. Are these variables allocate twice, because I start the nodelet twice, or does one nodelet overwrite the other?
Thanks
Asked by gab27 on 2019-01-27 02:49:31 UTC
Answers
Are these variables allocate twice, because I start the nodelet twice, or does one nodelet overwrite the other?
Assuming you didn't use any "tricks", so use standard member variables: each nodelet is independent of another, so each gets their own instance of your variables.
This is no different from other C++ classes you write: each object gets its own instance of all member variables. Nothing is shared, unless you specifically set things up such that they are.
Edit:
I run two nodelets of the same name.
Did you intend to write "of the same type"?
Asked by gvdhoorn on 2019-01-27 04:32:24 UTC
Comments
PS: note that this is not "special" for nodelets, it's essentially basic C++.
Asked by gvdhoorn on 2019-01-27 04:33:39 UTC
ok thanks, then it should work. I have to check this.
Asked by gab27 on 2019-01-27 04:37:55 UTC
Could you please mark the question as answered by ticking the checkmark (✓) to the left of the answer if you feel it has been answered? Thanks.
Asked by gvdhoorn on 2019-01-27 04:40:14 UTC
Comments
Do you have any idea to load same kind of nodelet in one nodelet manager? I tried, but met same result as you, that is one nodelet published topics have twice data, the other didn't have any data
Asked by Tarantula-7 on 2019-12-20 04:12:41 UTC