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

招聘网有哪些网站比较好sem 优化软件

招聘网有哪些网站比较好,sem 优化软件,网站怎么做导航,网站开发报价单对ROS2有一定了解后#xff0c;我们会发现ROS2中节点和ROS1中节点的概率有很大的区别。在ROS1中节点是最小的进程单元。在ROS2中节点与进程和线程的概念完全区分开了。具体区别可以参考 ROS2学习(四)进程#xff0c;线程与节点的关系。 在ROS2中同一个进程中可能存在多个节点…对ROS2有一定了解后我们会发现ROS2中节点和ROS1中节点的概率有很大的区别。在ROS1中节点是最小的进程单元。在ROS2中节点与进程和线程的概念完全区分开了。具体区别可以参考 ROS2学习(四)进程线程与节点的关系。 在ROS2中同一个进程中可能存在多个节点。两个节点直接交换数据依旧使用典型的topic发布订阅则听起来像在一个房间的两个人需要通过邮寄快递来交换物品一样。所以ROS2中设计了一种进程内通信的更好的方式。即intra processing.这个选项位于节点的选项中即Node-Option, 使用进程内通信(use_intra_process_comms):类型是bool.如果为true则在此上下文中发布和订阅的主题消息通过特殊的进程内通信代码路径。可以避免序列化和反序列化不必要的复制。并在某些情况下实现更低的延迟。该选项默认值为false。 在构造节点时添加“使用进程内通信”选项即可启用该功能。如下 Node(node_name, rclcpp::NodeOptions().use_intra_process_comms(true));下面的例子是在一个进程中创建两个节点都是用intra_process包括一个发布器的节点和一个订阅器的节点二者都使用了节点的进程内通信并通过unique指针打印了其中地址。每次通信的时候二者消息指针的地址都是一致的即消息没有通过UDP传输而是通过直接读写内存区块传输的。 #include cstdio #include memory #include string #include utility #include rclcpp/rclcpp.hpp #include chronoclass PubNode : public rclcpp::Node {public:explicit PubNode(const std::string node_name):Node(node_name, rclcpp::NodeOptions().use_intra_process_comms(true)){using namespace std::chrono_literals;publisher_ this-create_publisherbuiltin_interfaces::msg::Time(current_time,10);auto topictimer_callback []()-void {builtin_interfaces::msg::Time::UniquePtr timestamp_ std::make_uniquebuiltin_interfaces::msg::Time(this-get_clock()-now());RCLCPP_INFO_STREAM(this-get_logger(), pub:Addr is: reinterpret_caststd::uintptr_t(timestamp_.get()));publisher_-publish(std::move(timestamp_));};timer_ this-create_wall_timer(std::chrono::milliseconds(500), topictimer_callback);}private:rclcpp::TimerBase::SharedPtr timer_;rclcpp::Publisherbuiltin_interfaces::msg::Time::SharedPtr publisher_;};class SubNode : public rclcpp::Node {public:explicit SubNode(const std::string node_name):Node(node_name, rclcpp::NodeOptions().use_intra_process_comms(true)){subscriber_ this-create_subscriptionbuiltin_interfaces::msg::Time(current_time,10,std::bind(SubNode::count_sub_callback, this, std::placeholders::_1));}private:rclcpp::Subscriptionbuiltin_interfaces::msg::Time::SharedPtr subscriber_;void count_sub_callback(const builtin_interfaces::msg::Time::UniquePtr msg){RCLCPP_INFO_STREAM(this-get_logger(), sub::Addr is: reinterpret_caststd::uintptr_t(msg.get()));} };void another_executor() {rclcpp::executors::SingleThreadedExecutor executor_;auto sub_node_ std::make_sharedSubNode(topic_sub);executor_.add_node(sub_node_);executor_.spin(); }int main(int argc, char ** argv) {rclcpp::init(argc, argv);auto pub_node_ std::make_sharedPubNode(topic_pub);rclcpp::executors::SingleThreadedExecutor executor_;std::thread another(another_executor);executor_.add_node(pub_node_);executor_.spin();another.join();rclcpp::shutdown();return 0; } 测试进程内通信 crabecrabe-virtual-machine:~/Desktop/ROS2_Sample/sample4$ ros2 run sample4 sample4 [INFO] [1691321973.618474226] [topic_pub]: pub:Addr is:94612283905568 [INFO] [1691321973.619805241] [topic_sub]: sub::Addr is: 94612283905568 [INFO] [1691321974.111633655] [topic_pub]: pub:Addr is:94612283906592 [INFO] [1691321974.112431228] [topic_sub]: sub::Addr is: 94612283906592 [INFO] [1691321974.621381952] [topic_pub]: pub:Addr is:94612283906752 [INFO] [1691321974.622338223] [topic_sub]: sub::Addr is: 94612283906752 [INFO] [1691321975.116415866] [topic_pub]: pub:Addr is:94612283906592 [INFO] [1691321975.117153538] [topic_sub]: sub::Addr is: 94612283906592 [INFO] [1691321975.626275913] [topic_pub]: pub:Addr is:94612283906752 [INFO] [1691321975.627212976] [topic_sub]: sub::Addr is: 94612283906752 [INFO] [1691321976.119609316] [topic_pub]: pub:Addr is:94612283906592 [INFO] [1691321976.119766941] [topic_sub]: sub::Addr is: 94612283906592 [INFO] [1691321976.612854241] [topic_pub]: pub:Addr is:94612283906752 [INFO] [1691321976.612988887] [topic_sub]: sub::Addr is: 94612283906752 [INFO] [1691321977.121834835] [topic_pub]: pub:Addr is:94612283906592 [INFO] [1691321977.122012812] [topic_sub]: sub::Addr is: 94612283906592 [INFO] [1691321977.615035889] [topic_pub]: pub:Addr is:94612283906752 [INFO] [1691321977.615166100] [topic_sub]: sub::Addr is: 94612283906752 [INFO] [1691321978.123765480] [topic_pub]: pub:Addr is:94612283906592 [INFO] [1691321978.123915765] [topic_sub]: sub::Addr is: 94612283906592 [INFO] [1691321978.615940232] [topic_pub]: pub:Addr is:94612283906752 [INFO] [1691321978.616072038] [topic_sub]: sub::Addr is: 94612283906752intra_process与节点执行器无直接关系仅与是否为同一进程有关。 使用intra_process的节点其中的topic可以同时支持进程内和进程外的通信只不过进程外的通信仍然使用UDP作为媒介。如果需要在进程外也使用共享内存的高效方案则需要考虑在DDS的中间件上下功夫。
http://www.hkea.cn/news/14303683/

相关文章:

  • 铁道部售票网站多少钱建设有网站源码怎么搭建网站
  • 四川省建设网站微信怎么弄小程序卖东西
  • 个人怎么建立网站线上营销的优势和劣势
  • 上线了自助建站优化方案物理必修三电子版
  • 网站建设与服务费是什么服务阿里云服务器在哪里放着
  • 淮安做网站建设的网络公司wordpress微软雅黑字体
  • 精准扶贫建设网站的目的wordpress统计在线人数
  • 棋牌类网站怎么做网站设计软件免费下载
  • apache 设置多个网站免费网站模板
  • 临沂网站模板深圳网站建设卓企
  • 网站建设首期款公司网站建设的基本流程
  • 十大招聘网站排行榜优秀网站 要素
  • 主备网站服务器自动切换 win2003网站建设找客户
  • 东莞建站模板后台张家港保税区规划建设局网站
  • 昆明网站制作内容WordPress标题原创插件
  • 湖南建设人力资源湖南网站建设大专学历怎么自考
  • 用wordpress建站效果怎么样手机网站怎么布局
  • 哈尔滨城乡建设网站深圳网站制作需要多少钱
  • 企业网站的策划书公众号平台登录入口官网
  • 网站是哪个公司做的好山西自助建站系统怎么用
  • 建立公司网站需要什么易思企业网站管理
  • 三亚网站建设费用建设企业网站
  • 郴州做网站全球采购平台
  • 摩托车专业网站板绘线下培训班
  • 织梦怎么做网站地图网站建设的风险识别
  • 创建网站的费用西安seo培训机构排名
  • 网站设计哪家口碑好企业网站建设开题报告是什么
  • 东莞建站公司案例全网天下案例管理系统首页
  • 茅台酒网站建设方案移动端网站建设的方案
  • 多店铺商城系统上海做网站优化价格