Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#WIP Decorator as Behaviour #14

Open
wants to merge 1 commit into
base: devel
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
*.pyc
*.vscode
6 changes: 6 additions & 0 deletions src/rqt_py_trees/dotcode_behaviour.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,8 @@ def type_to_shape(self, behaviour_type):
return 'note'
elif behaviour_type == py_trees_msgs.Behaviour.CHOOSER:
return 'doubleoctagon'
elif behaviour_type == py_trees_msgs.Behaviour.DECORATOR:
return 'invhouse'
else:
return 'ellipse'

Expand All @@ -128,6 +130,8 @@ def type_to_colour(self, behaviour_type):
return '#ffd700'
elif behaviour_type == py_trees_msgs.Behaviour.CHOOSER:
return '#808080'
elif behaviour_type == py_trees_msgs.Behaviour.DECORATOR:
return '#ff9900'
else:
return None

Expand All @@ -142,6 +146,8 @@ def type_to_string(self, behaviour_type):
return 'Parallel'
elif behaviour_type == py_trees_msgs.Behaviour.CHOOSER:
return 'Chooser'
elif behaviour_type == py_trees_msgs.Behaviour.DECORATOR:
return 'Decorator'
else:
return None

Expand Down
9 changes: 9 additions & 0 deletions src/rqt_py_trees/qt_dotgraph/node_item.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,15 @@ def __init__(self, highlight_level, bounding_box, label, shape, color=None, pare
QPointF(rect[0] + rect[2], rect[1] + rect[3] / 5)])
self._graphics_item = QGraphicsPolygonItem(note_polygon)

elif shape == 'invhouse':
rect = bounding_box.getRect()
invhouse_polygon = QPolygonF([QPointF(rect[0], rect[1]),
QPointF(rect[0], rect[1] + 3 * rect[3] / 4),
QPointF(rect[0] + rect[2]/2, rect[1] + rect[3]),
QPointF(rect[0] + rect[2], rect[1] + 3 * rect[3] / 4),
QPointF(rect[0] + rect[2], rect[1])])
self._graphics_item = QGraphicsPolygonItem(invhouse_polygon)

else:
self._graphics_item = QGraphicsEllipseItem(bounding_box)
self.addToGroup(self._graphics_item)
Expand Down