Ask Your Question
0

Two nodelet overwrite themselves?

asked 2019-01-27 01:49:31 -0600

gab27 gravatar image

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

edit retag flag offensive close merge delete

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

Tarantula-7 gravatar image Tarantula-7  ( 2019-12-20 03:12:41 -0600 )edit

1 Answer

Sort by » oldest newest most voted
0

answered 2019-01-27 03:32:24 -0600

gvdhoorn gravatar image

updated 2019-01-27 03:41:02 -0600

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"?

edit flag offensive delete link more

Comments

1

PS: note that this is not "special" for nodelets, it's essentially basic C++.

gvdhoorn gravatar image gvdhoorn  ( 2019-01-27 03:33:39 -0600 )edit

ok thanks, then it should work. I have to check this.

gab27 gravatar image gab27  ( 2019-01-27 03:37:55 -0600 )edit

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.

gvdhoorn gravatar image gvdhoorn  ( 2019-01-27 03:40:14 -0600 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2019-01-27 01:49:31 -0600

Seen: 63 times

Last updated: Jan 27 '19