using this code , one can convert the keypress into a Ros message which can be used as a Teleop function to work with robots, gazebo , uwsim , ... etc
install getch module for python https://pypi.python.org/pypi/getch
move this code into your own ros working area and run this program
check wether it is wrking by using rostopic list cmd or rostopic echo key cmd