1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28 import threading
29 import uuid
30
31 import rospy
32
33 import intera_dataflow
34 from intera_io import IODeviceInterface
35
37 """
38 Interface class for a Navigator on the Intera Research Robot.
39
40 Signals:
41 button_square_changed - OFF/CLICK/LONG_PRESS/DOUBLE_CLICK
42 button_ok_changed
43 button_back_changed
44 button_show_changed
45 button_triangle_changed
46 button_circle_changed
47 wheel_changed - Wheel value
48
49 """
50
52 """
53 Constructor.
54
55 """
56 self._navigator_io = IODeviceInterface("robot", "navigator")
57 self._button_lookup = {0:'OFF', 1:'CLICK',
58 2:'LONG_PRESS', 3:'DOUBLE_CLICK'}
59
61 """
62 Returns a list of strings describing all available navigator items
63
64 @rtype: list
65 @return: a list of string representing navigator items
66 Each item name of the following format:
67 '<assembly>_button_<function>'
68 """
69 return self._navigator_io.list_signal_names()
70
72 """
73 Current state of the wheel providing wheel name
74 @type wheel_name: str
75 @param wheel_name: the wheel name
76
77 @rtype: uint
78 @return: an integer representing how far the wheel has turned
79 """
80 return self._get_item_state(wheel_name)
81
94
110
112 """
113 Registers a supplied callback to a change in state of supplied
114 signal_name's value. Spawns a thread that will call the callback with
115 the updated value.
116
117 @type callback_function: function
118 @param callback_function: function handle for callback function
119 @type signal_name: str
120 @param signal_name: the name of the signal to poll for value change
121 @type poll_rate: int
122 @param poll_rate: the rate at which to poll for a value change (in a separate
123 thread)
124
125 @rtype: str
126 @return: callback_id retuned if the callback was registered, and an
127 empty string if the requested signal_name does not exist in the
128 Navigator
129 """
130 return self._navigator_io.register_callback(
131 callback_function=callback_function,
132 signal_name=signal_name,
133 poll_rate=poll_rate)
134
136 """
137 Deregisters a callback based on the supplied callback_id.
138
139 @type callback_id: str
140 @param callback_id: the callback_id string to deregister
141
142 @rtype: bool
143 @return: returns bool True if the callback was successfully
144 deregistered, and False otherwise.
145 """
146 return self._navigator_io.deregister_callback(callback_id)
147
150