Skip to content

Commit

Permalink
UIからのセッションインジェクション対応
Browse files Browse the repository at this point in the history
  • Loading branch information
HansRobo committed Jan 6, 2025
1 parent 4f3103a commit 29348d8
Showing 1 changed file with 49 additions and 0 deletions.
49 changes: 49 additions & 0 deletions consai_ros2/consai_visualizer/src/consai_visualizer/visualizer.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down Expand Up @@ -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:
Expand Down

0 comments on commit 29348d8

Please sign in to comment.