19 from cob_phidgets.msg
import AnalogSensor
20 from cob_phidgets.msg
import DigitalSensor
21 from cob_msgs.msg
import PowerState
22 from cob_msgs.msg
import EmergencyStopState
41 self.
pub_em_state = rospy.Publisher(
'em_stop_state', EmergencyStopState, queue_size=1)
44 front_em_active =
False 45 rear_em_active =
False 48 for i
in range(0, len(msg.uri)):
49 if msg.uri[i] ==
"em_stop_laser_rear":
50 rear_em_active =
not msg.state[i]
52 if msg.uri[i] ==
"em_stop_laser_front":
53 front_em_active =
not msg.state[i]
60 self.em_msg.emergency_button_stop =
True 63 self.em_msg.emergency_button_stop =
False 66 self.em_msg.emergency_button_stop =
False 68 self.em_msg.scanner_stop = (front_em_active
or rear_em_active)
70 self.em_msg.scanner_stop = (front_em_active
or rear_em_active);
72 em_signal = self.em_msg.scanner_stop
or self.em_msg.emergency_button_stop
76 rospy.logdebug(
"Emergency stop was issued")
81 rospy.logdebug(
"Emergency stop was confirmed")
85 rospy.logdebug(
"Emergency stop issued")
88 rospy.logdebug(
"Emergency stop released")
98 self.pub_em_state.publish(self.
em_msg)
101 if __name__ ==
"__main__":
102 rospy.init_node(
"em_state_phidget")
104 rospy.loginfo(
"em_state_phidget running")
105 rate = rospy.Rate(10)
106 while not rospy.is_shutdown():
def phidget_cb(self, msg)