故障诊断模块的设计

2024-06-17 18:36
文章标签 模块 设计 故障诊断

本文主要是介绍故障诊断模块的设计,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!

如何做故障诊断模块的测试呢?

1.组装消息输入

2.进入消息topic的发布

3.查看诊断模块的输出

#!/usr/bin/env python
# -*- encoding: utf-8 -*-
'''
@文件        :control_topic.py
@说明        :
@时间        :2022/03/01 10:24:44
@作者        :mff
@版本        :1.0
'''from diagnose_msgs.msg import ModuleStates, ModuleState
from diagnose_msgs.msg import ControlLimit
from diagnose_msgs.msg import SpeedLimit
from diagnose_msgs.msg import EmcLimit
from diagnose_msgs.msg import Float64Map, Int32Map, BoolMapimport rospy#定时函数
def count_time(start_time, duration):duration1 = rospy.Time.now() - start_timeif duration1 > duration:return Truereturn Falsedef test_4801():topic_name = "/SY01/planning/diagnose_states"pub = rospy.Publisher(topic_name, ModuleStates, queue_size=1000)hz = rospy.Rate(10)msgs = ModuleStates()msg = ModuleState()msg.module_type="planning_module"msg.sub_module_type="sub_planning"msg.sub_module_id  =  "1"map_status = Int32Map()map_status.key = "map_load_status"map_status.value = -1start=rospy.Time.now()duration = rospy.Duration(3)while not rospy.is_shutdown():msg.int_states = []if count_time(start, duration):start = rospy.Time.now()if map_status.value == -1:map_status.value = 0else:map_status.value = -1msgs = ModuleStates()msg.int_states.append(map_status)msg.head.stamp = rospy.Time.now()msgs.states.append(msg)pub.publish(msgs)hz.sleep()def test_4802():topic_name = "/SY01/planning/diagnose_states"pub = rospy.Publisher(topic_name, ModuleStates, queue_size=1000)hz = rospy.Rate(1)msgs = ModuleStates()msg = ModuleState()msg.module_type="planning_module"msg.sub_module_type="sub_planning"msg.sub_module_id  =  "1"map_status = Int32Map()map_status.key = "resolution_status"map_status.value = -1start=rospy.Time.now()duration = rospy.Duration(3)while not rospy.is_shutdown():msg.int_states = []if count_time(start, duration):start = rospy.Time.now()if map_status.value == -1:map_status.value = 0else:map_status.value = -1msgs = ModuleStates()msg.int_states.append(map_status)msg.head.stamp = rospy.Time.now()msgs.states.append(msg)pub.publish(msgs)hz.sleep()if __name__ == "__main__":rospy.init_node("planning")test_4801()# test_4802()

这篇关于故障诊断模块的设计的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!


原文地址:
本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.chinasem.cn/article/1070234

相关文章

MyBatis设计SQL返回布尔值(Boolean)的常见方法

《MyBatis设计SQL返回布尔值(Boolean)的常见方法》这篇文章主要为大家详细介绍了MyBatis设计SQL返回布尔值(Boolean)的几种常见方法,文中的示例代码讲解详细,感兴趣的小伙伴... 目录方案一:使用COUNT查询存在性(推荐)方案二:条件表达式直接返回布尔方案三:存在性检查(EXI

Python logging模块使用示例详解

《Pythonlogging模块使用示例详解》Python的logging模块是一个灵活且强大的日志记录工具,广泛应用于应用程序的调试、运行监控和问题排查,下面给大家介绍Pythonlogging模... 目录一、为什么使用 logging 模块?二、核心组件三、日志级别四、基本使用步骤五、快速配置(bas

Python datetime 模块概述及应用场景

《Pythondatetime模块概述及应用场景》Python的datetime模块是标准库中用于处理日期和时间的核心模块,本文给大家介绍Pythondatetime模块概述及应用场景,感兴趣的朋... 目录一、python datetime 模块概述二、datetime 模块核心类解析三、日期时间格式化与

Python如何调用指定路径的模块

《Python如何调用指定路径的模块》要在Python中调用指定路径的模块,可以使用sys.path.append,importlib.util.spec_from_file_location和exe... 目录一、sys.path.append() 方法1. 方法简介2. 使用示例3. 注意事项二、imp

Python中模块graphviz使用入门

《Python中模块graphviz使用入门》graphviz是一个用于创建和操作图形的Python库,本文主要介绍了Python中模块graphviz使用入门,具有一定的参考价值,感兴趣的可以了解一... 目录1.安装2. 基本用法2.1 输出图像格式2.2 图像style设置2.3 属性2.4 子图和聚

Python的time模块一些常用功能(各种与时间相关的函数)

《Python的time模块一些常用功能(各种与时间相关的函数)》Python的time模块提供了各种与时间相关的函数,包括获取当前时间、处理时间间隔、执行时间测量等,:本文主要介绍Python的... 目录1. 获取当前时间2. 时间格式化3. 延时执行4. 时间戳运算5. 计算代码执行时间6. 转换为指

Python正则表达式语法及re模块中的常用函数详解

《Python正则表达式语法及re模块中的常用函数详解》这篇文章主要给大家介绍了关于Python正则表达式语法及re模块中常用函数的相关资料,正则表达式是一种强大的字符串处理工具,可以用于匹配、切分、... 目录概念、作用和步骤语法re模块中的常用函数总结 概念、作用和步骤概念: 本身也是一个字符串,其中

Python中的getopt模块用法小结

《Python中的getopt模块用法小结》getopt.getopt()函数是Python中用于解析命令行参数的标准库函数,该函数可以从命令行中提取选项和参数,并对它们进行处理,本文详细介绍了Pyt... 目录getopt模块介绍getopt.getopt函数的介绍getopt模块的常用用法getopt模

python logging模块详解及其日志定时清理方式

《pythonlogging模块详解及其日志定时清理方式》:本文主要介绍pythonlogging模块详解及其日志定时清理方式,具有很好的参考价值,希望对大家有所帮助,如有错误或未考虑完全的地... 目录python logging模块及日志定时清理1.创建logger对象2.logging.basicCo

Qt spdlog日志模块的使用详解

《Qtspdlog日志模块的使用详解》在Qt应用程序开发中,良好的日志系统至关重要,本文将介绍如何使用spdlog1.5.0创建满足以下要求的日志系统,感兴趣的朋友一起看看吧... 目录版本摘要例子logmanager.cpp文件main.cpp文件版本spdlog版本:1.5.0采用1.5.0版本主要