def __init__(self, parent=None): super(MainWindow, self).__init__(parent) # decoration rospack = rospkg.RosPack() self.picpath = rospack.get_path('silva_beta')+'/src/assets/logo.png' # object init self.sld = [] self.sldh = [] #high: highest limit self.sldl = [] #low: lowest limit self.sldn = [] #now: current value self.labels = [] tform.set_zeros(self.sld) tform.set_zeros(self.sldh) tform.set_zeros(self.sldl) tform.set_zeros(self.sldn) tform.set_zeros(self.labels) self.progress = [0,0,0,0,0] self.index =0 # speech self._contents = '' # inner publishers self.pub_s = rospy.Publisher('/silva/speech_global/jp', String, queue_size=10) # GUI self.title = 'silva' self.left = 300 self.top = 50 self.width = 1366 self.height = 768 # param self.state = [0.0, 0.0, 0.5, 0.0] # yaml params self.param_config = tform.read_param('gui_config') self.table_widget = MyTableWidget(self) self.table_widget.setGeometry(10,295,300,450) #self.setCentralWidget(self.table_widget) self.table_widget_b = ButtomWidget(self) self.table_widget_b.setGeometry(300,460,850,265) self.initUI()
# subscribe message name: /fusion, # devide it according to different device names. @author: ustyui """ import rospy from silva_beta.msg import Evans import transformations as tform import socket, errno import sys import threading ### read parameters ### param_config = tform.read_param() seq_of_jointname = param_config['SequenceOfJoints'] _RATE = param_config['Rates']['jointinterface'] ip = param_config['IP'] port = param_config['PORT'] # import sensor_msgs "-------------------------------------------------------------parameter input" dev_name = sys.argv[1] "-------------------------------------------------------------global functions" def callback(msg, args):
def __init__(self, parent=None): super(MainWindow, self).__init__(parent) # decoration rospack = rospkg.RosPack() self.picpath = rospack.get_path('silva_beta') + '/src/assets/logo.png' # object init self.sld = [] self.sldh = [] #high: highest limit self.sldl = [] #low: lowest limit self.sldn = [] #now: current operation value self.sldr = [] #real: feedback value label from ibuki self.labels = [] # init labels self.fb_value = [] # feedback value buffer tform.set_zeros(self.sld) tform.set_zeros(self.sldh) tform.set_zeros(self.sldl) tform.set_zeros(self.sldn) tform.set_zeros(self.sldr) tform.set_zeros(self.labels) tform.set_zeros(self.fb_value) self.progress = [0, 0, 0, 0] # expressions self.expression = [] # obtain expressions param_config = tform.read_param('momentary_motion', 'ibuki_extra') self.expression = param_config['Expression'] self.index = 0 # speech self._contents = '' # inner publishers self.pub_s = rospy.Publisher('/silva/speech_global/jp', String, queue_size=10) # get minimum, maximum, and default self.default, blank = tform.load_map('ibuki') min_v, max_v = tform.load_map('limit') self.min_rel = [] self.max_rel = [] # get rel minimum and maximum for i in range(len(min_v)): if (min_v[i] != -1 or max_v[i] != -1): self.min_rel.append(self.default[i] - min_v[i]) self.max_rel.append(max_v[i] - self.default[i]) else: self.min_rel.append(100) self.max_rel.append(100) # GUI self.title = 'silva' self.left = 300 self.top = 50 self.width = 1366 self.height = 768 # param self.state = [0.0, 0.0, 1.0, 0.0] # yaml params self.param_config = tform.read_param('gui_config') self.table_widget = MyTableWidget(self) self.table_widget.setGeometry(10, 295, 300, 450) #self.setCentralWidget(self.table_widget) self.table_widget_b = ButtomWidget(self) self.table_widget_b.setGeometry(300, 460, 850, 265) self.initUI() time.sleep(2) # load delay for stable # subscribers sub_states = rospy.Subscriber('/silva/states', Float32MultiArray, self.states_cb) sub_fbs = rospy.Subscriber('/silva/reflex_local/ch0', Evans, self.fb_cb)