Пример #1
0
    def send_status(self, event=None):
        msg = AcousticModemStatus()
        msg.header.stamp = rospy.Time.now()
        msg.status = MODEM_STATUS[self.modem_status]
        msg.battery_level = self.battery_level
        # print 'im_ack_cnt', self.im_ack_cnt
        # print 'burst_ack_cnt', self.burst_ack_cnt

        if self.sent_im_ack_cnt > 0 and self.sent_burst_cnt > 0:
            info = {
                'im_ack_success_rate': str(self.im_ack_cnt/self.sent_im_ack_cnt),
                'im_burst_rate': str(self.burst_ack_cnt/self.sent_burst_cnt),
                'total_sent': str(self.sent_burst_cnt + self.sent_im_ack_cnt),
                'total_received': str(self.received_cnt)
            }
            msg.info = [KeyValue(key, value) for key, value in info.items()]

        self.pub_status.publish(msg)
Пример #2
0
    def send_status(self, event=None):
        ms = AcousticModemStatus()
        ms.header.stamp = rospy.Time.now()
        ms.status = MODEM_STATUS[self.modem_status]

        self.pub_status.publish(ms)
    def send_status(self, event=None):
        ms = AcousticModemStatus()
        ms.header.stamp = rospy.Time.now()
        ms.status = MODEM_STATUS[self.modem_status]

        self.pub_status.publish(ms)