8 from actionlib
import *
20 text.delete(
'1.0',
'end')
21 text.insert(
'end', text_header)
24 rospy.loginfo(
"Key pressed: %s -> command: %s", event.char, USER_COMMANDS[event.char])
27 text.insert(
'end',
"\n\n'%s' command selected" % USER_COMMANDS[event.char])
30 goal = UserCommandGoal(command=USER_COMMANDS[event.char])
33 client.send_goal(goal)
43 text.insert(
'end',
"\n\n'%s' is not a valid command" % event.char)
47 if __name__ ==
'__main__':
49 rospy.init_node(
'keyboard_user_commands')
56 client.wait_for_server()
60 window.geometry(rospy.get_param(
'~window_geometry',
'300x200'))
61 window.wm_title(rospy.get_param(
'~window_caption',
'User input'))
63 text = tk.Text(window, background=
'black', foreground=
'white',
64 font=(rospy.get_param(
'~text_font',
'Comic Sans MS'), rospy.get_param(
'~font_size', 12)))
65 text_header = rospy.get_param(
'~shown_text',
'Press command key')
66 text.insert(
'end', text_header)
69 window.bind(
'<KeyPress>', on_key_press)
71 except rospy.ROSInterruptException:
72 print "program interrupted before completion"