def start(self, name):
""" Start the field computer """
rospy.init_node(name)
self.oclog('Getting robot_name')
while not rospy.has_param('/ihmc_ros/robot_name'):
print "-------------------------------------------------"
print "Cannot run team_zarj_main.py, missing parameters!"
print "Missing parameter '/ihmc_ros/robot_name'"
print "Likely connection to ROS not present. Retry in 1 second."
print "-------------------------------------------------"
time.sleep(1)
self.oclog('Booting ZarjOS')
self.zarj = ZarjOS()
self.start_task_service = rospy.ServiceProxy(
"/srcsim/finals/start_task", StartTask)
self.task_subscriber = rospy.Subscriber(
"/srcsim/finals/task", Task, self.task_status)
self.harness_subscriber = rospy.Subscriber(
"/srcsim/finals/harness", Harness, self.harness_status)
if HAS_SCORE:
self.score_subscriber = rospy.Subscriber(
"/srcsim/finals/score", Score, self.score_status)
rate = rospy.Rate(10) # 10hz
if self.task_subscriber.get_num_connections() == 0:
self.oclog('waiting for task publisher...')
while self.task_subscriber.get_num_connections() == 0:
rate.sleep()
if self.harness_subscriber.get_num_connections() == 0:
self.oclog('waiting for harness publisher...')
while self.harness_subscriber.get_num_connections() == 0:
rate.sleep()
self.oclog('...got it, field computer is operational!')
评论列表
文章目录