当前位置: 首页 > news >正文

网站营销推广公司优化措施最新回应

网站营销推广公司,优化措施最新回应,织梦做淘宝客网站视频,网站公安部备案号vda5050 VDA5050协议介绍 和 详细翻译-CSDN博客 ros与mqtt相互转换 如何转换的,通过某个中转包,获取ros的消息然后以需要的格式转换为mqtt 需要的参数 ros相关 parameters[ (ros_subscriber_type, vda5050_msgs/NodeState), (ros_subscriber_queue…

vda5050

VDA5050协议介绍 和 详细翻译-CSDN博客

ros与mqtt相互转换

如何转换的,通过某个中转包,获取ros的消息然后以需要的格式转换为mqtt

需要的参数

ros相关

parameters=[
('ros_subscriber_type', 'vda5050_msgs/NodeState'),
('ros_subscriber_queue', 1),
]

mqtt相关

parameters=[
('interface_name', 'uagv'),
('major_version', 'v2'),
('manufacturer', 'RobotCompany'),
('serial_number', 'carter01'),
('mqtt_client_name', 'RosToMqttBridge'),
('mqtt_host_name', 'localhost'),
('mqtt_port', 1883),
('mqtt_transport', 'tcp'),
('mqtt_ws_path', ''),
('mqtt_keep_alive', 60),
('convert_snake_to_camel', True),
('reconnect_period', 5),
('retry_forever', False),
('num_retries', 10)
]

ros需要的内容

订阅了需要转换为mqtt的ros订阅者

self.subscription = self.create_subscription(ros_loader.get_message_class(self.get_parameter('ros_subscriber_type').value),'ros_sub_topic', self.__ros_subscriber_callback,self.get_parameter('ros_subscriber_queue').value)

mqtt需要的内容

mqtt客户端

self.mqtt_client = mqtt.Client(self.get_parameter('mqtt_client_name').value,transport=self.get_parameter('mqtt_transport').value)

mqtt配置项

if self.get_parameter('mqtt_transport').value == 'websockets' and \self.get_parameter('mqtt_ws_path').value != '':self.mqtt_client.ws_set_options(path=self.get_parameter('mqtt_ws_path').value)self.interface_name = self.get_parameter('interface_name').valueself.major_version = self.get_parameter('major_version').valueself.manufacturer = self.get_parameter('manufacturer').valueself.serial_number = self.get_parameter('serial_number').valueself.mqtt_topic_prefix = \f'{self.interface_name}/{self.major_version}/{self.manufacturer}/{self.serial_number}'

mqtt状态检查

基于次数、或bool值,结合try-except来实现对mqtt_host_name、mqtt_port、mqtt_keep_alive的检查

max_retries = self.get_parameter('num_retries').valueretries = 0connected = Falseretry_forever = self.get_parameter('retry_forever').valuewhile retries < max_retries or retry_forever:try:self.mqtt_client.connect(self.get_parameter('mqtt_host_name').value,self.get_parameter('mqtt_port').value,self.get_parameter('mqtt_keep_alive').value)connected = Truebreakexcept ConnectionRefusedError as e:self.get_logger().error(f'Connection Error: {e}. Please check the mqtt_host_name.')time.sleep(self.get_parameter('reconnect_period').value)retries += 1except socket.timeout as e:self.get_logger().error(f'Connection Error: {e}. Please check the mqtt_host_name'' and make sure it is reachable.')time.sleep(self.get_parameter('reconnect_period').value)retries += 1except socket.gaierror as e:self.get_logger().error(f'Connection Error: {e}. Could not resolve mqtt_host_name')time.sleep(self.get_parameter('reconnect_period').value)retries += 1if connected:self.mqtt_client.loop_start()else:self.get_logger().error('Failed to connect to MQTT broker, ending retries.')

ros话题转换mqtt

需要使用的包

from rosbridge_library.internal import message_conversion
import json

使用message_conversion提取话题数据,利用json将提取的数据转换并发布到mqtt客户端中。

 def __ros_subscriber_callback(self, msg):try:extracted = message_conversion.extract_values(msg)if self.get_parameter('convert_snake_to_camel').value:self.mqtt_client.publish(f'{self.mqtt_topic_prefix}/state',json.dumps(convert_dict_keys(extracted, 'snake_to_dromedary')))else:self.mqtt_client.publish(f'{self.mqtt_topic_prefix}/state', json.dumps(extracted))except (message_conversion.FieldTypeMismatchException,json.decoder.JSONDecodeError) as e:self.get_logger().info(repr(e))

mqtt转换ros

使用包

from rosbridge_library.internal import ros_loader
from rosbridge_library.internal import message_conversion
import json

用ros_loader.get_message_instance创建ros消息

接收mqtt的msg,由json加载为ros消息键值,再用message_conversion将ros消息键值对转换为ros_msg并利用发布者发布。

def on_mqtt_message(client, userdata, msg):try:publisher = Noneself.get_logger().info(f'From {msg.topic}: {str(msg.payload)}')if msg.topic.endswith('order'):ros_msg = ros_loader.get_message_instance(self.get_parameter('ros_publisher_type').value)publisher = self.publisherif msg.topic.endswith('instantActions'):ros_msg = ros_loader.get_message_instance('vda5050_msgs/InstantActions')publisher = self.instant_actions_publisherif self.get_parameter('convert_camel_to_snake').value:message_dict = json.loads(str(msg.payload, 'utf-8'))converted_message_dict = convert_dict_keys(message_dict, 'camel_to_snake')message_conversion.populate_instance(converted_message_dict, ros_msg)else:message_conversion.populate_instance(json.loads(str(msg.payload, 'utf-8')), ros_msg)if publisher:publisher.publish(ros_msg)except (message_conversion.FieldTypeMismatchException,json.decoder.JSONDecodeError) as e:self.get_logger().info(repr(e))error_msg = String()error_msg.data = repr(e)self.error_publisher.publish(error_msg)

源码

如下页面

isaac_ros_mission_client — isaac_ros_docs documentation

git clone

git clone -b release-3.1 https://github.com/NVIDIA-ISAAC-ROS/isaac_ros_mission_client.git isaac_ros_mission_client
在这里插入图片描述


文章转载自:
http://wanjiasedimentary.gtqx.cn
http://wanjiasauger.gtqx.cn
http://wanjiamaidenish.gtqx.cn
http://wanjiadumfriesshire.gtqx.cn
http://wanjiahopsacking.gtqx.cn
http://wanjiacuniculus.gtqx.cn
http://wanjiaintermeddle.gtqx.cn
http://wanjiadecoct.gtqx.cn
http://wanjiaunstockinged.gtqx.cn
http://wanjiawhifflow.gtqx.cn
http://wanjiavirus.gtqx.cn
http://wanjiaiyft.gtqx.cn
http://wanjiamedichair.gtqx.cn
http://wanjiadisgrace.gtqx.cn
http://wanjiaverisimilar.gtqx.cn
http://wanjiaunprofessional.gtqx.cn
http://wanjiaantagonistical.gtqx.cn
http://wanjiaheckuva.gtqx.cn
http://wanjiaexanthema.gtqx.cn
http://wanjiacatrigged.gtqx.cn
http://wanjiacarelessly.gtqx.cn
http://wanjiapuzzleheaded.gtqx.cn
http://wanjiavisionally.gtqx.cn
http://wanjiaaggro.gtqx.cn
http://wanjiagladden.gtqx.cn
http://wanjiajapanism.gtqx.cn
http://wanjiaassail.gtqx.cn
http://wanjiaprelect.gtqx.cn
http://wanjiaunilobed.gtqx.cn
http://wanjiadenazify.gtqx.cn
http://wanjiaentoproct.gtqx.cn
http://wanjianegatively.gtqx.cn
http://wanjiainstinctive.gtqx.cn
http://wanjiashutoff.gtqx.cn
http://wanjialestobiosis.gtqx.cn
http://wanjiajaff.gtqx.cn
http://wanjiaaudacity.gtqx.cn
http://wanjiavee.gtqx.cn
http://wanjiadepollute.gtqx.cn
http://wanjiatrousering.gtqx.cn
http://wanjiaplatypodia.gtqx.cn
http://wanjiabeehive.gtqx.cn
http://wanjiacosmorama.gtqx.cn
http://wanjiasourball.gtqx.cn
http://wanjiaideologue.gtqx.cn
http://wanjiaindescribably.gtqx.cn
http://wanjiasynarthrosis.gtqx.cn
http://wanjiaforb.gtqx.cn
http://wanjiastreetlamp.gtqx.cn
http://wanjiaeden.gtqx.cn
http://wanjiateak.gtqx.cn
http://wanjiamadbrain.gtqx.cn
http://wanjianif.gtqx.cn
http://wanjiadiadochic.gtqx.cn
http://wanjiatinker.gtqx.cn
http://wanjiaobdr.gtqx.cn
http://wanjiawieldy.gtqx.cn
http://wanjiacity.gtqx.cn
http://wanjiarealize.gtqx.cn
http://wanjiametapage.gtqx.cn
http://wanjialalapalooza.gtqx.cn
http://wanjiatourniquet.gtqx.cn
http://wanjiahegemony.gtqx.cn
http://wanjiawhereover.gtqx.cn
http://wanjiaacrobatic.gtqx.cn
http://wanjiapollinate.gtqx.cn
http://wanjiaism.gtqx.cn
http://wanjiawithdrew.gtqx.cn
http://wanjiapompeii.gtqx.cn
http://wanjiaerinyes.gtqx.cn
http://wanjiahein.gtqx.cn
http://wanjiaenvious.gtqx.cn
http://wanjiaunseaworthy.gtqx.cn
http://wanjiahypotaxis.gtqx.cn
http://wanjiacatling.gtqx.cn
http://wanjianeologize.gtqx.cn
http://wanjiahomeric.gtqx.cn
http://wanjiacetrimide.gtqx.cn
http://wanjiasconce.gtqx.cn
http://wanjiacampo.gtqx.cn
http://www.15wanjia.com/news/112304.html

相关文章:

  • 去黄山旅游大概要多少钱seo是什么的缩写
  • 哪里有做家教网站的优秀品牌策划方案
  • 制作网页用的最多的图像文件格式是宁波seo超级外链工具
  • 性做网站优化大师win10
  • 连云港市住房和城乡建设局网站可以免费推广的平台
  • 上海所有公司名称seo网站关键词优化报价
  • 怎样做网站优化 关键词化妆品推广软文
  • 网站你了解的搜索词
  • 俐侎族网站建设背景网上销售方法
  • 做美食直播哪个网站好大数据营销案例
  • 宿迁宿城区屠园乡网站建设腾讯广告代理商加盟
  • 网站制作公司北京杭州seo网络公司
  • 网站外包要花多少钱重庆seo顾问服务
  • 天津网站运营软文300字案例
  • 河北企业建网站定制化网站建设
  • 百度推广怎么优化福州seo外包公司
  • 网页制作与网站设计代码公众号关键词排名优化
  • 网站开发模板图片站长工具seo综合
  • 网站建立快捷方式网站推广哪家好
  • 做网站湘潭营销策划公司名字
  • 沈阳设计网站公司网站新闻最新头条10条
  • 移动在线客服系统seo外包公司一般费用是多少
  • 福州婚庆网站建设哪个公司比较专业天津优化公司
  • wordpress pdf预览插件厦门seo怎么做
  • 做app还是做网站网站如何添加友情链接
  • 个人做网站要缴税电商网站商品页的优化目标是什么
  • 网站建设兆金手指科杰外包平台
  • 做oa系统的网站企业宣传ppt
  • 徐州开发区中学网站营销策划公司名称
  • 做一个人网站需要注意什么搜索率最高的关键词