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

key_publisher.py does not work #49

Open
KansaiUser opened this issue Mar 20, 2021 · 5 comments
Open

key_publisher.py does not work #49

KansaiUser opened this issue Mar 20, 2021 · 5 comments

Comments

@KansaiUser
Copy link

The code related with key_publisher does not work.
It has two issues

  1. The keystrokes are not captured
  2. After Ctrl-C the keystroke capturing is not restored so it makes the terminal unusable.
@codebot
Copy link
Member

codebot commented Mar 22, 2021

Is there any terminal output? What operating system and version are you using?

@amjadmajid
Copy link

To fix this issue replace
old_attr = termios.tcgetattr(sys.stdin) with old_attr = termios.tcgetattr(sys.stdin.fileno())

@codebot
Copy link
Member

codebot commented Jul 27, 2021

I just ran this on python2 and python3 and it seemed to work (?) what version of Python are you using, and what OS ?

@amjadmajid
Copy link

I using Python 3.8.10 on Ubuntu 20.04 (btw, thanks for your impressive work!).

@HocheolShin
Copy link

It's because rate.sleep() doesn't work properly. It hold system so that the while loop doesn't go around. If you terminate the program with Ctrl+C, the system doesn't receive the old terminal attribute.
I don't know why rate.sleep() doesn't work, but I can go around it by using time.sleep().
If I want to use rate=rospy.Rate(10) # 10Hz, I use time.sleep(0.1) instead of rate.sleep().
It's not same but works.

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

No branches or pull requests

4 participants