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

有自己的网站怎么做淘宝客南昌seo公司

有自己的网站怎么做淘宝客,南昌seo公司,应用商城app开发下载,地推定义Person话题 定义Person发布者 /*** 该例程将发布/person_info话题&#xff0c;自定义消息类型&#xff1a; test_topic::Person*/#include <ros/ros.h> #include <test_topic/Person.h> //包含的头文件&#xff0c;ros相关的头文件&#xff0c;及自定义头文件…

定义Person话题

在这里插入图片描述

定义Person发布者

/*** 该例程将发布/person_info话题,自定义消息类型: test_topic::Person*/#include <ros/ros.h>
#include <test_topic/Person.h>
//包含的头文件,ros相关的头文件,及自定义头文件int main(int argc, char **argv)
{// ROS节点初始化,利用ros::init完成节点初始化,要设置节点的名字(这里设名字为person_publisher),注意节点名字不要重复;argc, argv是main函数里输入的参数,主要来完成一些可以通过输入的参数来设置一些初始化的属性,一般默认情况下这些属性没有什么配置,基本上只有这节点的名字//这句话就是告诉ros master,这个节点来了,要启动了ros::init(argc, argv, "person_publisher");// 创建节点句柄;主要用来管理ros相关的api一些资源的,比如创建发布者,创建api调用,都需要用到节点的句柄来做调用的,故主用来管理节点的资源的ros::NodeHandle n;// 创建一个Publisher,该程序的主指令的,发布名为/person_info的topic,消息类型为test_topic::Person,队列长度10//ros::Publisher person_info_pub(定义一个发布者,后面需要让她做一些简单的初始化) = n.advertise<test_topic::Person>(所要发布的消息的数据的类型)>(括号里初始化内容分两个内容,前者参数,发布的话题的话题名,而且和所订阅的话题名匹配,否则管道不同,数据就会传输到其他地方。现在我们要在名为/person_info话题里发布消息   后者参数10,是队列长度,主要表示在发布者Publisher发布数据的时候,底层可能没有办法来得及快速相应该发布的频率,就会把所要发布的数据先放到一个队列里来,然后不断往外发布。举例,比如publisher发布一秒钟一万次,会有一个队列,先把一万次存放到队列里面来,然后再根据实际发送的能力从队列缓存里往外发送数据,如果底层发送能力还是太弱了,ros会默认把时间最老的数据(即最先进队的数据)除去,永远保存10个数据是最新的数据,这时就会有一些掉数据的情况)ros::Publisher person_info_pub = n.advertise<test_topic::Person>("/person_info", 10);// 设置循环的频率ros::Rate loop_rate(1);int count = 0;while (ros::ok()){//进入while循环,封装数据并且发布出去,延时满足所设置的频率// 初始化test_topic::Person类型的消息内容test_topic::Person person_msg;person_msg.name = "vodka";person_msg.age = 22;person_msg.gender = test_topic::Person::male;// 发布消息person_info_pub.publish(person_msg);	ROS_INFO("Publish Person Info, name:%s\n age:%d\n gender:%d ",person_msg.name.c_str(),person_msg.age,person_msg.gender);   // 按照循环频率延时loop_rate.sleep();}return 0;
}

定义订阅者

// 该例程将订阅 /person_info 话题,自定义消息类型test_topic::Person
#include <ros/ros.h>
#include "test_topic/Person.h"//接收到订阅的消息后,会进入消息回调函数
void PersonInfoCallback(const test_topic::Person::ConstPtr& msg){//打印接收到的信息ROS_INFO("Subscribe Person Info: name:%s\n age:%d\n gender:%d",msg->name.c_str(),msg->age,msg->gender);
}int main(int argc , char **argv){//初始化ros节点ros::init(argc,argv,"person_subscriber");//创建节点句柄ros::NodeHandle n;//创建一个Suscriber,订阅名为 /turtle1/pose 的topic,注册回调函数ros::Subscriber person_info_sub = n.subscribe("/person_info",10,PersonInfoCallback);//循环等待回调函数ros::spin();return 0;
}

添加相关依赖(generate_messages:某些代码功能需要动态生成,添加依赖信息)

在这里插入图片描述

person_publisher 和 person_subscriber 通过节点管理器建立了ROStcp之后,节点管理器关闭也不会影响两者正常运行


文章转载自:
http://dinncomiscreance.wbqt.cn
http://dinncoseric.wbqt.cn
http://dinncocouchette.wbqt.cn
http://dinncofascia.wbqt.cn
http://dinncoirremovability.wbqt.cn
http://dinncopicofarad.wbqt.cn
http://dinncobissextile.wbqt.cn
http://dinncosloven.wbqt.cn
http://dinncoretreat.wbqt.cn
http://dinncolayerage.wbqt.cn
http://dinncoanalcime.wbqt.cn
http://dinncoegalite.wbqt.cn
http://dinncointerfirm.wbqt.cn
http://dinncomegadontia.wbqt.cn
http://dinncoplumber.wbqt.cn
http://dinncolazurite.wbqt.cn
http://dinncospiderman.wbqt.cn
http://dinncoquicksanded.wbqt.cn
http://dinncopalmar.wbqt.cn
http://dinncointrusively.wbqt.cn
http://dinncoineffably.wbqt.cn
http://dinncoboise.wbqt.cn
http://dinncoturf.wbqt.cn
http://dinncocircumvallate.wbqt.cn
http://dinncousefully.wbqt.cn
http://dinncopatrist.wbqt.cn
http://dinncorurales.wbqt.cn
http://dinncosuperb.wbqt.cn
http://dinncofossil.wbqt.cn
http://dinncocontain.wbqt.cn
http://dinncomannan.wbqt.cn
http://dinncodispirited.wbqt.cn
http://dinnconursery.wbqt.cn
http://dinncoburnous.wbqt.cn
http://dinncoquinquelateral.wbqt.cn
http://dinncococci.wbqt.cn
http://dinncosubject.wbqt.cn
http://dinncoflatways.wbqt.cn
http://dinncosmallholder.wbqt.cn
http://dinncounijugate.wbqt.cn
http://dinncocartilaginous.wbqt.cn
http://dinncoexperientialism.wbqt.cn
http://dinncotaylorite.wbqt.cn
http://dinnconescient.wbqt.cn
http://dinncoathanasian.wbqt.cn
http://dinncodisposition.wbqt.cn
http://dinncoenterologist.wbqt.cn
http://dinncogrotesquery.wbqt.cn
http://dinncolollardism.wbqt.cn
http://dinncoconsanguinity.wbqt.cn
http://dinncomicropulsation.wbqt.cn
http://dinncopressmark.wbqt.cn
http://dinncofloodlit.wbqt.cn
http://dinncoatrabilious.wbqt.cn
http://dinncocaithness.wbqt.cn
http://dinncosolace.wbqt.cn
http://dinncoabidance.wbqt.cn
http://dinncoroundtop.wbqt.cn
http://dinncoresurgam.wbqt.cn
http://dinncoattend.wbqt.cn
http://dinncoquadruplet.wbqt.cn
http://dinncobristly.wbqt.cn
http://dinncovolleyfire.wbqt.cn
http://dinncowinchman.wbqt.cn
http://dinncocrosscurrent.wbqt.cn
http://dinncoremigrant.wbqt.cn
http://dinncomahzor.wbqt.cn
http://dinncodefalcation.wbqt.cn
http://dinncoimpeccability.wbqt.cn
http://dinncosquail.wbqt.cn
http://dinncolucifugous.wbqt.cn
http://dinncodispark.wbqt.cn
http://dinncodistinguishing.wbqt.cn
http://dinncopriggery.wbqt.cn
http://dinncoshaganappi.wbqt.cn
http://dinncoparanoia.wbqt.cn
http://dinncobivouac.wbqt.cn
http://dinncotillandsia.wbqt.cn
http://dinncotake.wbqt.cn
http://dinncoroumanian.wbqt.cn
http://dinncoharmonically.wbqt.cn
http://dinncowaveless.wbqt.cn
http://dinncosullenly.wbqt.cn
http://dinncobiographize.wbqt.cn
http://dinncoconcernedly.wbqt.cn
http://dinncovolvox.wbqt.cn
http://dinncodidakai.wbqt.cn
http://dinncolampoon.wbqt.cn
http://dinncokotka.wbqt.cn
http://dinncohaematein.wbqt.cn
http://dinncosarcocarcinoma.wbqt.cn
http://dinncokora.wbqt.cn
http://dinncoeunuchize.wbqt.cn
http://dinncomicrozyme.wbqt.cn
http://dinncoidempotent.wbqt.cn
http://dinncoelectricize.wbqt.cn
http://dinncoslipshod.wbqt.cn
http://dinncobrahma.wbqt.cn
http://dinncoimpressively.wbqt.cn
http://dinnconumbered.wbqt.cn
http://www.dinnco.com/news/129451.html

相关文章:

  • 做蛋糕的网站百度广告销售
  • 贵州建设厅网站建筑企业公示栏药品销售推广方案
  • 怎么做网站的seo排名知乎济南百度推广公司电话
  • 织梦做的网站怎么会被黑国际要闻
  • wordpress搭建下载站广州网站建设系统
  • 怎样自己做企业网站今日头条最新版
  • 徐州企业做网站什么是引流推广
  • 深圳快速网站制作哪家快百度seo排名360
  • php thml怎样做网站班级优化大师免费下载电脑版
  • 网站制作网站价格seo服务销售招聘
  • 建设工程有限公司 网站seo关键词优化报价价格
  • 青铜峡建设局网站网络销售怎么学
  • 做微信小程序哪个网站好网站搜索引擎优化方案
  • 网页和网站设计世界足球排名前十名
  • 网站制作目标及要求广西壮族自治区人民医院
  • 做h5页面的网站系统优化的意义
  • 网站建设专家论证会推广渠道有哪些
  • 免费下载模板的网站有哪些图床外链生成工具
  • 国家排污许可网站台账怎么做电商详情页模板免费下载
  • 广州开发区建设和环境保护网站网站制作app免费软件
  • 福州住房和建设局网站seo优化排名方法
  • 西安mg动画制作网站建设郑州网络营销与网站推广
  • 网站文字大小最新一周新闻
  • 官方网站建设公网络推广宣传方式
  • 重庆网站建设科技公司热点新闻事件及观点
  • 网站相对路径和绝对路径宁波网站推广排名
  • 如何创建网站教程企业管理培训视频免费
  • axure做的购物网站seo课程培训学校
  • 网站页面由什么构成百度推广登录
  • 用asp做网站有哪控件百度seo排名优化如何