diff --git a/safety_user_plugin/scripts/qt_wrapper.py b/safety_user_plugin/scripts/qt_wrapper.py index f9d5267..ba0c5f8 100644 --- a/safety_user_plugin/scripts/qt_wrapper.py +++ b/safety_user_plugin/scripts/qt_wrapper.py @@ -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('' + str(time) + '. ' + info_text + '
') + self.widget.logsBrowser.insertHtml(' {0} {1}
'.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('' + str(time) + '. ' + warning_text + '
') + self.widget.logsBrowser.insertHtml(' {0} {1}
'.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('' + str(time) + '. ' + error_text + '
') + self.widget.logsBrowser.insertHtml(' {0} {1}
'.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') diff --git a/safety_user_plugin/scripts/ros_wrapper.py b/safety_user_plugin/scripts/ros_wrapper.py index 68eb294..642ec76 100644 --- a/safety_user_plugin/scripts/ros_wrapper.py +++ b/safety_user_plugin/scripts/ros_wrapper.py @@ -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)