fake_error_codes.py
Go to the documentation of this file.
1 #!/usr/bin/env python
2 # -*- coding: utf-8 -*-
3 
4 import rospy
5 from std_msgs.msg import String
6 from amr_interop_msgs.msg import ErrorCodes
7 import random
8 
9 ERROR_CODES = [
10  "Robot safety stop based on sensors",
11  "Robot stopped",
12  "Battery Low",
13  "Robot Lost",
14  "Robot Stuck",
15 ]
16 
17 if __name__ == "__main__":
18  rospy.init_node("fake_error_codes")
19 
20  pub = rospy.Publisher("error_codes", ErrorCodes, queue_size=1)
21  publish_rate = rospy.get_param("~publish_rate", 1)
22 
23  loop_rate = rospy.Rate(publish_rate)
24  error_codes_msg = ErrorCodes()
25  while not rospy.is_shutdown():
26  error_count = random.randint(0, len(ERROR_CODES))
27  error_codes_msg.data = random.sample(ERROR_CODES, error_count)
28  pub.publish(error_codes_msg)
29  loop_rate.sleep()


amr_interop_bridge
Author(s):
autogenerated on Tue Mar 1 2022 23:45:33