35 from .table_widget
import TableWidget
39 """This widget displays the critic scores for an arbitrary number of trajectories in tabular format. 41 The main data is the dwb_msgs/CriticScore[] scores part for each selected trajectory in a LocalPlanEvaluation. 42 Each critic is a different row, and each trajectory is a column. 44 Each critic has two columns for row-headers that display the critic's name and scale. 46 Each trajectory also has column-headers that display the trajectory's velocity as well as 47 column-footer(s) that show the trajectory's total score. This is left extensible for others to modify. 63 return [
'Name',
'Scale']
66 return [
'x velocity',
'theta velocity']
72 if attribute_name ==
'Scale':
73 return '%.5f' % score.scale
76 if attribute_name ==
'x velocity':
77 return '%.2f' % twist.traj.velocity.x
78 elif attribute_name ==
'theta velocity':
79 return '%.2f' % twist.traj.velocity.theta
80 elif attribute_name ==
'Total':
81 return '%.2f' % twist.total
85 if evaluation
is None:
86 self.
table.setRowCount(0)
89 best = evaluation.twists[evaluation.best_index]
93 self.
table.resize(self.size())
96 for index, row_header
in enumerate(self.
row_headers):
97 if row_header ==
'Name':
101 for i, score
in enumerate(best.scores):
102 self.
setValue(i + row_offset, index, score.name)
105 row_offset = len(self.
col_headers) + len(best.scores)
107 self.
setValue(i + row_offset, index, name)
111 for i, score
in enumerate(best.scores):
114 self.
table.resizeColumnToContents(index)
127 for score
in twist.scores:
131 rospy.logwarn(
'Unknown row name: {}'.format(score.name))
139 self.
table.resizeColumnToContents(column)
148 self.
table.setColumnCount(n_row_headers + len(selected))
149 for col_offset, index
in enumerate(selected):