20 from diagnostic_msgs.msg
import DiagnosticArray
27 JOINT_NAMES = [
"FFJ0",
"FFJ3",
"FFJ4",
28 "MFJ0",
"MFJ3",
"MFJ4",
29 "RFJ0",
"RFJ3",
"RFJ4",
30 "LFJ0",
"LFJ3",
"LFJ4",
31 "THJ1",
"THJ2",
"THJ3",
"THJ4",
"THJ5",
56 self.screen.addstr(self.
y + 1, self.
x + 6,
"X", curses.color_pair(4))
58 self.screen.addstr(self.
y + 1, self.
x+6, str(self.
temperature), curses.color_pair(1))
60 self.screen.addstr(self.
y + 1, self.
x + 6, str(self.
temperature), curses.color_pair(2))
62 self.screen.addstr(self.
y + 1, self.
x + 6, str(self.
temperature), curses.color_pair(3))
82 curses.init_pair(4, curses.COLOR_WHITE, curses.COLOR_BLACK)
83 curses.init_pair(1, curses.COLOR_BLACK, curses.COLOR_GREEN)
84 curses.init_pair(2, curses.COLOR_BLACK, curses.COLOR_YELLOW)
85 curses.init_pair(3, curses.COLOR_BLACK, curses.COLOR_RED)
87 for index, joint_name
in enumerate(JOINT_NAMES):
89 begin_y = CASE_HEIGHT*index
97 event = self.pad.getch()
100 elif event == curses.KEY_RESIZE:
103 elif event == ord(
"s"):
106 elif event == ord(
"w"):
109 elif event == ord(
"a"):
112 elif event == ord(
"d"):
117 for status
in msg.status:
118 for joint
in JOINT_NAMES:
119 if joint
in status.name:
120 for value
in status.values:
121 if value.key ==
"Temperature":
122 self.
joint_monitors[joint].set_temperature(round(float(value.value), 1))
133 y, x = self.screen.getmaxyx()
138 for monitor
in self.joint_monitors.values():
142 if __name__ ==
'__main__':
143 rospy.init_node(
"temperature_monitor", anonymous=
True)
145 curses.wrapper(TemperatureMonitor)
147 traceback.print_exc()
def __init__(self, screen, joint_name, x, y)
def __init__(self, screen=None)
def set_temperature(self, temperature)