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

add button for clearing the TF buffer #9

Merged
merged 3 commits into from Sep 9, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
7 changes: 7 additions & 0 deletions resource/RosTfTree.ui
Expand Up @@ -19,6 +19,13 @@
<layout class="QVBoxLayout" name="verticalLayout" stretch="0,0">
<item>
<layout class="QHBoxLayout" name="horizontalLayout" stretch="0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0">
<item>
<widget class="QPushButton" name="clear_buffer_push_button">
<property name="toolTip">
<string>Clear TF Buffer</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="refresh_graph_push_button">
<property name="toolTip">
Expand Down
2 changes: 1 addition & 1 deletion src/rqt_tf_tree/dotcode_tf.py
Expand Up @@ -104,7 +104,7 @@ def generate(self, data, timestamp):
rankdir=self.rankdir,
ranksep=self.ranksep)

if len(data) == 0:
if data is None or len(data) == 0:
self.dotcode_factory.add_node_to_graph(graph, "No tf data received")
return graph

Expand Down
6 changes: 6 additions & 0 deletions src/rqt_tf_tree/tf_tree.py
Expand Up @@ -88,6 +88,9 @@ def __init__(self, context):
self._scene.setBackgroundBrush(Qt.white)
self._widget.graphics_view.setScene(self._scene)

self._widget.clear_buffer_push_button.setIcon(QIcon.fromTheme('edit-delete'))
self._widget.clear_buffer_push_button.pressed.connect(self._clear_buffer)

self._widget.refresh_graph_push_button.setIcon(QIcon.fromTheme('view-refresh'))
self._widget.refresh_graph_push_button.pressed.connect(self._update_tf_graph)

Expand Down Expand Up @@ -127,6 +130,9 @@ def restore_settings(self, plugin_settings, instance_settings):
self.initialized = True
self._refresh_tf_graph()

def _clear_buffer(self):
self.tf2_buffer_.clear()

def _update_tf_graph(self):
self._force_refresh = True
self._refresh_tf_graph()
Expand Down