From 29348d8df17a7e08e7bd421e332d57a973e8072b Mon Sep 17 00:00:00 2001 From: Kotaro Yoshimoto Date: Mon, 6 Jan 2025 09:58:50 +0900 Subject: [PATCH] =?UTF-8?q?UI=E3=81=8B=E3=82=89=E3=81=AE=E3=82=BB=E3=83=83?= =?UTF-8?q?=E3=82=B7=E3=83=A7=E3=83=B3=E3=82=A4=E3=83=B3=E3=82=B8=E3=82=A7?= =?UTF-8?q?=E3=82=AF=E3=82=B7=E3=83=A7=E3=83=B3=E5=AF=BE=E5=BF=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/consai_visualizer/visualizer.py | 49 +++++++++++++++++++ 1 file changed, 49 insertions(+) diff --git a/consai_ros2/consai_visualizer/src/consai_visualizer/visualizer.py b/consai_ros2/consai_visualizer/src/consai_visualizer/visualizer.py index 54647caf..1e19e8aa 100644 --- a/consai_ros2/consai_visualizer/src/consai_visualizer/visualizer.py +++ b/consai_ros2/consai_visualizer/src/consai_visualizer/visualizer.py @@ -33,6 +33,7 @@ import rclpy from robocup_ssl_msgs.msg import BallReplacement, Replacement, RobotReplacement from rqt_py_common.ini_helper import pack, unpack +from std_msgs.msg import String class Visualizer(Plugin): @@ -126,6 +127,54 @@ def __init__(self, context): self.latest_battery_voltage = [0] * 16 + # self._widget.pushButton.clicked.connect(self.publish) + self._widget.session_injection_comboBox.addItem("HALT") + self._widget.session_injection_comboBox.addItem("STOP") + self._widget.session_injection_comboBox.addItem("OUR_KICKOFF_PREPARATION") + self._widget.session_injection_comboBox.addItem("OUR_KICKOFF_START") + self._widget.session_injection_comboBox.addItem("OUR_PENALTY_PREPARATION") + self._widget.session_injection_comboBox.addItem("OUR_PENALTY_START") + self._widget.session_injection_comboBox.addItem("OUR_DIRECT_FREE") + self._widget.session_injection_comboBox.addItem("OUR_BALL_PLACEMENT") + self._widget.session_injection_comboBox.addItem("THEIR_KICKOFF_PREPARATION") + self._widget.session_injection_comboBox.addItem("THEIR_KICKOFF_START") + self._widget.session_injection_comboBox.addItem("THEIR_PENALTY_PREPARATION") + self._widget.session_injection_comboBox.addItem("THEIR_PENALTY_START") + self._widget.session_injection_comboBox.addItem("THEIR_DIRECT_FREE") + self._widget.session_injection_comboBox.addItem("THEIR_BALL_PLACEMENT") + self._widget.session_injection_comboBox.addItem("INJECTION") + self._widget.session_injection_comboBox.addItem("INPLAY") + self._widget.session_injection_comboBox.addItem("OUR_INPLAY") + self._widget.session_injection_comboBox.addItem("THEIR_INPLAY") + self._widget.session_injection_comboBox.addItem("AMBIGUOUS_INPLAY") + self._widget.session_injection_comboBox.addItem( + "STOP_PRE_OUR_PENALTY_PREPARATION" + ) + self._widget.session_injection_comboBox.addItem( + "STOP_PRE_THEIR_PENALTY_PREPARATION" + ) + self._widget.session_injection_comboBox.addItem( + "STOP_PRE_OUR_KICKOFF_PREPARATION" + ) + self._widget.session_injection_comboBox.addItem( + "STOP_PRE_THEIR_KICKOFF_PREPARATION" + ) + self._widget.session_injection_comboBox.addItem("STOP_PRE_OUR_DIRECT_FREE") + self._widget.session_injection_comboBox.addItem("STOP_PRE_THEIR_DIRECT_FREE") + self._widget.session_injection_comboBox.addItem("STOP_PRE_FORCE_START") + self._widget.session_injection_pushButton.clicked.connect( + self._session_injection + ) + + self._pub_session_injection = self._node.create_publisher( + String, "/session_injection", 10 + ) + + def _session_injection(self): + msg = String() + msg.data = self._widget.session_injection_comboBox.currentText() + self._pub_session_injection.publish(msg) + def _callback_feedback(self, msg): for feedback in msg.feedback: try: