Skip to content

Commit

Permalink
updated motion_graph_inspector.py
Browse files Browse the repository at this point in the history
  • Loading branch information
ichumuh committed Sep 6, 2024
1 parent 4f8607f commit 54a38f1
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 8 deletions.
5 changes: 3 additions & 2 deletions scripts/tools/motion_graph_inspector.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ def on_topic_selector_clicked(self) -> None:
def on_topic_selected(self, index: int) -> None:
topic_name = self.topic_selector.currentText()
if topic_name:
rospy.Subscriber(topic_name, ExecutionState, self.on_new_message_received)
rospy.Subscriber(topic_name, ExecutionState, self.on_new_message_received, queue_size=20)

def on_new_message_received(self, msg: ExecutionState) -> None:
if len(self.goals) > 0:
Expand Down Expand Up @@ -157,8 +157,9 @@ def display_graph(self, goal_index: int, message_index: int, update_position_lab
# Display the graph based on goal and message index
goal_id = self.goals[goal_index]
graph = self.graphs_by_goal[goal_id][message_index]
svg_path = '../../../rqt_giskard/scripts/graph.svg'
svg_path = 'graph.svg'
graph.write_svg(svg_path)
graph.write_pdf('graph.pdf')
with QMutexLocker(self.svg_widget.mutex): # Lock the mutex during SVG loading
self.svg_widget.load(svg_path)

Expand Down
13 changes: 7 additions & 6 deletions src/giskardpy/tree/behaviors/plot_motion_graph.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,18 +16,19 @@
from giskardpy.utils.decorators import record_time, catch_and_raise_to_blackboard
from giskardpy.utils.utils import create_path, json_str_to_kwargs

MyBLUE = '#0000B4'
MyBLUE = '#0000DD'
MyGREEN = '#006600'
MyORANGE = '#996900'
MyRED = '#993000'
MyGRAY = '#E0E0E0'
MonitorTrueGreen = '#CDEACD'
MonitorFalseRed = '#EACDCD'
MonitorTrueGreen = '#B6E5A0'
MonitorFalseRed = '#FF8961'
FONT = 'sans-serif'
LineWidth = 6
ArrowSize = 1.5
Fontsize = 25
ConditionFont = 'monospace'
NotStartedColor = '#9F9F9F'


def extract_monitor_names_from_condition(condition: str) -> List[str]:
Expand All @@ -39,21 +40,21 @@ def search_for_monitor(monitor_name: str, execution_state: ExecutionState) -> gi


task_state_to_color: Dict[TaskState, Tuple[str, str]] = {
TaskState.not_started: ('black', MyGRAY),
TaskState.not_started: (NotStartedColor, MyGRAY),
TaskState.running: (MyBLUE, MyGRAY),
TaskState.on_hold: (MyORANGE, MyGRAY),
TaskState.succeeded: (MyGREEN, MyGRAY),
TaskState.failed: ('red', MyGRAY)
}

monitor_state_to_color: Dict[Tuple[TaskState, int], Tuple[str, str]] = {
(TaskState.not_started, 1): ('black', MonitorTrueGreen),
(TaskState.not_started, 1): (NotStartedColor, MonitorTrueGreen),
(TaskState.running, 1): (MyBLUE, MonitorTrueGreen),
(TaskState.on_hold, 1): (MyORANGE, MonitorTrueGreen),
(TaskState.succeeded, 1): (MyGREEN, MonitorTrueGreen),
(TaskState.failed, 1): ('red', MonitorTrueGreen),

(TaskState.not_started, 0): ('black', MonitorFalseRed),
(TaskState.not_started, 0): (NotStartedColor, MonitorFalseRed),
(TaskState.running, 0): (MyBLUE, MonitorFalseRed),
(TaskState.on_hold, 0): (MyORANGE, MonitorFalseRed),
(TaskState.succeeded, 0): (MyGREEN, MonitorFalseRed),
Expand Down

0 comments on commit 54a38f1

Please sign in to comment.