Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Q
qubo_gui
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Robotics at Maryland
qubo_gui
Compare revisions
f6f88444f5a918988d4da962f41b6c0b6bfb65fb to bf42c3fe43fac506b7925b44ffe9664c2f222599
Compare revisions
Changes are shown as if the
source
revision was being merged into the
target
revision.
Learn more about comparing revisions.
Source
robotics-at-maryland/qubo_gui
Select target project
No results found
bf42c3fe43fac506b7925b44ffe9664c2f222599
Select Git revision
Branches
main
teleop
thruster-text
Swap
Target
robotics-at-maryland/qubo_gui
Select target project
robotics-at-maryland/qubo_gui
1 result
f6f88444f5a918988d4da962f41b6c0b6bfb65fb
Select Git revision
Branches
main
teleop
thruster-text
Show changes
Only incoming changes from source
Include changes to target since source was created
Compare
Commits on Source (2)
added text-based thruster control
· e2c5301b
nic
authored
6 months ago
e2c5301b
Merge branch 'main' of code.umd.edu:robotics-at-maryland/qubo_gui into main
· bf42c3fe
nic
authored
6 months ago
bf42c3fe
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
plugin.xml
+14
-0
14 additions, 0 deletions
plugin.xml
qubo_gui/qubo_gui.py
+1
-1
1 addition, 1 deletion
qubo_gui/qubo_gui.py
qubo_gui/thruster_control_text.py
+128
-0
128 additions, 0 deletions
qubo_gui/thruster_control_text.py
with
143 additions
and
1 deletion
plugin.xml
View file @
bf42c3fe
...
...
@@ -13,6 +13,20 @@
</qtgui>
</class>
<class
name=
"ThrustersPlugin_Text"
type=
"qubo_gui.thruster_control_text.ThrusterControl_Text"
base_class_type=
"rqt_gui_py::Plugin"
>
<description>
An example Python GUI plugin to create a great user interface.
</description>
<qtgui>
<group>
<label>
Qubo Control
</label>
</group>
<label>
Qubo Thruster Control Text
</label>
<icon
type=
"theme"
>
system-help
</icon>
<statustip>
Great user interface to provide real value.
</statustip>
</qtgui>
</class>
<class
name=
"ExamplePlugin"
type=
"qubo_gui.plugin2.Plugin2"
base_class_type=
"rqt_gui_py::Plugin"
>
<description>
An example Python GUI plugin to create a great user interface.
...
...
This diff is collapsed.
Click to expand it.
qubo_gui/qubo_gui.py
View file @
bf42c3fe
from
.thruster_control
import
Thruster
s
from
.thruster_control
import
Thruster
Widget
def
main
():
print
(
'
Hi from qubo_gui.
'
)
...
...
This diff is collapsed.
Click to expand it.
qubo_gui/thruster_control_text.py
0 → 100644
View file @
bf42c3fe
"""
This file implements an rqt plugin for controlling individual thrusters on Qubo.
Set
"""
import
random
from
qt_gui.plugin
import
Plugin
from
python_qt_binding
import
QtCore
from
python_qt_binding.QtCore
import
Qt
from
python_qt_binding.QtGui
import
QIntValidator
from
python_qt_binding.QtWidgets
import
QWidget
,
QLabel
,
QSlider
,
QPushButton
,
QHBoxLayout
,
QVBoxLayout
,
QLineEdit
,
QDoubleSpinBox
# https://stackoverflow.com/questions/77934193/how-can-i-create-a-simple-gui-using-an-rqt-plugin
class
ThrusterControl_Text
(
Plugin
):
def
__init__
(
self
,
context
):
super
(
ThrusterControl_Text
,
self
).
__init__
(
context
)
self
.
_context
=
context
self
.
setObjectName
(
"
ThrustersPlugin_Text
"
)
self
.
_widget
=
QWidget
()
front_widget
=
QWidget
()
front
=
QHBoxLayout
(
front_widget
)
front_left
=
ThrusterWidget
(
"
Front Left
"
,
top_topic
=
"
/thruster1
"
,
bottom_topic
=
"
/thruster2
"
)
front_right
=
ThrusterWidget
(
"
Front Right
"
,
""
,
""
)
front
.
addWidget
(
front_left
)
front
.
addWidget
(
front_right
)
back_widget
=
QWidget
()
back
=
QHBoxLayout
(
back_widget
)
back_left
=
ThrusterWidget
(
"
Back Left
"
,
""
,
""
)
back_right
=
ThrusterWidget
(
"
Back Right
"
,
""
,
""
)
back
.
addWidget
(
back_left
)
back
.
addWidget
(
back_right
)
self
.
_stop_button
=
QPushButton
(
"
Global Stop
"
)
# When _stop_button's "clicked" signal is emitted, all thruster control widgets
# will have their stop_top and stop_bottom slots triggered.
for
w
in
[
front_left
,
front_right
,
back_left
,
back_right
]:
self
.
_stop_button
.
clicked
.
connect
(
w
.
stop_top
)
self
.
_stop_button
.
clicked
.
connect
(
w
.
stop_bottom
)
layout
=
QVBoxLayout
(
self
.
_widget
)
layout
.
addWidget
(
self
.
_stop_button
)
layout
.
addWidget
(
front_widget
)
layout
.
addWidget
(
back_widget
)
context
.
add_widget
(
self
.
_widget
)
# Widget to control two thrusters (top and bottom one).
class
ThrusterWidget
(
QWidget
):
PWM_STOP
=
1500
PWM_MIN
=
1400
PWM_MAX
=
1600
def
__init__
(
self
,
title
,
top_topic
,
bottom_topic
):
super
().
__init__
()
self
.
_top_topic
=
top_topic
self
.
_bottom_topic
=
bottom_topic
title_label
=
QLabel
(
title
)
self
.
top_stop_btn
=
QPushButton
(
"
Stop
"
)
self
.
top_pwm_label
=
QLabel
()
self
.
top_entry
=
QDoubleSpinBox
()
self
.
top_entry
.
setMaximum
(
self
.
PWM_MAX
)
self
.
top_entry
.
setMinimum
(
self
.
PWM_MIN
)
self
.
top_entry
.
setValue
(
self
.
PWM_STOP
)
self
.
top_entry
.
setDecimals
(
0
)
self
.
top_entry
.
setSingleStep
(
5
)
self
.
bottom_entry
=
QDoubleSpinBox
()
self
.
bottom_entry
.
setMaximum
(
self
.
PWM_MAX
)
self
.
bottom_entry
.
setMinimum
(
self
.
PWM_MIN
)
self
.
bottom_entry
.
setValue
(
self
.
PWM_STOP
)
self
.
bottom_entry
.
setDecimals
(
0
)
self
.
bottom_entry
.
setSingleStep
(
5
)
self
.
bottom_stop_btn
=
QPushButton
(
"
Stop
"
)
self
.
bottom_pwm_label
=
QLabel
()
top_widget
=
QWidget
()
top_layout
=
QHBoxLayout
(
top_widget
)
top_layout
.
addWidget
(
self
.
top_stop_btn
)
top_layout
.
addWidget
(
self
.
top_pwm_label
)
bottom_widget
=
QWidget
()
bottom_layout
=
QHBoxLayout
(
bottom_widget
)
bottom_layout
.
addWidget
(
self
.
bottom_stop_btn
)
bottom_layout
.
addWidget
(
self
.
bottom_pwm_label
)
self
.
layout
=
QVBoxLayout
(
self
)
self
.
layout
.
addWidget
(
top_widget
)
self
.
layout
.
addWidget
(
self
.
top_entry
)
self
.
layout
.
addWidget
(
self
.
bottom_entry
)
self
.
layout
.
addWidget
(
bottom_widget
)
self
.
top_pwm_label
.
setText
(
f
"
PWM:
{
self
.
PWM_STOP
}
"
)
self
.
top_entry
.
valueChanged
.
connect
(
self
.
on_top_value_changed
)
self
.
bottom_pwm_label
.
setText
(
f
"
PWM:
{
self
.
PWM_STOP
}
"
)
self
.
bottom_entry
.
valueChanged
.
connect
(
self
.
on_bottom_value_changed
)
self
.
top_stop_btn
.
clicked
.
connect
(
self
.
stop_top
)
self
.
bottom_stop_btn
.
clicked
.
connect
(
self
.
stop_bottom
)
@QtCore.Slot
(
float
)
def
on_top_value_changed
(
self
,
value
):
self
.
top_pwm_label
.
setText
(
f
"
PWM:
{
int
(
value
)
}
"
)
# TODO: Publish on ROS to set actual PWM. Make sure we have a controller to prevent PWM from changing too rapidly.
@QtCore.Slot
(
float
)
def
on_bottom_value_changed
(
self
,
value
):
self
.
bottom_pwm_label
.
setText
(
f
"
PWM:
{
int
(
value
)
}
"
)
self
.
bottom_entry
.
clear
()
# TODO: Publish on ROS to set actual PWM.
@QtCore.Slot
()
def
stop_top
(
self
):
self
.
top_pwm_label
.
setText
(
f
"
PWM:
{
self
.
PWM_STOP
}
"
)
self
.
top_entry
.
clear
()
@QtCore.Slot
()
def
stop_bottom
(
self
):
self
.
bottom_pwm_label
.
setText
(
f
"
PWM:
{
self
.
PWM_STOP
}
"
)
self
.
bottom_entry
.
clear
()
This diff is collapsed.
Click to expand it.