def __init__(self, parent, id=wx.ID_ANY, title='Bilibot Dashboard', pos=wx.DefaultPosition, size=(400, 50), style=wx.CAPTION|wx.CLOSE_BOX|wx.STAY_ON_TOP): wx.Frame.__init__(self, parent, id, title, pos, size, style) wx.InitAllImageHandlers() rospy.init_node('bilibot_dashboard', anonymous=True) try: getattr(rxtools, "initRoscpp") rxtools.initRoscpp("bilibot_dashboard_cpp", anonymous=True) except AttributeError: pass self.SetTitle('Bilibot Dashboard (%s)'%rosenv.get_master_uri()) icons_path = path.join(roslib.packages.get_pkg_dir('bilibot_dashboard'), "icons/") sizer = wx.BoxSizer(wx.HORIZONTAL) self.SetSizer(sizer) static_sizer = wx.StaticBoxSizer(wx.StaticBox(self, wx.ID_ANY, "Diagnostic"), wx.HORIZONTAL) sizer.Add(static_sizer, 0) # Diagnostics self._diagnostics_button = StatusControl(self, wx.ID_ANY, icons_path, "diag", True) self._diagnostics_button.SetToolTip(wx.ToolTip("Diagnostics")) static_sizer.Add(self._diagnostics_button, 0) # Rosout self._rosout_button = StatusControl(self, wx.ID_ANY, icons_path, "rosout", True) self._rosout_button.SetToolTip(wx.ToolTip("Rosout")) static_sizer.Add(self._rosout_button, 0) # Motors self._motors_button = StatusControl(self, wx.ID_ANY, icons_path, "motor", True) self._motors_button.SetToolTip(wx.ToolTip("Mode")) static_sizer.Add(self._motors_button, 0) self._motors_button.Bind(wx.EVT_LEFT_DOWN, self.on_motors_clicked) static_sizer = wx.StaticBoxSizer(wx.StaticBox(self, wx.ID_ANY, "Breakers"), wx.HORIZONTAL) sizer.Add(static_sizer, 0) # Breakers breaker_names = ["Digital Out 1", "Digital Out 1", "Digital Out 2"] self._breaker_ctrls = [] for i in xrange(0, 3): ctrl = BreakerControl(self, wx.ID_ANY, i, breaker_names[i], icons_path) ctrl.SetToolTip(wx.ToolTip("%s"%(breaker_names[i]))) self._breaker_ctrls.append(ctrl) static_sizer.Add(ctrl, 0) # static_sizer = wx.StaticBoxSizer(wx.StaticBox(self, wx.ID_ANY, "Runstops"), wx.HORIZONTAL) # sizer.Add(static_sizer, 0) # run-stop # self._runstop_ctrl = StatusControl(self, wx.ID_ANY, icons_path, "runstop", False) # self._runstop_ctrl.SetToolTip(wx.ToolTip("Physical Runstop: Unknown")) # static_sizer.Add(self._runstop_ctrl, 0) # Wireless run-stop # self._wireless_runstop_ctrl = StatusControl(self, wx.ID_ANY, icons_path, "runstop-wireless", False) # self._wireless_runstop_ctrl.SetToolTip(wx.ToolTip("Wireless Runstop: Unknown")) # static_sizer.Add(self._wireless_runstop_ctrl, 0) static_sizer = wx.StaticBoxSizer(wx.StaticBox(self, wx.ID_ANY, "Battery"), wx.HORIZONTAL) sizer.Add(static_sizer, 0) # Battery State self._power_state_ctrl = PowerStateControl(self, wx.ID_ANY, icons_path) self._power_state_ctrl.SetToolTip(wx.ToolTip("Battery: Stale")) static_sizer.Add(self._power_state_ctrl, 1, wx.EXPAND) static_sizer = wx.StaticBoxSizer(wx.StaticBox(self, wx.ID_ANY, "Computer"), wx.HORIZONTAL) sizer.Add(static_sizer, 0) # Laptop Battery State self._power_state_ctrl_laptop = PowerStateControl(self, wx.ID_ANY, icons_path) self._power_state_ctrl_laptop.SetToolTip(wx.ToolTip("Computer Battery: Stale")) static_sizer.Add(self._power_state_ctrl_laptop, 1, wx.EXPAND) self._config = wx.Config("bilibot_dashboard") self.Bind(wx.EVT_CLOSE, self.on_close) self.Layout() self.Fit() self._diagnostics_frame = DiagnosticsFrame(self, wx.ID_ANY, "Diagnostics") self._diagnostics_frame.Hide() self._diagnostics_frame.Center() self._diagnostics_button.Bind(wx.EVT_BUTTON, self.on_diagnostics_clicked) self._rosout_frame = RosoutFrame(self, wx.ID_ANY, "Rosout") self._rosout_frame.Hide() self._rosout_frame.Center() self._rosout_button.Bind(wx.EVT_BUTTON, self.on_rosout_clicked) self.load_config() self._timer = wx.Timer(self) self.Bind(wx.EVT_TIMER, self.on_timer) self._timer.Start(500) self._dashboard_agg_sub = rospy.Subscriber('diagnostics_agg', diagnostic_msgs.msg.DiagnosticArray, self.dashboard_callback) self._dashboard_message = None self._last_dashboard_message_time = 0.0
def __init__(self, parent, id=wx.ID_ANY, title='Dragonbot Dashboard', pos=wx.DefaultPosition, size=(400, 50), style=wx.CAPTION|wx.CLOSE_BOX|wx.STAY_ON_TOP): wx.Frame.__init__(self, parent, id, title, pos, size, style) wx.InitAllImageHandlers() #self.battStateSub = rospy.Subscriber("battery_state", BatteryState, self.battStateCallback) self.motorState = 0 rospy.init_node('dragonbot_dashboard', anonymous=True) try: getattr(rxtools, "initRoscpp") rxtools.initRoscpp("dragonbot_dashboard_cpp", anonymous=True) except AttributeError: pass self.SetTitle('Dragonbot Dashboard (%s)'%rosenv.get_master_uri()) icons_path = path.join(roslib.packages.get_pkg_dir('dragonbot_dashboard'), "icons/") sizer = wx.BoxSizer(wx.HORIZONTAL) self.SetSizer(sizer) static_sizer = wx.StaticBoxSizer(wx.StaticBox(self, wx.ID_ANY, "Diagnostic"), wx.HORIZONTAL) sizer.Add(static_sizer, 0) # Diagnostics self._diagnostics_button = StatusControl(self, wx.ID_ANY, icons_path, "diag", True) self._diagnostics_button.SetToolTip(wx.ToolTip("Diagnostics")) static_sizer.Add(self._diagnostics_button, 0) # Rosout self._rosout_button = StatusControl(self, wx.ID_ANY, icons_path, "rosout", True) self._rosout_button.SetToolTip(wx.ToolTip("Rosout")) static_sizer.Add(self._rosout_button, 0) # Motors self._motors_button = StatusControl(self, wx.ID_ANY, icons_path, "motor", True) self._motors_button.SetToolTip(wx.ToolTip("Motors")) static_sizer.Add(self._motors_button, 0) self._motors_button.Bind(wx.EVT_LEFT_DOWN, self.on_motors_clicked) self.motorStatePub = rospy.Publisher('cmd_motor_state', Int32) self.motorStateSub = rospy.Subscriber("motor_state", Int32, self.motorStateCallback) #sizer.Add(static_sizer, 0) # Battery State (not yet) #self._power_state_ctrl = PowerStateControl(self, wx.ID_ANY, icons_path) #self._power_state_ctrl.SetToolTip(wx.ToolTip("Battery: Stale")) #static_sizer.Add(self._power_state_ctrl, 1, wx.EXPAND) self._config = wx.Config("dragonbot_dashboard") self.Bind(wx.EVT_CLOSE, self.on_close) self.Layout() self.Fit() self._diagnostics_frame = DiagnosticsFrame(self, wx.ID_ANY, "Diagnostics") self._diagnostics_frame.Hide() self._diagnostics_frame.Center() self._diagnostics_button.Bind(wx.EVT_BUTTON, self.on_diagnostics_clicked) self._rosout_frame = RosoutFrame(self, wx.ID_ANY, "Rosout") self._rosout_frame.Hide() self._rosout_frame.Center() self._rosout_button.Bind(wx.EVT_BUTTON, self.on_rosout_clicked) self.load_config() self._timer = wx.Timer(self) self.Bind(wx.EVT_TIMER, self.on_timer) self._timer.Start(500) #self._dashboard_agg_sub = rospy.Subscriber('dashboard_agg', DashboardState, self.dashboard_callback) self._dashboard_message = None self._last_dashboard_message_time = 0.0
def __init__(self, parent, id=wx.ID_ANY, title='cob dashboard', pos=wx.DefaultPosition, size=(400, 50), style=wx.CAPTION | wx.CLOSE_BOX | wx.STAY_ON_TOP): wx.Frame.__init__(self, parent, id, title, pos, size, style) wx.InitAllImageHandlers() rospy.init_node('cob3_dashboard', anonymous=True) try: getattr(rxtools, "initRoscpp") rxtools.initRoscpp("cob3_dashboard_cpp", anonymous=True) except AttributeError: pass self.SetTitle('cob dashboard (%s)' % rosenv.get_master_uri()) icons_path = path.join(roslib.packages.get_pkg_dir('pr2_dashboard'), "icons/") sizer = wx.BoxSizer(wx.HORIZONTAL) self.SetSizer(sizer) static_sizer = wx.StaticBoxSizer( wx.StaticBox(self, wx.ID_ANY, "Diagnostic"), wx.HORIZONTAL) sizer.Add(static_sizer, 0) # Diagnostics self._diagnostics_button = StatusControl(self, wx.ID_ANY, icons_path, "diag", True) self._diagnostics_button.SetToolTip(wx.ToolTip("Diagnostics")) static_sizer.Add(self._diagnostics_button, 0) # Rosout self._rosout_button = StatusControl(self, wx.ID_ANY, icons_path, "rosout", True) self._rosout_button.SetToolTip(wx.ToolTip("Rosout")) static_sizer.Add(self._rosout_button, 0) # Motors self._motors_button = StatusControl(self, wx.ID_ANY, icons_path, "motor", True) self._motors_button.SetToolTip(wx.ToolTip("Motors")) static_sizer.Add(self._motors_button, 0) self._motors_button.Bind(wx.EVT_LEFT_DOWN, self.on_motors_clicked) static_sizer = wx.StaticBoxSizer( wx.StaticBox(self, wx.ID_ANY, "Motors"), wx.HORIZONTAL) sizer.Add(static_sizer, 0) # Breakers breaker_names = ["Peft Arm", "Base/Body", "Right Arm"] self._breaker_ctrls = [] for i in xrange(0, 3): ctrl = BreakerControl(self, wx.ID_ANY, i, breaker_names[i], icons_path) ctrl.SetToolTip(wx.ToolTip("Breaker %s" % (breaker_names[i]))) self._breaker_ctrls.append(ctrl) static_sizer.Add(ctrl, 0) static_sizer = wx.StaticBoxSizer(wx.StaticBox(self, wx.ID_ANY, "EM"), wx.HORIZONTAL) sizer.Add(static_sizer, 0) # run-stop self._runstop_ctrl = StatusControl(self, wx.ID_ANY, icons_path, "runstop", False) self._runstop_ctrl.SetToolTip(wx.ToolTip("Physical Runstop: Unknown")) static_sizer.Add(self._runstop_ctrl, 0) # Wireless run-stop #self._wireless_runstop_ctrl = StatusControl(self, wx.ID_ANY, icons_path, "runstop-wireless", False) #self._wireless_runstop_ctrl.SetToolTip(wx.ToolTip("Wireless Runstop: Unknown")) #static_sizer.Add(self._wireless_runstop_ctrl, 0) static_sizer = wx.StaticBoxSizer( wx.StaticBox(self, wx.ID_ANY, "Battery"), wx.HORIZONTAL) sizer.Add(static_sizer, 0) # Battery State self._power_state_ctrl = PowerStateControl(self, wx.ID_ANY, icons_path) self._power_state_ctrl.SetToolTip(wx.ToolTip("Battery: Stale")) static_sizer.Add(self._power_state_ctrl, 1, wx.EXPAND) self._config = wx.Config("pr2_dashboard") self.Bind(wx.EVT_CLOSE, self.on_close) self.Layout() self.Fit() self._diagnostics_frame = DiagnosticsFrame(self, wx.ID_ANY, "Diagnostics") self._diagnostics_frame.Hide() self._diagnostics_frame.Center() self._diagnostics_button.Bind(wx.EVT_BUTTON, self.on_diagnostics_clicked) self._rosout_frame = RosoutFrame(self, wx.ID_ANY, "Rosout") self._rosout_frame.Hide() self._rosout_frame.Center() self._rosout_button.Bind(wx.EVT_BUTTON, self.on_rosout_clicked) self.load_config() self._timer = wx.Timer(self) self.Bind(wx.EVT_TIMER, self.on_timer) self._timer.Start(500) self._dashboard_agg_sub = rospy.Subscriber('dashboard_agg', DashboardState, self.dashboard_callback) self._dashboard_message = None self._last_dashboard_message_time = 0.0
def __init__(self, parent, id=wx.ID_ANY, title='Kuka LWR Dashboard', pos=wx.DefaultPosition, size=(400, 50), style=wx.CAPTION | wx.CLOSE_BOX | wx.STAY_ON_TOP): wx.Frame.__init__(self, parent, id, title, pos, size, style) wx.InitAllImageHandlers() rospy.init_node('lwr_dashboard', anonymous=True) try: getattr(rxtools, "initRoscpp") rxtools.initRoscpp("lwr_dashboard_cpp", anonymous=True) except AttributeError: print "rxtools error" pass self.SetTitle('Kuka LWR Dashboard (%s)' % rosenv.get_master_uri()) icons_path = path.join(roslib.packages.get_pkg_dir('lwr_dashboard'), "icons/") self._robots = rospy.get_param("robots", [""]) if (len(self._robots) == 0): self._has_many = False else: self._has_many = True sizer = wx.BoxSizer(wx.HORIZONTAL) self.SetSizer(sizer) static_sizer = wx.StaticBoxSizer(wx.StaticBox(self, wx.ID_ANY, " ROS state "), wx.HORIZONTAL) sizer.Add(static_sizer, 0) # Diagnostics self._diagnostics_button = StatusControl(self, wx.ID_ANY, icons_path, "btn_diag", True) self._diagnostics_button.SetToolTip(wx.ToolTip("Diagnostics")) static_sizer.Add(self._diagnostics_button, 0) # Rosout self._rosout_button = StatusControl(self, wx.ID_ANY, icons_path, "btn_rosout", True) self._rosout_button.SetToolTip(wx.ToolTip("Rosout")) static_sizer.Add(self._rosout_button, 0) self.FRI_COMMAND = 1 self.FRI_MONITOR = 2 self._fri_state_button = {} self._fri_control = {} self._fri_mode_topic = {} self._robot_control = {} i = 0 for robot in self._robots: print "Preparing robot: '%s'"%(robot) robot_sizer = wx.StaticBoxSizer(wx.StaticBox(self, wx.ID_ANY, " %s " % robot), wx.HORIZONTAL) # FRI State static_sizer = wx.StaticBoxSizer(wx.StaticBox(self, wx.ID_ANY, " FRI "), wx.HORIZONTAL) robot_sizer.Add(static_sizer, 0) self._fri_state_button[robot] = StatusControl(self, wx.ID_ANY, icons_path, "btn_state", True) self._fri_state_button[robot].SetToolTip(wx.ToolTip("FRI state")) self._fri_state_button[robot].Bind(wx.EVT_BUTTON, lambda x, r=robot: self.on_fri_state_clicked(x, r)) static_sizer.Add(self._fri_state_button[robot], 0) self._fri_control[robot] = FRIControl(self, wx.ID_ANY, icons_path) self._fri_control[robot].SetToolTip(wx.ToolTip("FRI: Stale")) static_sizer.Add(self._fri_control[robot], 1, wx.EXPAND) self._fri_mode_topic[robot] = rospy.Publisher("%sarm_controller/fri_set_mode" % robot, std_msgs.msg.Int32) # Robot State static_sizer = wx.StaticBoxSizer(wx.StaticBox(self, wx.ID_ANY, " Robot "), wx.HORIZONTAL) robot_sizer.Add(static_sizer, 0) self._robot_control[robot] = RobotControl(self, wx.ID_ANY, icons_path) self._robot_control[robot].SetToolTip(wx.ToolTip("Robot: Stale")) static_sizer.Add(self._robot_control[robot], 1, wx.EXPAND) sizer.Add(robot_sizer, 0) i = i + 1 self._config = wx.Config("elektron_dashboard") self.Bind(wx.EVT_CLOSE, self.on_close) self.Layout() self.Fit() self._diagnostics_frame = DiagnosticsFrame(self, wx.ID_ANY, "Diagnostics") self._diagnostics_frame.Hide() self._diagnostics_frame.Center() self._diagnostics_button.Bind(wx.EVT_BUTTON, self.on_diagnostics_clicked) self._rosout_frame = RosoutFrame(self, wx.ID_ANY, "Rosout") self._rosout_frame.Hide() self._rosout_frame.Center() self._rosout_button.Bind(wx.EVT_BUTTON, self.on_rosout_clicked) self.load_config() self._timer = wx.Timer(self) self.Bind(wx.EVT_TIMER, self.on_timer) self._timer.Start(500) self._topic = "diagnostic" self._subs = [] sub = rospy.Subscriber(self._topic, diagnostic_msgs.msg.DiagnosticArray, self.dashboard_callback) self._subs.append(sub) print "Subs.size %d" % len(self._subs) self._dashboard_message = None self._last_dashboard_message_time = 0.0
def __init__(self, parent, id=wx.ID_ANY, title='Hrpsys Dashboard', pos=wx.DefaultPosition, size=(400, 50), style=wx.CAPTION | wx.CLOSE_BOX | wx.STAY_ON_TOP, use_diagnostics=True, use_rosout=True, use_battery=True): wx.Frame.__init__(self, parent, id, title, pos, size, style) wx.InitAllImageHandlers() rospy.init_node('hrpsys_dashboard', anonymous=True) try: getattr(rxtools, "initRoscpp") rxtools.initRoscpp("hrpsys_dashboard_cpp", anonymous=True) except AttributeError: pass self.SetTitle('%s (%s)' % (title, rosenv.get_master_uri())) self._icons_path = path.join( roslib.packages.get_pkg_dir('pr2_dashboard'), "icons/") sizer = wx.BoxSizer(wx.HORIZONTAL) self.SetSizer(sizer) static_poser = wx.StaticBoxSizer( wx.StaticBox(self, wx.ID_ANY, "Diagnostic"), wx.HORIZONTAL) sizer.Add(static_poser, 0) # Diagnostics if use_diagnostics: self._diagnostics_button = StatusControl(self, wx.ID_ANY, self._icons_path, "diag", True) self._diagnostics_button.SetToolTip(wx.ToolTip("Diagnostics")) static_poser.Add(self._diagnostics_button, 0) else: self._diagnostics_button = None # Rosout if use_rosout: self._rosout_button = StatusControl(self, wx.ID_ANY, self._icons_path, "rosout", True) self._rosout_button.SetToolTip(wx.ToolTip("Rosout")) static_poser.Add(self._rosout_button, 0) else: self._rosout_button = None # Log self._log_button = StatusControl(self, wx.ID_ANY, self._icons_path, "breakerleft", True) self._log_button.SetToolTip(wx.ToolTip("Log")) static_poser.Add(self._log_button, 0) if not use_diagnostics: self._log_button.set_ok() # Motors self._motors_button = StatusControl(self, wx.ID_ANY, self._icons_path, "motor", True) self._motors_button.SetToolTip(wx.ToolTip("Mode")) static_poser.Add(self._motors_button, 0) self._motors_button.Bind(wx.EVT_LEFT_DOWN, self.on_motors_clicked) if not use_diagnostics: self._motors_button.set_ok() # power / motor static_poser = wx.StaticBoxSizer( wx.StaticBox(self, wx.ID_ANY, "Power"), wx.HORIZONTAL) sizer.Add(static_poser, 0) self._power_button = StatusControl(self, wx.ID_ANY, self._icons_path, "runstop", False) self._power_button.SetToolTip(wx.ToolTip("Power")) static_poser.Add(self._power_button, 0) if use_battery: static_poser = wx.StaticBoxSizer( wx.StaticBox(self, wx.ID_ANY, "Battery"), wx.HORIZONTAL) sizer.Add(static_poser, 0) # Battery State self._battery_state_ctrl = PowerStateControl( self, wx.ID_ANY, self._icons_path) self._battery_state_ctrl.SetToolTip(wx.ToolTip("Battery: Stale")) static_poser.Add(self._battery_state_ctrl, 1, wx.EXPAND) else: self._battery_state_ctrl = None # self.setup_extra_layout() self._config = wx.Config("hrpsys_dashboard") self.Bind(wx.EVT_CLOSE, self.on_close) self.Layout() self.Fit() self._diagnostics_frame = DiagnosticsFrame(self, wx.ID_ANY, "Diagnostics") self._diagnostics_frame.Hide() self._diagnostics_frame.Center() if self._diagnostics_button: self._diagnostics_button.Bind(wx.EVT_BUTTON, self.on_diagnostics_clicked) self._rosout_frame = RosoutFrame(self, wx.ID_ANY, "Rosout") self._rosout_frame.Hide() self._rosout_frame.Center() if self._rosout_button: self._rosout_button.Bind(wx.EVT_BUTTON, self.on_rosout_clicked) self._log_frame = RosoutFrame(self, wx.ID_ANY, "Log") self._log_frame.Hide() self._log_frame.Center() self._log_button.Bind(wx.EVT_BUTTON, self.on_log_clicked) self.load_config() self._timer = wx.Timer(self) self.Bind(wx.EVT_TIMER, self.on_timer) self._timer.Start(500) if use_diagnostics: self._dashboard_agg_sub = rospy.Subscriber( 'diagnostics_agg', diagnostic_msgs.msg.DiagnosticArray, self.dashboard_callback) self._dashboard_message = None self._last_dashboard_message_time = 0.0
def __init__(self, parent, id=wx.ID_ANY, title='youbot_dashboard', pos=wx.DefaultPosition, size=(400, 50), style=wx.CAPTION | wx.CLOSE_BOX | wx.STAY_ON_TOP): wx.Frame.__init__(self, parent, id, title, pos, size, style) wx.InitAllImageHandlers() rospy.init_node('youbot_dashboard', anonymous=True) try: getattr(rxtools, "initRoscpp") rxtools.initRoscpp("youbot_dashboard_cpp", anonymous=True) except AttributeError: pass self.SetTitle('youbot_dashboard (%s)' % rosenv.get_master_uri()) icons_path = path.join(roslib.packages.get_pkg_dir('pr2_dashboard'), "icons/") youbot_icons_path = path.join( roslib.packages.get_pkg_dir('youbot_dashboard'), "icons/") sizer = wx.BoxSizer(wx.HORIZONTAL) self.SetSizer(sizer) static_sizer = wx.StaticBoxSizer( wx.StaticBox(self, wx.ID_ANY, "Diagn."), wx.HORIZONTAL) sizer.Add(static_sizer, 0) # Diagnostics self._diagnostics_button = StatusControl(self, wx.ID_ANY, icons_path, "diag", True) self._diagnostics_button.SetToolTip(wx.ToolTip("Diagnostics")) static_sizer.Add(self._diagnostics_button, 0) # Rosout self._rosout_button = StatusControl(self, wx.ID_ANY, icons_path, "rosout", True) self._rosout_button.SetToolTip(wx.ToolTip("Rosout")) static_sizer.Add(self._rosout_button, 0) static_sizer = wx.StaticBoxSizer( wx.StaticBox(self, wx.ID_ANY, "Platform"), wx.HORIZONTAL) sizer.Add(static_sizer, 0) # base status self._base_status = StatusControl(self, wx.ID_ANY, youbot_icons_path, "base", True) self._base_status.SetToolTip(wx.ToolTip("Base Motors: Stale")) static_sizer.Add(self._base_status, 0) self._base_status.Bind(wx.EVT_LEFT_DOWN, self.on_base_status_clicked) # arm status self._arm_status = StatusControl(self, wx.ID_ANY, youbot_icons_path, "arm", True) self._arm_status.SetToolTip(wx.ToolTip("Arm Motors: Stale")) static_sizer.Add(self._arm_status, 0) self._arm_status.Bind(wx.EVT_LEFT_DOWN, self.on_arm_status_clicked) static_sizer = wx.StaticBoxSizer(wx.StaticBox(self, wx.ID_ANY, "Drv"), wx.HORIZONTAL) sizer.Add(static_sizer, 0) # driver status self._driver_status = StatusControl(self, wx.ID_ANY, youbot_icons_path, "driver", True) self._driver_status.SetToolTip(wx.ToolTip("Driver: Stale")) static_sizer.Add(self._driver_status, 0) self._driver_status.Bind(wx.EVT_BUTTON, self.on_driver_status_clicked) static_sizer = wx.StaticBoxSizer( wx.StaticBox(self, wx.ID_ANY, "Battery"), wx.HORIZONTAL) sizer.Add(static_sizer, 0) # Battery State self._power_state_ctrl = PowerStateControl(self, wx.ID_ANY, icons_path) self._power_state_ctrl.SetToolTip(wx.ToolTip("Battery: Stale")) static_sizer.Add(self._power_state_ctrl, 1, wx.EXPAND) self._config = wx.Config("youbot_dashboard") self.Bind(wx.EVT_CLOSE, self.on_close) self.Layout() self.Fit() self._diagnostics_frame = DiagnosticsFrame(self, wx.ID_ANY, "Diagnostics") self._diagnostics_frame.Hide() self._diagnostics_frame.Center() self._diagnostics_button.Bind(wx.EVT_BUTTON, self.on_diagnostics_clicked) self._rosout_frame = RosoutFrame(self, wx.ID_ANY, "Rosout") self._rosout_frame.Hide() self._rosout_frame.Center() self._rosout_button.Bind(wx.EVT_BUTTON, self.on_rosout_clicked) self.load_config() self._timer = wx.Timer(self) self.Bind(wx.EVT_TIMER, self.on_timer) self._timer.Start(500) self._dashboard_agg_sub = rospy.Subscriber('dashboard_agg', DashboardState, self.dashboard_callback) self._dashboard_message = None self._last_dashboard_message_time = 0.0
def __init__(self, parent, id=wx.ID_ANY, title='youbot_dashboard', pos=wx.DefaultPosition, size=(400, 50), style=wx.CAPTION|wx.CLOSE_BOX|wx.STAY_ON_TOP): wx.Frame.__init__(self, parent, id, title, pos, size, style) wx.InitAllImageHandlers() rospy.init_node('youbot_dashboard', anonymous=True) try: getattr(rxtools, "initRoscpp") rxtools.initRoscpp("youbot_dashboard_cpp", anonymous=True) except AttributeError: pass self.SetTitle('youbot_dashboard (%s)'%rosenv.get_master_uri()) icons_path = path.join(roslib.packages.get_pkg_dir('pr2_dashboard'), "icons/") youbot_icons_path = path.join(roslib.packages.get_pkg_dir('youbot_dashboard'), "icons/") sizer = wx.BoxSizer(wx.HORIZONTAL) self.SetSizer(sizer) static_sizer = wx.StaticBoxSizer(wx.StaticBox(self, wx.ID_ANY, "Diagn."), wx.HORIZONTAL) sizer.Add(static_sizer, 0) # Diagnostics self._diagnostics_button = StatusControl(self, wx.ID_ANY, icons_path, "diag", True) self._diagnostics_button.SetToolTip(wx.ToolTip("Diagnostics")) static_sizer.Add(self._diagnostics_button, 0) # Rosout self._rosout_button = StatusControl(self, wx.ID_ANY, icons_path, "rosout", True) self._rosout_button.SetToolTip(wx.ToolTip("Rosout")) static_sizer.Add(self._rosout_button, 0) static_sizer = wx.StaticBoxSizer(wx.StaticBox(self, wx.ID_ANY, "Platform"), wx.HORIZONTAL) sizer.Add(static_sizer, 0) # base status self._base_status = StatusControl(self, wx.ID_ANY, youbot_icons_path, "base", True) self._base_status.SetToolTip(wx.ToolTip("Base Motors: Stale")) static_sizer.Add(self._base_status, 0) self._base_status.Bind(wx.EVT_LEFT_DOWN, self.on_base_status_clicked) # arm status self._arm_status = StatusControl(self, wx.ID_ANY, youbot_icons_path, "arm", True) self._arm_status.SetToolTip(wx.ToolTip("Arm Motors: Stale")) static_sizer.Add(self._arm_status, 0) self._arm_status.Bind(wx.EVT_LEFT_DOWN, self.on_arm_status_clicked) static_sizer = wx.StaticBoxSizer(wx.StaticBox(self, wx.ID_ANY, "Drv"), wx.HORIZONTAL) sizer.Add(static_sizer, 0) # driver status self._driver_status = StatusControl(self, wx.ID_ANY, youbot_icons_path, "driver", True) self._driver_status.SetToolTip(wx.ToolTip("Driver: Stale")) static_sizer.Add(self._driver_status, 0) self._driver_status.Bind(wx.EVT_BUTTON, self.on_driver_status_clicked) static_sizer = wx.StaticBoxSizer(wx.StaticBox(self, wx.ID_ANY, "Battery"), wx.HORIZONTAL) sizer.Add(static_sizer, 0) # Battery State self._power_state_ctrl = PowerStateControl(self, wx.ID_ANY, icons_path) self._power_state_ctrl.SetToolTip(wx.ToolTip("Battery: Stale")) static_sizer.Add(self._power_state_ctrl, 1, wx.EXPAND) self._config = wx.Config("youbot_dashboard") self.Bind(wx.EVT_CLOSE, self.on_close) self.Layout() self.Fit() self._diagnostics_frame = DiagnosticsFrame(self, wx.ID_ANY, "Diagnostics") self._diagnostics_frame.Hide() self._diagnostics_frame.Center() self._diagnostics_button.Bind(wx.EVT_BUTTON, self.on_diagnostics_clicked) self._rosout_frame = RosoutFrame(self, wx.ID_ANY, "Rosout") self._rosout_frame.Hide() self._rosout_frame.Center() self._rosout_button.Bind(wx.EVT_BUTTON, self.on_rosout_clicked) self.load_config() self._timer = wx.Timer(self) self.Bind(wx.EVT_TIMER, self.on_timer) self._timer.Start(500) self._dashboard_agg_sub = rospy.Subscriber('dashboard_agg', DashboardState, self.dashboard_callback) self._dashboard_message = None self._last_dashboard_message_time = 0.0
def __init__(self, parent, id=wx.ID_ANY, title='PR2 Dashboard', pos=wx.DefaultPosition, size=(400, 50), style=wx.CAPTION | wx.CLOSE_BOX | wx.STAY_ON_TOP): wx.Frame.__init__(self, parent, id, title, pos, size, style) wx.InitAllImageHandlers() rospy.init_node('pr2_dashboard2', anonymous=True) try: getattr(rxtools, "initRoscpp") rxtools.initRoscpp("pr2_dashboard2_cpp", anonymous=True) except AttributeError: pass icons_path = path.join(roslib.packages.get_pkg_dir('pr2_dashboard2'), "icons/") self._diagnostics_bitmap = wx.Bitmap( path.join(icons_path, "diagnostics.png"), wx.BITMAP_TYPE_PNG) self._rosout_bitmap = wx.Bitmap( path.join(icons_path, "speech_bubble.png"), wx.BITMAP_TYPE_PNG) sizer = wx.BoxSizer(wx.HORIZONTAL) self.SetSizer(sizer) # Diagnostics self._diagnostics_button = StatusControl(self, wx.ID_ANY, self._diagnostics_bitmap, icons_path) self._diagnostics_button.SetToolTip(wx.ToolTip("Diagnostics")) sizer.Add(self._diagnostics_button, 0) # Rosout self._rosout_button = StatusControl(self, wx.ID_ANY, self._rosout_bitmap, icons_path) self._rosout_button.SetToolTip(wx.ToolTip("Rosout")) sizer.Add(self._rosout_button, 0) # Separator #sizer.Add(wx.StaticLine(self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LI_VERTICAL), 0, wx.EXPAND) # Breakers self._breakers_ctrl = BreakerControl(self, wx.ID_ANY, icons_path) self._breakers_ctrl.SetToolTip(wx.ToolTip("Breakers")) sizer.Add(self._breakers_ctrl, 0) # Motors self._motors_button = StatusControl(self, wx.ID_ANY, wx.NullBitmap, icons_path) self._motors_button.SetToolTip(wx.ToolTip("Motors")) sizer.Add(self._motors_button, 0) self._motors_button.Bind(wx.EVT_LEFT_DOWN, self.on_motors_clicked) # Separator sizer.Add( wx.StaticLine(self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LI_VERTICAL), 0, wx.EXPAND) # run-stop self._runstop_ctrl = StatusControl( self, wx.ID_ANY, wx.NullBitmap, icons_path, lights=("green_stoplight.png", "yellow_stoplight.png", "red_stoplight.png", "grey_stoplight.png")) self._runstop_ctrl.SetToolTip(wx.ToolTip("Runstop Status")) sizer.Add(self._runstop_ctrl, 0) # Wireless run-stop self._wireless_runstop_ctrl = StatusControl( self, wx.ID_ANY, wx.NullBitmap, icons_path, lights=("green_stoplight.png", "yellow_stoplight.png", "red_stoplight.png", "grey_stoplight.png")) self._wireless_runstop_ctrl.SetToolTip( wx.ToolTip("Wireless Runstop Status")) sizer.Add(self._wireless_runstop_ctrl, 0) # Separator sizer.Add( wx.StaticLine(self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LI_VERTICAL), 0, wx.EXPAND) # Battery State self._power_state_ctrl = PowerStateControl(self, wx.ID_ANY, icons_path) self._power_state_ctrl.SetToolTip(wx.ToolTip("Battery")) sizer.Add(self._power_state_ctrl, 1, wx.EXPAND) self._config = wx.Config("pr2_dashboard") self.Bind(wx.EVT_CLOSE, self.on_close) self.Layout() self.Fit() self._diagnostics_frame = DiagnosticsFrame(self, wx.ID_ANY, "Diagnostics") self._diagnostics_frame.Hide() self._diagnostics_button.Bind(wx.EVT_BUTTON, self.on_diagnostics_clicked) self._rosout_frame = RosoutFrame(self, wx.ID_ANY, "Rosout") self._rosout_frame.Hide() self._rosout_button.Bind(wx.EVT_BUTTON, self.on_rosout_clicked) self.load_config() self._timer = wx.Timer(self) self.Bind(wx.EVT_TIMER, self.on_timer) self._timer.Start(100) self._mutex = threading.Lock() rospy.Subscriber("power_state", PowerState, self.power_callback) rospy.Subscriber("power_board_state", PowerBoardState, self.power_board_callback)
def __init__(self, parent, id=wx.ID_ANY, title='Hrpsys Dashboard', pos=wx.DefaultPosition, size=(400, 50), style=wx.CAPTION|wx.CLOSE_BOX|wx.STAY_ON_TOP, use_diagnostics=True, use_rosout=True, use_battery=True): wx.Frame.__init__(self, parent, id, title, pos, size, style) wx.InitAllImageHandlers() rospy.init_node('hrpsys_dashboard', anonymous=True) try: getattr(rxtools, "initRoscpp") rxtools.initRoscpp("hrpsys_dashboard_cpp", anonymous=True) except AttributeError: pass self.SetTitle('%s (%s)'%(title,rosenv.get_master_uri())) self._icons_path = path.join(roslib.packages.get_pkg_dir('pr2_dashboard'), "icons/") sizer = wx.BoxSizer(wx.HORIZONTAL) self.SetSizer(sizer) static_poser = wx.StaticBoxSizer(wx.StaticBox(self, wx.ID_ANY, "Diagnostic"), wx.HORIZONTAL) sizer.Add(static_poser, 0) # Diagnostics if use_diagnostics: self._diagnostics_button = StatusControl(self, wx.ID_ANY, self._icons_path, "diag", True) self._diagnostics_button.SetToolTip(wx.ToolTip("Diagnostics")) static_poser.Add(self._diagnostics_button, 0) else: self._diagnostics_button = None # Rosout if use_rosout: self._rosout_button = StatusControl(self, wx.ID_ANY, self._icons_path, "rosout", True) self._rosout_button.SetToolTip(wx.ToolTip("Rosout")) static_poser.Add(self._rosout_button, 0) else: self._rosout_button = None # Log self._log_button = StatusControl(self, wx.ID_ANY, self._icons_path, "breakerleft", True) self._log_button.SetToolTip(wx.ToolTip("Log")) static_poser.Add(self._log_button, 0) if not use_diagnostics: self._log_button.set_ok() # Motors self._motors_button = StatusControl(self, wx.ID_ANY, self._icons_path, "motor", True) self._motors_button.SetToolTip(wx.ToolTip("Mode")) static_poser.Add(self._motors_button, 0) self._motors_button.Bind(wx.EVT_LEFT_DOWN, self.on_motors_clicked) if not use_diagnostics: self._motors_button.set_ok() # power / motor static_poser = wx.StaticBoxSizer(wx.StaticBox(self, wx.ID_ANY, "Power"), wx.HORIZONTAL) sizer.Add(static_poser, 0) self._power_button = StatusControl(self, wx.ID_ANY, self._icons_path, "runstop", False) self._power_button.SetToolTip(wx.ToolTip("Power")) static_poser.Add(self._power_button, 0) if use_battery: static_poser = wx.StaticBoxSizer(wx.StaticBox(self, wx.ID_ANY, "Battery"), wx.HORIZONTAL) sizer.Add(static_poser, 0) # Battery State self._battery_state_ctrl = PowerStateControl(self, wx.ID_ANY, self._icons_path) self._battery_state_ctrl.SetToolTip(wx.ToolTip("Battery: Stale")) static_poser.Add(self._battery_state_ctrl, 1, wx.EXPAND) else: self._battery_state_ctrl = None # self.setup_extra_layout() self._config = wx.Config("hrpsys_dashboard") self.Bind(wx.EVT_CLOSE, self.on_close) self.Layout() self.Fit() self._diagnostics_frame = DiagnosticsFrame(self, wx.ID_ANY, "Diagnostics") self._diagnostics_frame.Hide() self._diagnostics_frame.Center() if self._diagnostics_button: self._diagnostics_button.Bind(wx.EVT_BUTTON, self.on_diagnostics_clicked) self._rosout_frame = RosoutFrame(self, wx.ID_ANY, "Rosout") self._rosout_frame.Hide() self._rosout_frame.Center() if self._rosout_button: self._rosout_button.Bind(wx.EVT_BUTTON, self.on_rosout_clicked) self._log_frame = RosoutFrame(self, wx.ID_ANY, "Log") self._log_frame.Hide() self._log_frame.Center() self._log_button.Bind(wx.EVT_BUTTON, self.on_log_clicked) self.load_config() self._timer = wx.Timer(self) self.Bind(wx.EVT_TIMER, self.on_timer) self._timer.Start(500) if use_diagnostics: self._dashboard_agg_sub = rospy.Subscriber('diagnostics_agg', diagnostic_msgs.msg.DiagnosticArray, self.dashboard_callback) self._dashboard_message = None self._last_dashboard_message_time = 0.0
def __init__(self, parent, id=wx.ID_ANY, title='SLAW Dashboard', pos=wx.DefaultPosition, size=(400, 50), style=wx.CAPTION|wx.CLOSE_BOX): wx.Frame.__init__(self, parent, id, title, pos, size, style) wx.InitAllImageHandlers() self.SetBackgroundColour(wx.Colour(242,241,240,255)) self.SetTitle('SLAW dashboard (%s)'%rosenv.get_master_uri()) rospy.init_node('slaw_dashboard', anonymous=True) try: getattr(rxtools, "initRoscpp") rxtools.initRoscpp("slaw_dashboard_cpp", anonymous=True) except AttributeError: pass slaw_icons_path = path.join(roslib.packages.get_pkg_dir('slaw_dashboard'), "icons/") sizer = wx.BoxSizer(wx.HORIZONTAL) self.SetSizer(sizer) # Diagnostics Panel static_sizer = wx.StaticBoxSizer(wx.StaticBox(self, wx.ID_ANY, "Diagnostics"), wx.HORIZONTAL) sizer.Add(static_sizer, 0) # Diagnostics self._diagnostics_button = StatusControl(self, wx.ID_ANY, slaw_icons_path, "diagnostics", False) self._diagnostics_button.SetToolTip(wx.ToolTip("Diagnostics")) static_sizer.Add(self._diagnostics_button, 0) # Rosout self._rosout_button = StatusControl(self, wx.ID_ANY, slaw_icons_path, "rosout", False) self._rosout_button.SetToolTip(wx.ToolTip("Rosout")) static_sizer.Add(self._rosout_button, 0) # SmachViewer self._smach_button = StatusControl(self, wx.ID_ANY, slaw_icons_path, "smach", False) self._smach_button.SetToolTip(wx.ToolTip("Smach Viewer")) static_sizer.Add(self._smach_button, 0) self._smach_button.Bind(wx.EVT_LEFT_DOWN, self.on_smach_button_clicked) self._smach_button.set_ok() # Platform static_sizer = wx.StaticBoxSizer(wx.StaticBox(self, wx.ID_ANY, "Platform"), wx.HORIZONTAL) sizer.Add(static_sizer, 0) # base status self._base_status = StatusControl(self, wx.ID_ANY, slaw_icons_path, "wheel", False) self._base_status.SetToolTip(wx.ToolTip("Base Motors: Stale")) static_sizer.Add(self._base_status, 0) self._base_status.Bind(wx.EVT_LEFT_DOWN, self.on_base_status_clicked) # arm status self._arm_status = StatusControl(self, wx.ID_ANY, slaw_icons_path, "arm", False) self._arm_status.SetToolTip(wx.ToolTip("Arm Motors: Stale")) static_sizer.Add(self._arm_status, 0) self._arm_status.Bind(wx.EVT_LEFT_DOWN, self.on_arm_status_clicked) # Driver static_sizer = wx.StaticBoxSizer(wx.StaticBox(self, wx.ID_ANY, "Drv"), wx.HORIZONTAL) sizer.Add(static_sizer, 0) # driver status self._driver_status = StatusControl(self, wx.ID_ANY, slaw_icons_path, "motor", False) self._driver_status.SetToolTip(wx.ToolTip("Driver: Stale")) static_sizer.Add(self._driver_status, 0) self._driver_status.Bind(wx.EVT_BUTTON, self.on_driver_status_clicked) # System info self._robot_sysinfo = SysInfoControl(self, wx.ID_ANY, "System", slaw_icons_path) sizer.Add(self._robot_sysinfo) # Apps static_sizer = wx.StaticBoxSizer(wx.StaticBox(self, wx.ID_ANY, "Apps"), wx.HORIZONTAL) sizer.Add(static_sizer, 0) # Clear costmap self._costmap_ctrl = StatusControl(self, wx.ID_ANY, slaw_icons_path, "costmap", False) self._costmap_ctrl.SetToolTip(wx.ToolTip("Clear costmap")) static_sizer.Add(self._costmap_ctrl, 0) self._costmap_ctrl.Bind(wx.EVT_BUTTON, self.on_costmap_clicked) # Cancel goals self._goal_ctrl = StatusControl(self, wx.ID_ANY, slaw_icons_path, "cancel-goal", False) self._goal_ctrl.SetToolTip(wx.ToolTip("Cancel goal")) static_sizer.Add(self._goal_ctrl, 0) self._goal_ctrl.Bind(wx.EVT_BUTTON, self.on_goal_clicked) # Tuck arm self._arm_ctrl = StatusControl(self, wx.ID_ANY, slaw_icons_path, "arm-tuck", False) self._arm_ctrl.SetToolTip(wx.ToolTip("Tuck arm")) static_sizer.Add(self._arm_ctrl, 0) self._arm_ctrl.Bind(wx.EVT_BUTTON, self.on_arm_clicked) # Store location self._location_ctrl = StatusControl(self, wx.ID_ANY, slaw_icons_path, "nav", False) self._location_ctrl.SetToolTip(wx.ToolTip("Store location")) static_sizer.Add(self._location_ctrl, 0) self._location_ctrl.Bind(wx.EVT_BUTTON, self.on_location_clicked) # Wrap up stuff self._config = wx.Config("slaw_dashboard") self.Bind(wx.EVT_CLOSE, self.on_close) self.Layout() self.Fit() self._diagnostics_frame = DiagnosticsFrame(self, wx.ID_ANY, "Diagnostics") self._diagnostics_frame.Hide() self._diagnostics_frame.Center() self._diagnostics_button.Bind(wx.EVT_BUTTON, self.on_diagnostics_clicked) self._rosout_frame = RosoutFrame(self, wx.ID_ANY, "Rosout") self._rosout_frame.Hide() self._rosout_frame.Center() self._rosout_button.Bind(wx.EVT_BUTTON, self.on_rosout_clicked) self.load_config() self._timer = wx.Timer(self) self.Bind(wx.EVT_TIMER, self.on_timer) self._timer.Start(500) # Message subscribers self._last_sysinfo_message = 0.0 self._last_power_state_message = 0.0 self._last_platform_state_message = 0.0 self._platform_state_message = None self._sub_sysinfo = rospy.Subscriber('dashboard/sysinfo', SysInfo, self.cb_sysinfo) self._sub_platform_state = rospy.Subscriber('dashboard/platform_state', PowerBoardState, self.cb_platform_state) try: rospy.wait_for_service('/move_base/clear_costmaps', 1) self._srv_costmap = rospy.ServiceProxy('/move_base/clear_costmaps', Empty) self._costmap_ctrl.set_ok() self._costmap_ok = True except rospy.ROSException, e: rospy.logwarn("move base not running yet, can't clear costmap") self._costmap_ctrl.set_stale() self._costmap_ok = False
def __init__(self, parent, id=wx.ID_ANY, title='Nao Dashboard', pos=wx.DefaultPosition, size=(400, 50), style=wx.CAPTION|wx.CLOSE_BOX|wx.STAY_ON_TOP): wx.Frame.__init__(self, parent, id, title, pos, size, style) wx.InitAllImageHandlers() rospy.init_node('nao_dashboard', anonymous=True) try: getattr(rxtools, "initRoscpp") rxtools.initRoscpp("nao_dashboard_cpp", anonymous=True) except AttributeError: pass self.SetTitle('Nao Dashboard (%s)'%rosenv.get_master_uri()) icons_path = path.join(roslib.packages.get_pkg_dir('nao_dashboard'), "icons/") sizer = wx.BoxSizer(wx.HORIZONTAL) self.SetSizer(sizer) static_sizer = wx.StaticBoxSizer(wx.StaticBox(self, wx.ID_ANY, "Robot"), wx.HORIZONTAL) sizer.Add(static_sizer, 0) self._robot_combobox = wx.ComboBox(self, wx.ID_ANY, "", choices = []) static_sizer.Add(self._robot_combobox, 0) gobject.threads_init() dbus.glib.threads_init() self.robots = [] self.sys_bus = dbus.SystemBus() self.avahi_server = dbus.Interface(self.sys_bus.get_object(avahi.DBUS_NAME, '/'), avahi.DBUS_INTERFACE_SERVER) self.sbrowser = dbus.Interface(self.sys_bus.get_object(avahi.DBUS_NAME, self.avahi_server.ServiceBrowserNew(avahi.IF_UNSPEC, avahi.PROTO_INET, '_naoqi._tcp', 'local', dbus.UInt32(0))), avahi.DBUS_INTERFACE_SERVICE_BROWSER) self.sbrowser.connect_to_signal("ItemNew", self.avahiNewItem) self.sbrowser.connect_to_signal("ItemRemove", self.avahiItemRemove) static_sizer = wx.StaticBoxSizer(wx.StaticBox(self, wx.ID_ANY, "Diagnostic"), wx.HORIZONTAL) sizer.Add(static_sizer, 0) # Diagnostics self._diagnostics_button = StatusControl(self, wx.ID_ANY, icons_path, "diag", True) self._diagnostics_button.SetToolTip(wx.ToolTip("Diagnostics")) static_sizer.Add(self._diagnostics_button, 0) # Rosout self._rosout_button = StatusControl(self, wx.ID_ANY, icons_path, "rosout", True) self._rosout_button.SetToolTip(wx.ToolTip("Rosout")) static_sizer.Add(self._rosout_button, 0) # Joint temperature self._temp_joint_button = StatusControl(self, wx.ID_ANY, icons_path, "temperature_joints", True) self._temp_joint_button.SetToolTip(wx.ToolTip("Joint temperatures")) static_sizer.Add(self._temp_joint_button, 0) # CPU temperature self._temp_head_button = StatusControl(self, wx.ID_ANY, icons_path, "temperature_head", True) self._temp_head_button.SetToolTip(wx.ToolTip("CPU temperature")) static_sizer.Add(self._temp_head_button, 0) static_sizer = wx.StaticBoxSizer(wx.StaticBox(self, wx.ID_ANY, "Stiffness"), wx.HORIZONTAL) sizer.Add(static_sizer, 0) # Motors self._motors_button = StatusControl(self, wx.ID_ANY, icons_path, "motor", True) self._motors_button.SetToolTip(wx.ToolTip("Stiffness")) self._motors_button._ok = (wx.Bitmap(path.join(icons_path, "stiffness-off-untoggled.png"), wx.BITMAP_TYPE_PNG), wx.Bitmap(path.join(icons_path, "stiffness-off-toggled.png"), wx.BITMAP_TYPE_PNG)) self._motors_button._warn = (wx.Bitmap(path.join(icons_path, "stiffness-partially-untoggled.png"), wx.BITMAP_TYPE_PNG), wx.Bitmap(path.join(icons_path, "stiffness-partially-toggled.png"), wx.BITMAP_TYPE_PNG)) self._motors_button._error = (wx.Bitmap(path.join(icons_path, "stiffness-on-untoggled.png"), wx.BITMAP_TYPE_PNG), wx.Bitmap(path.join(icons_path, "stiffness-on-toggled.png"), wx.BITMAP_TYPE_PNG)) self._motors_button._stale = (wx.Bitmap(path.join(icons_path, "stiffness-stale-untoggled.png"), wx.BITMAP_TYPE_PNG), wx.Bitmap(path.join(icons_path, "stiffness-stale-toggled.png"), wx.BITMAP_TYPE_PNG)) static_sizer.Add(self._motors_button, 0) self._motors_button.Bind(wx.EVT_LEFT_DOWN, self.on_motors_clicked) static_sizer = wx.StaticBoxSizer(wx.StaticBox(self, wx.ID_ANY, "Battery"), wx.HORIZONTAL) sizer.Add(static_sizer, 0) # Battery State self._power_state_ctrl = PowerStateControl(self, wx.ID_ANY, icons_path) self._power_state_ctrl.SetToolTip(wx.ToolTip("Battery: Stale")) static_sizer.Add(self._power_state_ctrl, 1, wx.EXPAND) self._config = wx.Config("nao_dashboard") self.Bind(wx.EVT_CLOSE, self.on_close) self.Layout() self.Fit() self._diagnostics_frame = DiagnosticsFrame(self, wx.ID_ANY, "Diagnostics") self._diagnostics_frame.Hide() self._diagnostics_frame.Center() self._diagnostics_button.Bind(wx.EVT_BUTTON, self.on_diagnostics_clicked) self._rosout_frame = RosoutFrame(self, wx.ID_ANY, "Rosout") self._rosout_frame.Hide() self._rosout_frame.Center() self._rosout_button.Bind(wx.EVT_BUTTON, self.on_rosout_clicked) self.load_config() self._timer = wx.Timer(self) self.Bind(wx.EVT_TIMER, self.on_timer) self._timer.Start(500) self._agg_sub = rospy.Subscriber('diagnostics_agg', DiagnosticArray, self.diagnostic_callback) self._last_diagnostics_message_time = 0.0 self.bodyPoseClient = actionlib.SimpleActionClient('body_pose', BodyPoseAction) self.stiffnessEnableClient = rospy.ServiceProxy("body_stiffness/enable", std_srvs.srv.Empty) self.stiffnessDisableClient = rospy.ServiceProxy("body_stiffness/disable", std_srvs.srv.Empty)
def __init__(self, parent, id=wx.ID_ANY, title='PR2 Dashboard', pos=wx.DefaultPosition, size=(1280, 1024), style=wx.DEFAULT_FRAME_STYLE): wx.Frame.__init__(self, parent, id, title, pos, size, style) rospy.init_node('pr2_dashboard', anonymous=True) try: getattr(rxtools, "initRoscpp") rxtools.initRoscpp("pr2_dashboard_cpp", anonymous=True) except AttributeError: pass self._config = wx.Config("pr2_dashboard") self._aui_manager = wx.aui.AuiManager(self) self._rosout_panel = rxtools.RosoutPanel(self) self._monitor_panel = MonitorPanel(self) self._monitor_panel.set_new_errors_callback( self.on_monitor_errors_received) self._interpreter = wx.py.shell.Shell(self) self._hardware_panel = hardware_panel.HardwarePanel(self) self._aui_manager.AddPane( self._interpreter, wx.aui.AuiPaneInfo().BottomDockable().Bottom().Name( 'interpreter').Caption('Python Interpreter').Hide(), 'Python Interpreter') self._aui_manager.AddPane( self._rosout_panel, wx.aui.AuiPaneInfo().CenterPane().Name('rosout').Caption('Rosout'), 'Rosout') self._aui_manager.AddPane( self._monitor_panel, wx.aui.AuiPaneInfo().BottomDockable().Bottom().Layer(1).BestSize( wx.Size( 700, 400)).Name('runtime_monitor').Caption('Runtime Monitor'), 'Runtime Monitor') self._aui_manager.AddPane( self._hardware_panel, wx.aui.AuiPaneInfo().BottomDockable().Bottom().Layer(1).BestSize( wx.Size(700, 400)).Name('hardware').Caption('Hardware'), 'Hardware') self._aui_manager.SetDockSizeConstraint(0.5, 0.5) self._aui_manager.Update() self.load_config() self.create_menu_bar() self.Bind(wx.aui.EVT_AUI_PANE_CLOSE, self.on_pane_close) self.Bind(wx.EVT_CLOSE, self.on_close)