Navigation

    蓝鲸ROS机器人论坛

    • Register
    • Login
    • Search
    • Categories
    • Tags
    • Popular
    ROS交流群
    ROS Group
    产品服务
    Product Service
    开源代码库
    Github
    官网
    Official website
    技术交流
    Technological exchanges
    激光雷达
    LIDAR
    ROS教程
    ROS Tourials
    深度学习
    Deep Learning
    机器视觉
    Computer Vision

    求助,ROS如何编写判断节点启动的程序。

    ROS教程
    ros教程
    3
    4
    2355
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • 叫我小冬枣
      叫我小冬枣 last edited by

      如题,我想编写一个一旦/turtlesim节点启动的话,我的发布者程序就会向语音话题发布一个表示开始的消息,然后就会发出声音,我需要写一个if
      while(…)
      {
      #初始化消息
      …
      if(节点启动)
      {
      发布消息;
      }
      }
      这其中的表示节点启动的语句具体应该怎么写,是节点名+上什么才能让计算机做出节点启动的判断?

      xiaoqiang 1 Reply Last reply Reply Quote 0
      • xiaoqiang
        xiaoqiang @叫我小冬枣 last edited by

        @叫我小冬枣 用rosnode list判断节点是否存在

        叫我小冬枣 1 Reply Last reply Reply Quote 0
        • 叫我小冬枣
          叫我小冬枣 @xiaoqiang last edited by

          @xiaoqiang 我想写在功能包的cpp里面,在cpp里面可以用rostopic list 吗?

          weijiz 1 Reply Last reply Reply Quote 0
          • weijiz
            weijiz @叫我小冬枣 last edited by

            @叫我小冬枣

              ros::master::V_TopicInfo available_topics;
              ros::master::getTopics(available_topics);
              for (size_t it = 0; it<available_topics.size(); it++){
                std::string available_topic_name = available_topics[it].name;
               
              }
            
            
            1 Reply Last reply Reply Quote 0
            • 1 / 1
            • First post
              Last post
            Copyright © 2015-2023 BlueWhale community