added subscribers | icons

Signed-off-by: Jakub Delicat <delicat.kuba@gmail.com>
This commit is contained in:
Jakub Delicat 2023-08-16 17:49:34 +02:00
parent 9164745938
commit c57830c690
6 changed files with 25 additions and 20 deletions

View File

@ -53,8 +53,8 @@ class QtWrapper:
self.widget.angularImage.setPixmap(self.angular_pixmap) self.widget.angularImage.setPixmap(self.angular_pixmap)
self.widget.linearImage.setPixmap(self.linear_pixmap.scaled(20, 48)) self.widget.linearImage.setPixmap(self.linear_pixmap.scaled(20, 48))
self.ok_pixmap = QPixmap("{0}/Ok.jpg".format(ui_directory_path)) self.ok_pixmap = QPixmap("{0}/Ok.png".format(ui_directory_path))
self.cancel_pixmap = QPixmap("{0}/Cancel.jpg".format(ui_directory_path)) self.cancel_pixmap = QPixmap("{0}/Cancel.png".format(ui_directory_path))
def disconnect_signals(self): def disconnect_signals(self):
self.widget.clutchButton.clicked.disconnect() self.widget.clutchButton.clicked.disconnect()

View File

@ -59,22 +59,25 @@ class ROSWrapper(Node):
) )
def setup_subscribers_and_publishers(self, robot_id): def setup_subscribers_and_publishers(self, robot_id):
robot_name = "PIONEER" + str(robot_id) self.robot_info_subscriber = self.create_subscription(
RobotInfoMsg,
f"/pioneer{robot_id}/robot_info",
self.handle_selected_robot_info_update,
qos_profile=self._qos,
)
# self.robot_info_subscriber = rospy.Subscriber(
# "/{0}/RosAria/robot_info".format(robot_name),
# RobotInfoMsg,
# self.handle_selected_robot_info_update,
# )
self.master_stop_subscriber = self.create_subscription( self.master_stop_subscriber = self.create_subscription(
Bool, Bool,
"/pioneers/master_stop", "/pioneers/master_stop",
self.handle_master_stop_update, self.handle_master_stop_update,
qos_profile=self._qos, qos_profile=self._qos,
) )
# self.restrictions_subscriber = rospy.Subscriber( self.restrictions_subscriber = self.create_subscription(
# "/PIONEER/restrictions", RestrictionsMsg, self.handle_restrictions_update RestrictionsMsg,
# ) "/pioneers/restrictions",
self.handle_restrictions_update,
qos_profile=self._qos,
)
self.user_stop_publisher = self.create_publisher( self.user_stop_publisher = self.create_publisher(
Bool, f"/pioneer{robot_id}/user_stop", 10 Bool, f"/pioneer{robot_id}/user_stop", 10
@ -119,7 +122,7 @@ class ROSWrapper(Node):
def publish_periodic_update(self, event): def publish_periodic_update(self, event):
stop_state = self.get_user_stop_state() stop_state = self.get_user_stop_state()
# clutch_state = self.get_clutch_state() clutch_state = self.get_clutch_state()
if stop_state == SS.RUNNING: if stop_state == SS.RUNNING:
self.user_robot_enabled() self.user_robot_enabled()
@ -130,12 +133,14 @@ class ROSWrapper(Node):
"stop_state UNKNOWN when attempting to publish periodic update" "stop_state UNKNOWN when attempting to publish periodic update"
) )
# if clutch_state == CS.ENGAGED: if clutch_state == CS.ENGAGED:
# self.engage_clutch() self.engage_clutch()
# elif clutch_state == CS.DISENGAGED: elif clutch_state == CS.DISENGAGED:
# self.disengage_clutch() self.disengage_clutch()
# else: else:
# raise ValueError('clutch_state UNKNOWN when attempting to publish periodic update') raise ValueError(
"clutch_state UNKNOWN when attempting to publish periodic update"
)
def update_hz_values(self): def update_hz_values(self):
print("update_hz_values") print("update_hz_values")
@ -212,7 +217,7 @@ class ROSWrapper(Node):
def _get_robots_list(self): def _get_robots_list(self):
robots_id_list = [] robots_id_list = []
# Można to zrobić lepiej np. czekać na publikowaną wiadomość na robot_info # NOTE: Można to zrobić lepiej np. czekać na publikowaną wiadomość na robot_info
for pioneer_id in range(6): for pioneer_id in range(6):
published_topics_list = [] published_topics_list = []
try: try:
@ -259,7 +264,7 @@ class ROSWrapper(Node):
def handle_selected_robot_info_update(self, msg): def handle_selected_robot_info_update(self, msg):
# Restarting connection timer to avoid raising robot_connection_lost_callback # Restarting connection timer to avoid raising robot_connection_lost_callback
self.restart_connection_timer() # self.restart_connection_timer()
_robot_info = RobotInfo(0) _robot_info = RobotInfo(0)
_robot_info.update_robot_info(msg) _robot_info.update_robot_info(msg)

Binary file not shown.

Before

Width:  |  Height:  |  Size: 17 KiB

BIN
ui/Cancel.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 28 KiB

BIN
ui/Ok.jpg

Binary file not shown.

Before

Width:  |  Height:  |  Size: 13 KiB

BIN
ui/Ok.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 23 KiB