Beispiel #1
0
    def __init__(self, parent, id):
        wx.Frame.__init__(self, parent, id, 'Topics', size=(300, 300))

        xrc_path = rostools.packspec.get_pkg_dir(
            'wxpy_ros') + '/xrc/ros_panel.xrc'
        self.res = xrc.XmlResource(xrc_path)

        self.res.LoadPanel(self, 'main_panel')

        self.plot_panel = xrc.XRCCTRL(self, 'plot_panel')
        self.time_slider = xrc.XRCCTRL(self, 'time_slider')
        self.add_but = xrc.XRCCTRL(self, 'add_but')
        self.refresh_but = xrc.XRCCTRL(self, 'refresh_but')
        self.topics_list = xrc.XRCCTRL(self, 'topics_list')
        self.slot_list = xrc.XRCCTRL(self, 'slot_list')
        self.topics_list = xrc.XRCCTRL(self, 'topics_list')
        self.rem_but = xrc.XRCCTRL(self, 'rem_but')
        self.style_txt = xrc.XRCCTRL(self, 'style_txt')
        self.values_lctr = xrc.XRCCTRL(self, 'values_lctr')
        self.path_txt = xrc.XRCCTRL(self, 'path_txt')

        self.plot = wxpy_ros.WXSlidingPlot(self.plot_panel)

        #        hb = wx.BoxSizer(wx.VERTICAL)
        #        self.plot_panel.SetSizer(hb)
        #        hb.Add(self.plot)
        #        hb.Add(self.values_lctr, wx.ALL|wx.EXPAND)
        wxpy_ros.NestPanel(self.plot_panel, self.plot)

        #disabled for now due to a frustrating layout problem
        #self.values_lctr.InsertColumn(0,'Slot')
        #self.values_lctr.InsertColumn(1,'Value')

        self.Center()
        self.Fit()
        self.Show(True)

        self.topics = []
        self.selectedTopic = None
        self.selectedSlot = None
        self.slots = None

        self.messageHandler = wxpy_ros.getMessageHandler()

        self.Bind(wx.EVT_BUTTON, self.OnRefreshTopicList, self.refresh_but)
        self.Bind(wx.EVT_BUTTON, self.OnSubscribe, self.add_but)
        self.Bind(wx.EVT_LISTBOX, self.OnSelectedTopic, self.topics_list)
        self.Bind(wx.EVT_LISTBOX, self.OnSelectedSlot, self.slot_list)
        self.Bind(wx.EVT_TEXT, self.OnTextChanged, self.path_txt)
        self.Bind(wx.EVT_SCROLL_THUMBRELEASE, self.OnChangedTime,
                  self.time_slider)

        self.add_but.Disable()
        self.plot.setTimespan(self.time_slider.GetValue())
Beispiel #2
0
    def __init__(self, parent, id):
        wx.Frame.__init__(self, parent, id, 'Topics', size=(300,300))

        xrc_path = rostools.packspec.get_pkg_dir('wxpy_ros') + '/xrc/ros_panel.xrc'
        self.res = xrc.XmlResource(xrc_path)     

        self.res.LoadPanel(self, 'main_panel')

        self.plot_panel = xrc.XRCCTRL(self,'plot_panel')
        self.time_slider = xrc.XRCCTRL(self,'time_slider')
        self.add_but = xrc.XRCCTRL(self,'add_but')
        self.refresh_but = xrc.XRCCTRL(self,'refresh_but')
        self.topics_list = xrc.XRCCTRL(self,'topics_list')
        self.slot_list = xrc.XRCCTRL(self,'slot_list')
        self.topics_list = xrc.XRCCTRL(self,'topics_list')
        self.rem_but = xrc.XRCCTRL(self,'rem_but')
        self.style_txt = xrc.XRCCTRL(self,'style_txt')
        self.values_lctr = xrc.XRCCTRL(self,'values_lctr')
        self.path_txt = xrc.XRCCTRL(self,'path_txt')
                
        self.plot = wxpy_ros.WXSlidingPlot(self.plot_panel)

#        hb = wx.BoxSizer(wx.VERTICAL)
#        self.plot_panel.SetSizer(hb)
#        hb.Add(self.plot)
#        hb.Add(self.values_lctr, wx.ALL|wx.EXPAND)
        wxpy_ros.NestPanel(self.plot_panel,self.plot)
        
        #disabled for now due to a frustrating layout problem
        #self.values_lctr.InsertColumn(0,'Slot')
        #self.values_lctr.InsertColumn(1,'Value')

        self.Center()
        self.Fit()
        self.Show(True)
        
        self.topics = []
        self.selectedTopic = None
        self.selectedSlot = None
        self.slots = None
        
        self.messageHandler = wxpy_ros.getMessageHandler()
        
        self.Bind(wx.EVT_BUTTON, self.OnRefreshTopicList, self.refresh_but)
        self.Bind(wx.EVT_BUTTON, self.OnSubscribe, self.add_but)
        self.Bind(wx.EVT_LISTBOX, self.OnSelectedTopic, self.topics_list)
        self.Bind(wx.EVT_LISTBOX, self.OnSelectedSlot, self.slot_list)
        self.Bind(wx.EVT_TEXT, self.OnTextChanged, self.path_txt)
        self.Bind(wx.EVT_SCROLL_THUMBRELEASE, self.OnChangedTime, self.time_slider)
        
        self.add_but.Disable()
        self.plot.setTimespan(self.time_slider.GetValue())
Beispiel #3
0
#('/mechanism_state/actuator_states[7]/velocity', 'b'), \
#('/mechanism_state/actuator_states[6]/velocity', 'g'), \
#('/mechanism_state/actuator_states[5]/velocity', 'y'), \
#('/mechanism_state/actuator_states[4]/velocity', 'm'), \
#('/mechanism_state/actuator_states[3]/velocity', 'y'), \
#('/mechanism_state/actuator_states[2]/velocity', 'y')]

# And we specify the timespan as well
all_plots = {'plots 1': (plots2, 20), 'plots 2': (plots1, 20)}

#
# You can stop reading at that point if you just want some stuff sliding on the screen
#

# Create a message handler, that will take care of the communication with ROS
messageHandler = wxpy_ros.getMessageHandler()


class NamesChannel(wxpy_ros.wxplot.Channel):
    def __init__(self, itempath, style):
        pass

    def callback(self, mechstate, time=None):
        print 'Act names:'
        i = 0
        for j in mechstate.actuator_states:
            print ' + %i \t ==> %s ' % (i, j.name)
            i += 1
        print 'Joint names:'
        i = 0
        for j in mechstate.joint_states:
Beispiel #4
0
 def __init__(self):
     self._records = []
     self._channel = None
     m_name = '/mechanism_state/'
     m_handler = wxpy_ros.getMessageHandler()
     self._channel = m_handler.subscribe(m_name, '', StateLogger)
Beispiel #5
0
 def __init__(self):
   self._records = []
   self._channel = None
   m_name = '/mechanism_state/'
   m_handler = wxpy_ros.getMessageHandler()
   self._channel = m_handler.subscribe(m_name, '',StateLogger)
Beispiel #6
0
  #('/mechanism_state/actuator_states[6]/velocity', 'g'), \
  #('/mechanism_state/actuator_states[5]/velocity', 'y'), \
  #('/mechanism_state/actuator_states[4]/velocity', 'm'), \
  #('/mechanism_state/actuator_states[3]/velocity', 'y'), \
  #('/mechanism_state/actuator_states[2]/velocity', 'y')]

# And we specify the timespan as well
all_plots = {'plots 1' : (plots2,20),'plots 2' : (plots1,20)}


#
# You can stop reading at that point if you just want some stuff sliding on the screen
#

# Create a message handler, that will take care of the communication with ROS
messageHandler = wxpy_ros.getMessageHandler()


class NamesChannel(wxpy_ros.wxplot.Channel):
  def __init__(self, itempath, style):
    pass
    
  def callback(self, mechstate, time=None):
    print 'Act names:'
    i = 0
    for j in mechstate.actuator_states:
      print ' + %i \t ==> %s '%(i,j.name)
      i+=1
    print 'Joint names:'
    i = 0
    for j in mechstate.joint_states: