当前位置: 首页>>代码示例>>Python>>正文


Python DiagnosticStatus.values方法代码示例

本文整理汇总了Python中diagnostic_msgs.msg.DiagnosticStatus.values方法的典型用法代码示例。如果您正苦于以下问题:Python DiagnosticStatus.values方法的具体用法?Python DiagnosticStatus.values怎么用?Python DiagnosticStatus.values使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在diagnostic_msgs.msg.DiagnosticStatus的用法示例。


在下文中一共展示了DiagnosticStatus.values方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: diagnosticsCallback

# 需要导入模块: from diagnostic_msgs.msg import DiagnosticStatus [as 别名]
# 或者: from diagnostic_msgs.msg.DiagnosticStatus import values [as 别名]
def diagnosticsCallback (event):

    array = DiagnosticArray()

    # Set the timestamp for diagnostics
    array.header.stamp = rospy.Time.now()
    
    motors_message = DiagnosticStatus(name = 'PhidgetMotors', level = 0,message = 'initialized', hardware_id='Phidget')
    
    if (motorsError == 1):
        motors_message.level = 2
        motors_message.message = "Phidget Motor controller can't be initialized"
        motors_message.values = [ KeyValue(key = 'Recommendation', value = motorControllerDisconnected)]
    if (motorsError == 2):
        motors_message.level = 2
        motors_message.message = "Can't set up motor speed"
        motors_message.values = [ KeyValue(key = 'Recommendation', value = motorSpeedError)]
        
    encoders_message = DiagnosticStatus(name = 'PhidgetEncoders', level = 0,message = 'initialized', hardware_id='Phidget')
    
    if (encodersError == 1):
        encoders_message.level = 2
        encoders_message.message = "Phidget Encoder board can't be initialized"
        encoders_message.values = [ KeyValue(key = 'Recommendation', value = encoderBoardDisconnected)]
    if (encodersError == 2):
        encoders_message.level = 2
        encoders_message.message = "Can't get encoder value"
        encoders_message.values = [ KeyValue(key = 'Recommendation', value = encoderValueError)]
    
    array.status = [ motors_message, encoders_message ]
  
    diagnosticPub.publish(array)
开发者ID:mBusaleh,项目名称:corobot,代码行数:34,代码来源:PhidgetMotor.py

示例2: status_cb

# 需要导入模块: from diagnostic_msgs.msg import DiagnosticStatus [as 别名]
# 或者: from diagnostic_msgs.msg.DiagnosticStatus import values [as 别名]
def status_cb(msg):
    global BATTERY_STATES
    global diag_publisher
    diag_msg = DiagnosticArray()
    diag_msg.header.stamp = rospy.Time.now()
    diag_msg.status = []
    
    temp_status = DiagnosticStatus()
    temp_status.name = "Chassis Temperature"
    temp_status.hardware_id = "automow_pcb"
    temp_status.values = []
    top_F = msg.temperature_1 * 9/5 + 32
    bot_F = msg.temperature_2 * 9/5 + 32
    temp_status.values.append(KeyValue(key="Top Celsius",
                                       value="%3.2f C"%msg.temperature_1))
    temp_status.values.append(KeyValue(key="Bottom Celsius",
                                       value="%3.2f C"%msg.temperature_2))
    temp_status.values.append(KeyValue(key="Top Fahrenheit",
                                       value="%3.2f F"%(top_F)))
    temp_status.values.append(KeyValue(key="Bottom Fahrenheit",
                                       value="%3.2f F"%(bot_F)))
    if top_F > 100 or bot_F > 100:
        temp_status.message = "High Temperature"
        temp_status.level = temp_status.WARN
    elif top_F > 125 or bot_F > 125:
        temp_status.message = "Critical Temperature"
        temp_status.level = temp_status.ERROR
    else:
        temp_status.message = "OK"
        temp_status.level = temp_status.OK
    diag_msg.status.append(temp_status)

    batt_status = DiagnosticStatus()
    batt_status.name = "Battery Status"
    batt_status.hardware_id = "automow_pcb"
    batt_status.values = []
    state = BATTERY_STATES[msg.battery_state]
    batt_status.values.append(KeyValue(key="State",
                                       value=state))
    batt_status.values.append(KeyValue(key="Charge",
                                       value="{:.0%}".format(msg.charge/100.0)))
    batt_status.values.append(KeyValue(key="Voltage",
                                       value="%3.2f V"%(msg.voltage/1000.0)))
    batt_status.values.append(KeyValue(key="Battery Current",
                                       value="%3.2f A"%(msg.current/1000.0)))
    diag_msg.status.append(batt_status)
    if msg.battery_state >= 4:
        batt_status.level = batt_status.ERROR
    else:
        batt_status.level = batt_status.OK
    batt_status.message = state
    diag_publisher.publish(diag_msg)
开发者ID:Auburn-Automow,项目名称:au_automow_common,代码行数:54,代码来源:diagnostics.py

示例3: battery_status

# 需要导入模块: from diagnostic_msgs.msg import DiagnosticStatus [as 别名]
# 或者: from diagnostic_msgs.msg.DiagnosticStatus import values [as 别名]
 def battery_status(self):
     stat = DiagnosticStatus(name="Battery", level=DiagnosticStatus.OK, message="OK")
     stat.values = [
         KeyValue("Voltage avg(Vin)", str(self.robot.get_avg_voltageIn())),
         KeyValue("Voltage max(Vin)", str(self.robot.get_max_voltageIn())),
         KeyValue("Voltage min(Vin)", str(self.robot.get_min_voltageIn())),
         KeyValue("Current avg(A)", str(self.robot.get_avg_current())),
         KeyValue("Current max(A)", str(self.robot.get_avg_current())),
         KeyValue("Current min(A)", str(self.robot.get_avg_current())),
         KeyValue("Voltage avg(V5V)", str(self.robot.get_avg_5voltage())),
         KeyValue("Voltage max(V5V)", str(self.robot.get_max_5voltage())),
         KeyValue("Voltage min(V5V)", str(self.robot.get_min_5voltage())),
         KeyValue("Voltage avg(V3.3)", str(self.robot.get_avg_3voltage())),
         KeyValue("Voltage max(V3.3)", str(self.robot.get_max_3voltage())),
         KeyValue("Voltage min(V3.3)", str(self.robot.get_min_3voltage()))]
     if self.robot.get_status().VoltageLow == True:
         stat.level = DiagnosticStatus.WARN
         stat.message = "Voltage too low"
     if self.robot.get_status().CurrentError == True:
         stat.level = DiagnosticStatus.WARN
         stat.message = "Current error"
     if self.robot.get_status().Voltage3v3Low == True:
         stat.level = DiagnosticStatus.WARN
         stat.message = "Voltage3.3 too low"
     return stat
开发者ID:KrisPiters,项目名称:Rosbee-Roozbeh,代码行数:27,代码来源:robot_node.py

示例4: fill_diags

# 需要导入模块: from diagnostic_msgs.msg import DiagnosticStatus [as 别名]
# 或者: from diagnostic_msgs.msg.DiagnosticStatus import values [as 别名]
 def fill_diags(name, summary, hid, diags):
     ds = DiagnosticStatus()
     ds.values = [KeyValue(k, str(v)) for (k, v) in diags]
     ds.hardware_id = hid
     ds.name = rospy.get_caller_id().lstrip('/') + ": " + name
     ds.message = summary
     return ds
开发者ID:PR2,项目名称:linux_networking,代码行数:9,代码来源:roam_node2.py

示例5: _camera_diag

# 需要导入模块: from diagnostic_msgs.msg import DiagnosticStatus [as 别名]
# 或者: from diagnostic_msgs.msg.DiagnosticStatus import values [as 别名]
def _camera_diag(level = 0):
    array = DiagnosticArray()
    stat = DiagnosticStatus()
    stat.name = 'wge100: Driver Status'
    stat.level = level
    stat.message = 'OK'

    motor_stat = DiagnosticStatus()
    motor_stat.name = 'EtherCAT Master'
    motor_stat.level = 0
    motor_stat.values = [
        KeyValue(key='Dropped Packets', value='0'),
        KeyValue(key='RX Late Packet', value='0')]

    mcb_stat = DiagnosticStatus()
    mcb_stat.name = 'EtherCAT Device (my_motor)'
    mcb_stat.level = 0
    mcb_stat.values.append(KeyValue('Num encoder_errors', '0'))

    array.header.stamp = rospy.get_rostime()
    array.status.append(stat)
    array.status.append(motor_stat)
    array.status.append(mcb_stat)
        
    return array
开发者ID:willowgarage,项目名称:wg_hardware_test,代码行数:27,代码来源:monitor_latch_test.py

示例6: info_status

# 需要导入模块: from diagnostic_msgs.msg import DiagnosticStatus [as 别名]
# 或者: from diagnostic_msgs.msg.DiagnosticStatus import values [as 别名]
 def info_status(self):
     stat = DiagnosticStatus(name="Info_Platform", level=DiagnosticStatus.OK, message="OK")
     stat.values = [
         KeyValue("", str(self.robot.get_status()[0])),
         KeyValue("", str(self.robot.get_status()[1])),
         KeyValue("", str(self.robot.get_status()[2]))]
     return stat
开发者ID:KrisPiters,项目名称:Rosbee-Roozbeh,代码行数:9,代码来源:robot_node.py

示例7: speed_status

# 需要导入模块: from diagnostic_msgs.msg import DiagnosticStatus [as 别名]
# 或者: from diagnostic_msgs.msg.DiagnosticStatus import values [as 别名]
 def speed_status(self):
     stat = DiagnosticStatus(name="Speed", level=DiagnosticStatus.OK, message="OK")
     stat.values = [
         KeyValue("Linear speed (Vx)", str(self.robot.get_movesteer(None)[0])),
         KeyValue("Angular speed (Vth)", str(self.robot.get_movesteer(None)[2]))]
     if self.robot.get_movesteer(None)[0] > self.speedLimit:
         stat.level = DiagnosticStatus.WARN
         stat.message = "speed is too high"
     return stat
开发者ID:KrisPiters,项目名称:Rosbee-Roozbeh,代码行数:11,代码来源:robot_node.py

示例8: connection_status

# 需要导入模块: from diagnostic_msgs.msg import DiagnosticStatus [as 别名]
# 或者: from diagnostic_msgs.msg.DiagnosticStatus import values [as 别名]
 def connection_status(self):
     stat = DiagnosticStatus(name="Connection", level=DiagnosticStatus.OK, message="OK")
     stat.values = [
         KeyValue("Baudrate", str(self.robot.get_connection_info()["baudrate"])),
         KeyValue("Comport", str(self.robot.get_connection_info()["comport"]))]
     if self.robot.is_connected() == False:
         stat.message = "disconnected"
         stat.level = DiagnosticStatus.ERROR
     return stat
开发者ID:KrisPiters,项目名称:Rosbee-Roozbeh,代码行数:11,代码来源:robot_node.py

示例9: cb_diagnostics_update

# 需要导入模块: from diagnostic_msgs.msg import DiagnosticStatus [as 别名]
# 或者: from diagnostic_msgs.msg.DiagnosticStatus import values [as 别名]
 def cb_diagnostics_update(self):
     tabpage_status = DiagnosticStatus()
     tabpage_status.level = tabpage_status.OK
     tabpage_status.name = self.handler_name + " Handler"
     tabpage_status.hardware_id = self.ros_name
     tabpage_status.message = "OK"
     tabpage_status.values = []
     tabpage_status.values.append(KeyValue(key="Number of Clients",
                                           value=str(len(self.osc_clients))))
     return tabpage_status
开发者ID:Auburn-Automow,项目名称:rososc,代码行数:12,代码来源:diagnosticstabpage.py

示例10: make_status_msg

# 需要导入模块: from diagnostic_msgs.msg import DiagnosticStatus [as 别名]
# 或者: from diagnostic_msgs.msg.DiagnosticStatus import values [as 别名]
def make_status_msg(count):
    array = DiagnosticArray()
    stat = DiagnosticStatus()
    stat.level = 0
    stat.message = 'OK'
    stat.name = 'Unit Test'
    stat.hardware_id = 'HW ID'
    stat.values = [ 
        KeyValue('Value A', str(count)),
        KeyValue('Value B', str(count)),
        KeyValue('Value C', str(count))]
    array.status = [ stat ]
    return array
开发者ID:OspreyX,项目名称:diagnostics,代码行数:15,代码来源:bag_csv_test.py

示例11: update

# 需要导入模块: from diagnostic_msgs.msg import DiagnosticStatus [as 别名]
# 或者: from diagnostic_msgs.msg.DiagnosticStatus import values [as 别名]
 def update(self):
     msg = DiagnosticArray()
     msg.header.stamp = rospy.Time.now()
     msg.status = []
     it = 0
     while it < 20:
         status = DiagnosticStatus()
         status.level = random.randint(0,2)
         status.name = "Test %i"%it
         status.hardware_id = "Dummy Diagnostics"
         if status.level == 0:
             message = "OK"
         elif status.level == 1:
             message = "WARN"
         elif status.level == 2:
             message = "ERROR"
         status.message = message
         status.values = []
         ii = 0
         while ii < 20:
             status.values.append(KeyValue("Key %i"%ii,str(random.randint(0,50))))
             ii += 1
         it += 1
         msg.status.append(status)
     self.publisher.publish(msg)
     msg = DiagnosticArray()
     msg.header.stamp = rospy.Time.now()
     msg.status = []
     status = DiagnosticStatus()
     status.level = status.WARN
     status.name = "Test Warn"
     status.hardware_id = "Dummy Diagnostics"
     status.message = "Warning - This is a test"
     status.values = []
     msg.status.append(status)
     self.publisher.publish(msg)
开发者ID:Auburn-Automow,项目名称:rososc_tutorials,代码行数:38,代码来源:dummydiagnosticsnode.py

示例12: odom_cb

# 需要导入模块: from diagnostic_msgs.msg import DiagnosticStatus [as 别名]
# 或者: from diagnostic_msgs.msg.DiagnosticStatus import values [as 别名]
    def odom_cb(self, msg):
        with self.lock:
            dist = msg.distance + (msg.angle * 0.25)

            # check if base moved
            if dist > self.dist + EPS:
                self.start_time = rospy.Time.now()
                self.start_angle = self.last_angle
                self.dist = dist
        
            # do imu test if possible
            if rospy.Time.now() > self.start_time + rospy.Duration(10.0):
                self.drift = fabs(self.start_angle - self.last_angle)*180/(pi*10)
                self.start_time = rospy.Time.now()
                self.start_angle = self.last_angle
                self.last_measured = rospy.Time.now()
                
            # publish diagnostics
            d = DiagnosticArray()
            d.header.stamp = rospy.Time.now()
            ds = DiagnosticStatus()
            ds.name = "imu_node: Imu Drift Monitor"
            if self.drift < 0.5:
                ds.level = DiagnosticStatus.OK
                ds.message = 'OK'
            elif self.drift < 1.0:
                ds.level = DiagnosticStatus.WARN
                ds.message = 'Drifting'
            else:
                ds.level = DiagnosticStatus.ERROR
                ds.message = 'Drifting'
            drift = self.drift
            if self.drift < 0:
                last_measured = 'No measurements yet, waiting for base to stop moving before measuring'
                drift = 'N/A'
            else:
                age = (rospy.Time.now() - self.last_measured).to_sec()
                if age < 60:
                    last_measured = '%f seconds ago'%age
                elif age < 3600:
                    last_measured = '%f minutes ago'%(age/60)
                else:
                    last_measured = '%f hours ago'%(age/3600)                    
            ds.values = [
                KeyValue('Last measured', last_measured),
                KeyValue('Drift (deg/sec)', str(drift)) ]
            d.status = [ds]
            self.pub_diag.publish(d)
开发者ID:team-diana,项目名称:io-imu-filter-madgwick,代码行数:50,代码来源:imu_monitor.py

示例13: cb_diagnostics_update

# 需要导入模块: from diagnostic_msgs.msg import DiagnosticStatus [as 别名]
# 或者: from diagnostic_msgs.msg.DiagnosticStatus import values [as 别名]
 def cb_diagnostics_update(self):
     """
     Callback periodically called to update the diagnostics status of the
     tabpage handler.
     
     @return: A status message for the tabpage handler
     @rtype: C{diagnostic_msgs/DiagnosticStatus}
     """
     tabpage_status = DiagnosticStatus()
     tabpage_status.level = tabpage_status.OK
     tabpage_status.name = " ".join([self.handler_name,
                                     "Handler"])
     tabpage_status.hardware_id = self.parent.ros_name
     tabpage_status.message = "OK"
     tabpage_status.values = []
     return tabpage_status
开发者ID:Auburn-Automow,项目名称:rososc,代码行数:18,代码来源:abstracttabpage.py

示例14: check_ok

# 需要导入模块: from diagnostic_msgs.msg import DiagnosticStatus [as 别名]
# 或者: from diagnostic_msgs.msg.DiagnosticStatus import values [as 别名]
    def check_ok(self):
        with self._mutex:
            stat = 0 if self._ok else 2
            msg = '' if self._ok else 'Dropped Packets'

            if rospy.get_time() - self._update_time > 3:
                stat = 3
                msg = 'Packet Data Stale'
                if self._update_time == -1:
                    msg = 'No Packet Data'
        
            diag = DiagnosticStatus()
            diag.name = 'EC Stats Packet Data'
            diag.level = stat
            diag.message = msg
            if diag.level == 0:
                diag.message = 'OK'
            
            diag.values = [
                KeyValue(key='Has Link?',              value=str(self._has_link)),
                KeyValue(key='Dropped Since Reset',    value=str(self._total_dropped - self._drop_count_at_reset)),
                KeyValue(key='Total Drops',            value=str(self._total_dropped)),
                KeyValue(key='Lost Link Count',        value=str(self._lost_link_count)),
                KeyValue(key='Lost Links Since Reset', value=str(self._lost_link_count_since_reset)),
                KeyValue(key='Number of Resets',       value=str(self._reset_count)),
                KeyValue(key='Time Since Last Reset',  value=str(rospy.get_time() - self._time_at_last_reset)),
                KeyValue(key='Drops at Last Reset',    value=str(self._drop_count_at_reset)),
                KeyValue(key='Max Device Count',       value=str(self._max_device_count)),
                KeyValue(key='Interval Drops',         value=str(self._interval_dropped)),
                KeyValue(key='Total Late Packets',     value=str(self._total_late)),
                KeyValue(key='Interval Late Packets',  value=str(self._interval_late)),
                KeyValue(key='Total Sent Packets',     value=str(self._total_sent)),
                KeyValue(key='Interval Sent Packets',  value=str(self._interval_sent)),
                KeyValue(key='Total Bandwidth',        value=str(self._total_bandwidth)),
                KeyValue(key='Interval Bandwidth',     value=str(self._interval_bandwidth))
                ]
        
        return stat, msg, [ diag ]
开发者ID:willowgarage,项目名称:wg_hardware_test,代码行数:40,代码来源:ecstats_listener.py

示例15: ntp_monitor

# 需要导入模块: from diagnostic_msgs.msg import DiagnosticStatus [as 别名]
# 或者: from diagnostic_msgs.msg.DiagnosticStatus import values [as 别名]
def ntp_monitor(ntp_hostname, offset=500, self_offset=500, diag_hostname = None, error_offset = 5000000):
    pub = rospy.Publisher("/diagnostics", DiagnosticArray)
    rospy.init_node(NAME, anonymous=True)
    
    hostname = socket.gethostname()
    if diag_hostname is None:
        diag_hostname = hostname

    stat = DiagnosticStatus()
    stat.level = 0
    stat.name = "NTP offset from "+ diag_hostname + " to " + ntp_hostname
    stat.message = "OK"
    stat.hardware_id = hostname
    stat.values = []

    self_stat = DiagnosticStatus()
    self_stat.level = DiagnosticStatus.OK
    self_stat.name = "NTP self-offset for "+ diag_hostname
    self_stat.message = "OK"
    self_stat.hardware_id = hostname
    self_stat.values = []
    
    while not rospy.is_shutdown():
        for st,host,off in [(stat,ntp_hostname,offset), (self_stat, hostname,self_offset)]:
            try:
                p = Popen(["ntpdate", "-q", host], stdout=PIPE, stdin=PIPE, stderr=PIPE)
                res = p.wait()
                (o,e) = p.communicate()
            except OSError, (errno, msg):
                if errno == 4:
                    break #ctrl-c interrupt
                else:
                    raise
            if (res == 0):
                measured_offset = float(re.search("offset (.*),", o).group(1))*1000000

                st.level = DiagnosticStatus.OK
                st.message = "OK"
                st.values = [ KeyValue("Offset (us)", str(measured_offset)),
                              KeyValue("Offset tolerance (us)", str(off)),
                              KeyValue("Offset tolerance (us) for Error", str(error_offset)) ]
            
                if (abs(measured_offset) > off):
                    st.level = DiagnosticStatus.WARN
                    st.message = "NTP Offset Too High"
                if (abs(measured_offset) > error_offset):
                    st.level = DiagnosticStatus.ERROR
                    st.message = "NTP Offset Too High"
                                
            else:
                st.level = DiagnosticStatus.ERROR
                st.message = "Error Running ntpdate. Returned %d" % res
                st.values = [ KeyValue("Offset (us)", "N/A"),
                              KeyValue("Offset tolerance (us)", str(off)),
                              KeyValue("Offset tolerance (us) for Error", str(error_offset)),
                              KeyValue("Output", o),
                              KeyValue("Errors", e) ]


        msg = DiagnosticArray()
        msg.header.stamp = rospy.get_rostime()
        msg.status = [stat, self_stat]
        pub.publish(msg)
        time.sleep(1)
开发者ID:Aharobot,项目名称:spencer_people_tracking,代码行数:66,代码来源:ntp_monitor.py


注:本文中的diagnostic_msgs.msg.DiagnosticStatus.values方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。