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

Do periodic publishing on tkinter loop instead of ROS timer. #72

Merged
merged 4 commits into from
Sep 12, 2024

Conversation

adeschamps
Copy link
Contributor

The ROS create_timer call never actually gets driven, because the
main loop is blocked on self._root.mainloop() at the end of
MouseTeleop.__init__. This commit uses a Tkinter after call
instead and lets the Tkinter invoke the publish function.

Technically this will publish messages slightly less often than
requested, because the function will be called every period + execution_time,
but for a tool like this I think keeping the code simpler is more valuable.

The  ROS `create_timer` call never actually gets driven, because the
main loop is blocked on `self._root.mainloop()` at the end of
`MouseTeleop.__init__`. This commit uses a Tkinter `after` call
instead and lets the Tkinter invoke the publish function.

Technically this will publish messages slightly less often than
requested, because the function will be called every `period +
execution_time`, but for a tool like this I think keeping the code
simpler is more valuable.
This avoids an issue where, when the robot is being controlled by some
other process such as a navigation stack, the mouse_teleop node would
continue to publish commands with all zeroes, causing the robot to
move very jerkily.
@adeschamps
Copy link
Contributor Author

I added commit 04195f3 which stops the publish loop when the mouse button is released. This takes care of a problem that I experienced where another process, such as a navigation stack, and the mouse_teleop node were fighting for control of the robot even when I wasn't trying to manually control the robot.

@TakaHoribe
Copy link

Just comment. I've faced the same issue and this PR completely fix my problem. Thank you.

@bmagyar bmagyar changed the base branch from foxy-devel to master September 12, 2024 10:49
@bmagyar bmagyar merged commit 67b8f7c into ros-teleop:master Sep 12, 2024
5 checks passed
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.

3 participants