Fixed strings formatting for user plugin

This commit is contained in:
Olek Bojda 2018-09-27 11:55:35 +02:00
parent e0db3556d0
commit f3547bca5a
2 changed files with 10 additions and 10 deletions

View File

@ -128,7 +128,7 @@ class QtWrapper:
def select_robot(self,robot_id):
self.disconnect_signals()
self.connect_robot_signals()
self.log_info('PIONIER' + str(robot_id) + ' wybrany!')
self.log_info('PIONIER{0} wybrany!'.format(robot_id))
self.log_info('Robot zostanie zatrzymany i sprzegniety')
self.widget.choiceButton.setText('Zwolnij robota')
@ -172,14 +172,14 @@ class QtWrapper:
def add_robot_to_list(self,robot_id):
self.widget.robotsList.addItem('PIONIER'+str(robot_id))
self.widget.robotsList.addItem('PIONIER{0}'.format(robot_id))
self.displayed_robots_id_list.append(robot_id)
def update_selected_robot_info(self,robot_info):
linear_vel = math.sqrt(robot_info.linear_velocity[0]**2 + robot_info.linear_velocity[1]**2)
self.widget.idLabel.setText('PIONIER' + str(robot_info.robot_id))
self.widget.idLabel.setText('PIONIER{0}'.format(robot_info.robot_id))
self.widget.batteryLabel.setText("{:.2f}".format(robot_info.battery_voltage))
self.widget.linearLabel.setText("{:.2f}".format(linear_vel))
self.widget.angularLabel.setText("{:.2f}".format(robot_info.angular_velocity[2]))
@ -232,7 +232,7 @@ class QtWrapper:
cursor = self.widget.logsBrowser.textCursor()
cursor.movePosition(QTextCursor.End)
self.widget.logsBrowser.setTextCursor(cursor)
self.widget.logsBrowser.insertHtml('<font color="black">' + str(time) + '. ' + info_text + '</font><br>')
self.widget.logsBrowser.insertHtml('<font color="black"> {0} {1}</font><br>'.format(time,info_text))
self.scroll_to_bottom()
# self.widget.logsBrowser.insertHtml(str(self.logger_counter) + '\t[INFO]\t' + info_text)
@ -243,7 +243,7 @@ class QtWrapper:
cursor.movePosition(QTextCursor.End)
self.widget.logsBrowser.setTextCursor(cursor)
self.widget.logsBrowser.textCursor().movePosition(QTextCursor.End)
self.widget.logsBrowser.insertHtml('<font color="orange">' + str(time) + '. ' + warning_text + '</font><br> ')
self.widget.logsBrowser.insertHtml('<font color="orange"> {0} {1}</font><br>'.format(time,warning_text))
self.scroll_to_bottom()
# self.widget.logsBrowser.append(str(self.logger_counter) + '\t[WARN]\t' + warning_text)
@ -254,7 +254,7 @@ class QtWrapper:
cursor.movePosition(QTextCursor.End)
self.widget.logsBrowser.setTextCursor(cursor)
self.widget.logsBrowser.textCursor().movePosition(QTextCursor.End)
self.widget.logsBrowser.insertHtml('<font color="red">' + str(time) + '. ' + error_text + '</font><br>')
self.widget.logsBrowser.insertHtml('<font color="red"> {0} {1}</font><br>'.format(time,error_text))
self.scroll_to_bottom()
# self.widget.logsBrowser.append(str(self.logger_counter) + '\t[ERROR]\t' + error_text)
@ -262,7 +262,7 @@ class QtWrapper:
self.clear_robot_info()
self.disconnect_signals()
self.connect_signals()
self.log_info('Utrata polaczenia z robotem PIONIER' + str(lost_robot_id))
self.log_info('Utrata polaczenia z robotem PIONIER{0}'.format(lost_robot_id))
def connection_to_master_lost(self):
self.log_error('Utrata polaczenia z masterstopem. Popros prowadzacego o jego uruchomienie')

View File

@ -41,12 +41,12 @@ class ROSWrapper:
def setup_subscribers_and_publishers(self,robot_id):
robot_name = 'PIONIER' + str(robot_id)
self.robot_info_subscriber = rospy.Subscriber('/RosAria/'+robot_name+'/robot_info', RobotInfoMsg, self.handle_selected_robot_info_update)
self.robot_info_subscriber = rospy.Subscriber('/RosAria/{0}/robot_info'.format(robot_name), RobotInfoMsg, self.handle_selected_robot_info_update)
self.master_stop_subscriber = rospy.Subscriber('/RosAria/master_stop', Bool, self.handle_master_stop_update)
self.restrictions_subscriber = rospy.Subscriber('/RosAria/restrictions', RestrictionsMsg, self.handle_restrictions_update)
self.user_stop_publisher = rospy.Publisher('/RosAria/'+robot_name+'/user_stop',Bool,queue_size = 1)
self.clutch_publisher = rospy.Publisher('/RosAria/'+robot_name+'/clutch',Bool,queue_size = 1)
self.user_stop_publisher = rospy.Publisher('/RosAria/{0}/user_stop'.format(robot_name),Bool,queue_size = 1)
self.clutch_publisher = rospy.Publisher('/RosAria/{0}/clutch'.format(robot_name),Bool,queue_size = 1)
self.periodic_timer = rospy.Timer(rospy.Duration(0.2),self.publish_periodic_update)
self.connection_timer = rospy.Timer(rospy.Duration(1.5),self.handle_robot_connection_lost)