21 PilzStatusIndicatorWidget
22 from prbt_hardware_support.msg
import OperationModes
24 from std_msgs.msg
import Bool, Float64
26 TOPIC_OPERATION_MODE =
"/prbt/operation_mode" 27 TOPIC_STATE_HW =
"/prbt/status_info/state_hw" 28 TOPIC_STATE_ROS =
"/prbt/status_info/state_ros" 29 TOPIC_SPEED_OVERRIDE =
"/prbt/speed_override" 33 """Implementation of the status indicator as rqt plugin. It will 34 instantiate the Qt widget and handle the connection between ROS and its 38 """Instantiate the plugin within its context with its initial state.""" 39 super(PilzStatusIndicatorRqt, self).
__init__(context)
40 self.setObjectName(
'PilzStatusIndicatorRqt')
41 self.
_widget = PilzStatusIndicatorWidget(context.serial_number())
44 self._widget.set_ROS_status(
False)
45 self._widget.set_HW_status(
False)
47 self._widget.set_operation_mode(OperationModes.UNKNOWN)
49 self._widget.set_speed(.5)
53 rospy.Subscriber(TOPIC_STATE_HW, Bool,
55 rospy.Subscriber(TOPIC_OPERATION_MODE, OperationModes,
57 rospy.Subscriber(TOPIC_SPEED_OVERRIDE, Float64, self.
speed_callback)
59 context.add_widget(self.
_widget)
62 """Callback for HW Status.""" 63 self._widget.set_HW_status(msg.data)
66 """Callback for ROS Status.""" 67 self._widget.set_ROS_status(msg.data)
70 """Callback for Operation Mode.""" 71 rospy.logdebug(
"set_operation_mode: " + str(msg))
72 self._widget.set_operation_mode(msg.value)
75 """Callback for Speed Override.""" 77 self._widget.set_speed(val)
def operation_mode_callback(self, msg)
def ros_status_callback(self, msg)
def speed_callback(self, msg)
def hw_status_callback(self, msg)
def __init__(self, context)