This repository has been archived by the owner on Jan 28, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into dev/vision-wrapper
- Loading branch information
Showing
21 changed files
with
320 additions
and
50 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
cmake_minimum_required(VERSION 3.5) | ||
project(consai2r2_gameviewer) | ||
|
||
# Load ament and all dependencies required for this package | ||
find_package(ament_cmake REQUIRED) | ||
find_package(ament_cmake_python REQUIRED) | ||
|
||
ament_python_install_package(${PROJECT_NAME} | ||
PACKAGE_DIR src/${PROJECT_NAME}) | ||
|
||
install(FILES plugin.xml | ||
DESTINATION share/${PROJECT_NAME} | ||
) | ||
|
||
install(DIRECTORY resource | ||
DESTINATION share/${PROJECT_NAME} | ||
) | ||
|
||
install(PROGRAMS scripts/consai2r2_gameviewer | ||
DESTINATION lib/${PROJECT_NAME} | ||
) | ||
|
||
ament_package() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
<?xml version="1.0"?> | ||
<?xml-model href="http://download.ros.org/schema/package_format3.xsd" schematypens="http://www.w3.org/2001/XMLSchema"?> | ||
<package format="3"> | ||
<name>consai2r2_gameviewer</name> | ||
<version>0.0.0</version> | ||
<description>consai2r2_gameviewer provides a GUI plugin for displaying vision and referee messages.</description> | ||
<maintainer email="macakasit@gmail.com">akshota</maintainer> | ||
<license>MIT</license> | ||
|
||
<buildtool_depend>ament_cmake</buildtool_depend> | ||
|
||
<exec_depend>ament_index_python</exec_depend> | ||
<exec_depend version_gte="0.2.19">python_qt_binding</exec_depend> | ||
<exec_depend>rclpy</exec_depend> | ||
<exec_depend>rqt_gui</exec_depend> | ||
<exec_depend>rqt_gui_py</exec_depend> | ||
<exec_depend>rqt_py_common</exec_depend> | ||
|
||
<export> | ||
<!-- <architecture_independent/> --> | ||
<rqt_gui plugin="${prefix}/plugin.xml"/> | ||
<build_type>ament_cmake</build_type> | ||
</export> | ||
</package> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
<library path="src"> | ||
<class name="GameViewer" type="consai2r2_gameviewer.gameviewer.GameViewer" base_class_type="rqt_gui_py::Plugin"> | ||
<description> | ||
A Python GUI plugin for displaying vision and referee messages. | ||
</description> | ||
<qtgui> | ||
<group> | ||
<label>Visualization</label> | ||
<icon type="theme">folder</icon> | ||
<statustip>Plugins related to visualization.</statustip> | ||
</group> | ||
<label>CON-SAI2 R2 GameViewer</label> | ||
<icon type="theme">image-x-generic</icon> | ||
<statustip>A Python GUI plugin for displaying vision and referee messages.</statustip> | ||
</qtgui> | ||
</class> | ||
</library> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<ui version="4.0"> | ||
<class>GameViewerWidget</class> | ||
<widget class="QWidget" name="GameViewerWidget"> | ||
<property name="geometry"> | ||
<rect> | ||
<x>0</x> | ||
<y>0</y> | ||
<width>400</width> | ||
<height>300</height> | ||
</rect> | ||
</property> | ||
<property name="windowTitle"> | ||
<string>GameViewer</string> | ||
</property> | ||
</widget> | ||
<resources/> | ||
<connections/> | ||
</ui> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
#!/usr/bin/env python3 | ||
|
||
import sys | ||
|
||
from rqt_gui.main import Main | ||
|
||
main = Main() | ||
sys.exit(main.main(sys.argv, standalone='consai2r2_gameviewer.gameviewer.GameViewer')) |
Empty file.
62 changes: 62 additions & 0 deletions
62
consai2r2_gameviewer/src/consai2r2_gameviewer/gameviewer.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
# Copyright (c) 2019 SSL-Roots | ||
# | ||
# Permission is hereby granted, free of charge, to any person obtaining a copy | ||
# of this software and associated documentation files (the "Software"), to deal | ||
# in the Software without restriction, including without limitation the rights | ||
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
# copies of the Software, and to permit persons to whom the Software is | ||
# furnished to do so, subject to the following conditions: | ||
# | ||
# The above copyright notice and this permission notice shall be included in | ||
# all copies or substantial portions of the Software. | ||
# | ||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL | ||
# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN | ||
# THE SOFTWARE. | ||
|
||
from qt_gui.plugin import Plugin | ||
from python_qt_binding.QtCore import QTimer | ||
|
||
from consai2r2_gameviewer.gameviewer_widget import GameViewerWidget | ||
|
||
|
||
class GameViewer(Plugin): | ||
|
||
""" | ||
consai2r2_gameviwer plugin's main class. | ||
""" | ||
|
||
def __init__(self, context): | ||
""" | ||
:param context: plugin context hook to enable adding widgets as a ROS_GUI pane, | ||
''PluginContext'' | ||
""" | ||
super(GameViewer, self).__init__(context) | ||
self.setObjectName('GameViewer') | ||
|
||
self._context = context | ||
|
||
self._widget = GameViewerWidget() | ||
if context.serial_number() > 1: | ||
self._widget.setWindowTitle( | ||
self._widget.windowTitle() + (' (%d)' % context.serial_number())) | ||
context.add_widget(self._widget) | ||
|
||
self._timer = QTimer() | ||
self._timer.timeout.connect(self._widget.update) | ||
self._timer.start(16) # the argument is msec interval | ||
|
||
def shutdown_plugin(self): | ||
self._timer.stop() | ||
pass | ||
|
||
def save_settings(self, plugin_settings, instance_settings): | ||
pass | ||
|
||
def restore_settings(self, plugin_settings, instance_settings): | ||
pass | ||
|
57 changes: 57 additions & 0 deletions
57
consai2r2_gameviewer/src/consai2r2_gameviewer/gameviewer_widget.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
# Copyright (c) 2019 SSL-Roots | ||
# | ||
# Permission is hereby granted, free of charge, to any person obtaining a copy | ||
# of this software and associated documentation files (the "Software"), to deal | ||
# in the Software without restriction, including without limitation the rights | ||
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
# copies of the Software, and to permit persons to whom the Software is | ||
# furnished to do so, subject to the following conditions: | ||
# | ||
# The above copyright notice and this permission notice shall be included in | ||
# all copies or substantial portions of the Software. | ||
# | ||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL | ||
# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN | ||
# THE SOFTWARE. | ||
|
||
import os | ||
|
||
from ament_index_python.resources import get_resource | ||
|
||
from python_qt_binding import loadUi | ||
from python_qt_binding.QtWidgets import QWidget | ||
from python_qt_binding.QtGui import QPainter | ||
from python_qt_binding.QtCore import Qt | ||
|
||
class GameViewerWidget(QWidget): | ||
|
||
""" | ||
Primary widget for the consai2r2_gameviewer plugin. | ||
""" | ||
|
||
def __init__(self): | ||
super(GameViewerWidget, self).__init__() | ||
|
||
pkg_name = 'consai2r2_gameviewer' | ||
_, package_path = get_resource('packages', pkg_name) | ||
ui_file = os.path.join( | ||
package_path, 'share', pkg_name, 'resource', 'gameviewer_widget.ui') | ||
loadUi(ui_file, self) | ||
|
||
self.setObjectName('GameViewerWidget') | ||
|
||
|
||
def paintEvent(self, event): | ||
painter = QPainter(self) | ||
|
||
# Hello world | ||
painter.setBrush(Qt.green) | ||
painter.setPen(Qt.black) | ||
painter.drawRect(self.rect()) | ||
|
||
painter.drawText(self.rect().width()*0.5, self.rect().height()*0.5, "Hello world!") | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.