35 from python_qt_binding.QtCore
import Qt
36 from python_qt_binding.QtWidgets
import QSizePolicy, QSplitter, QVBoxLayout, QWidget
38 from .score_widget
import ScoreWidget
39 from .sorted_twists_widget
import SortedTwistsWidget
40 from .trajectory_widget
import TrajectoryWidget
41 from .util
import PALETTE
42 from .velocity_space_widget
import VelocitySpaceWidget
46 """Interface for viewing LocalPlanEvaluation messages one at a time.
48 Within the individual messages, there is also the capability for highlighting/selecting a
49 subset of the trajectories.
51 The panel is composed of four sub-widgets. When a message is selected through the message_viewed method,
52 this class sets the data for all the sub-widgets and highlights the best trajectory.
54 Users can select additional trajectories through two of the widgets and update the trajectory subset
55 with the setSelected method. Each of those trajectories is mapped to a different color. This class
56 manages that mapping too.
60 super(DWBWidget, self).
__init__(parent)
61 self.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding)
64 full_layout = QVBoxLayout(self)
65 vsplitter = QSplitter(Qt.Vertical, self)
66 full_layout.addWidget(vsplitter)
69 vsplitter.addWidget(widget0)
72 hsplitter = QSplitter(Qt.Horizontal, vsplitter)
74 hsplitter.addWidget(widget1)
78 hsplitter.addWidget(widget2)
81 hsplitter.setSizes([10] * 2)
82 vsplitter.addWidget(hsplitter)
85 vsplitter.addWidget(widget3)
88 vsplitter.setSizes([10] * 3)
106 widget.setEvaluation(msg)
111 if hasattr(widget,
'setPlan'):
116 if hasattr(widget,
'setVelocity'):
117 widget.setVelocity(vel)
122 widget.setSelected(selected)
125 new_color_map = collections.OrderedDict()
129 return c.red, c.green, c.blue
132 for index
in selected:
134 new_color_map[index] = self.
color_map[index]
135 used_colors.add(qcolor_hash(new_color_map[index]))
139 for index
in selected:
142 while qcolor_hash(PALETTE[color_index])
in used_colors:
144 new_color_map[index] = PALETTE[color_index]