relayboard_sim.py
Go to the documentation of this file.
1 #!/usr/bin/env python
2 #
3 # Copyright 2017 Fraunhofer Institute for Manufacturing Engineering and Automation (IPA)
4 #
5 # Licensed under the Apache License, Version 2.0 (the "License");
6 # you may not use this file except in compliance with the License.
7 # You may obtain a copy of the License at
8 #
9 # http://www.apache.org/licenses/LICENSE-2.0
10 #
11 # Unless required by applicable law or agreed to in writing, software
12 # distributed under the License is distributed on an "AS IS" BASIS,
13 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 # See the License for the specific language governing permissions and
15 # limitations under the License.
16 
17 
18 import rospy
19 from std_msgs.msg import Float64
20 from cob_msgs.msg import EmergencyStopState
21 
23  rospy.init_node('cob_relayboard_sim')
24 
25  # emergency_stop topic
26  pub_em_stop = rospy.Publisher('emergency_stop_state', EmergencyStopState, queue_size=1)
27  msg_em = EmergencyStopState()
28  msg_em.emergency_button_stop = False
29  msg_em.scanner_stop = False
30  msg_em.emergency_state = 0
31 
32  # voltage topic
33  pub_voltage = rospy.Publisher('voltage', Float64, queue_size=1)
34  msg_voltage = Float64()
35  msg_voltage.data = 48.0 # in simulation battery is always full
36 
37  while not rospy.is_shutdown():
38  pub_em_stop.publish(msg_em)
39  pub_voltage.publish(msg_voltage)
40  rospy.sleep(1.0)
41 
42 if __name__ == '__main__':
43  try:
45  except rospy.ROSInterruptException:
46  print("Interupted")
47  pass


cob_relayboard
Author(s): Christian Connette
autogenerated on Wed Apr 7 2021 02:11:46