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

Multi-robots support #11

Open
rk4an opened this issue Nov 29, 2013 · 2 comments
Open

Multi-robots support #11

rk4an opened this issue Nov 29, 2013 · 2 comments

Comments

@rk4an
Copy link

rk4an commented Nov 29, 2013

Hi,

When I try to used the keyboard-teleop with multi-robots I found this:

When I choose a second robot I recreate an new Teleop object for this robot (with a new topic name of course) . And if I want to remove the old Teleop object I need to clean old "eventListener" still remaining in the body.

Currently if I want to used removeListener() function to cleanup, I need a reference to this function rigth? So I think we need to edit the lib?

So did you think that it possible to have a function for this? :)

Regards,

@rctoris
Copy link
Contributor

rctoris commented Nov 30, 2013

As it currently stands there is no direct reference to the function(s), they are created on-the-fly during the event creation: https://github.com/WPI-RAIL/keyboardteleopjs/blob/stable/src/teleop/Teleop.js#L103-L108 This of course could be changed.

What happens if you "delete" the object (e.g., let it go out of scope so it is garbage collected), does the event listener stay?

@rk4an
Copy link
Author

rk4an commented Nov 30, 2013

If I do a global var teleop and then recreate a new teleop by overwritten this var, the event listener stay, so if I press a key I write in 2 topics and my 2 robots moves together (garbage collector not work is this case?)

Currently I do a small hack with jQuery, I add event listener on body with ".on()" function, and call ".off()" function to remove all listener.

Maybe a idea is to have two functions on the teleop (.enable and .disable with add/remove event listener)

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

No branches or pull requests

2 participants