def publish_latest_telemetry()

in Robot/src/orchestrated_robot/scripts/telemetry_controller.py [0:0]


    def publish_latest_telemetry(self, pub):

        # connect to robot controller service
        get_robot_info = rospy.ServiceProxy('get_robot_info', RobotInfo)

        while not rospy.is_shutdown():
            utctime = datetime.utcnow().isoformat()

            telemetry = Telemetry()

            # get robot info from robot controller
            resp = get_robot_info()
            robotId = resp.RobotId
            robotStatus = resp.Status
            currentOrder = resp.OrderId

            # create current telemetry
            telemetry.OrderId = currentOrder
            telemetry.Position.X = self.currentPose.position.x
            telemetry.Position.Y = self.currentPose.position.y
            telemetry.id = utctime
            telemetry.Status = robotStatus
            telemetry.RobotId = robotId
            telemetry.CreatedDateTime = utctime

            #rospy.loginfo(telemetry)

            # publish 1 time per second
            rate = rospy.Rate(1)

            pub.publish(telemetry)
            rate.sleep()