ROS2 - Combine Publisher, Subscriber, and Service in One Node

Поделиться
HTML-код
  • Опубликовано: 16 сен 2024

Комментарии • 16

  • @panprezes2186
    @panprezes2186 Год назад

    Hello,
    I really appreciate your courses and think, that you actually are the best mentor about ROS2 teaching nowadays, because you provide knowledge about every aspect and parameter of your programs, which is great, keep it doing. It is awesome work from your side :).
    And i have a couple of questions with working with my project. Could you do some videos about executors ( especially multithreading), because i need to run three nodes at the same time and shutdown them exactly, when all their callbacks will be done and heard that executors are good way to do it.

    • @RoboticsBackEnd
      @RoboticsBackEnd  Год назад +2

      Thanks for the kind words!
      Executors are on my todo list, probably not for the next month however. I think too that it can help you solve your problem.

    • @panprezes2186
      @panprezes2186 Год назад +1

      ​@@RoboticsBackEnd Thanks for response!
      I ve done it already by myself but it was really, really hard to learn and understand it by myself. But i keep thumbs, that you will do video about it in nearest future. There are so many thing to explain there (especially what is spin_untill_future(), when it is good to use spin_once and others spinners)
      Could you explain one thing. Why ROS2 have so few tutorials about their system? When i started learning about it, i find it really difficult to find answers about questions rising in my head during learning. I find out that many engineers run away from ROS2 mainly due too hard entrance and very long period between first programs and functional, usefull programs ready to practical appliance.

  • @mahmoudmostafa2717
    @mahmoudmostafa2717 7 месяцев назад

    Hi,
    Thanks for such informative videos,
    I am trying to do that example in cpp but the service part is causing errors of mismatch callback type.
    Any advice how to solve this issue?

  • @thomasluk4319
    @thomasluk4319 Год назад

    I am looking forward from your tutorial about threading in ROS2.
    I am working on a robot that required to send out it state information (safety and monitoring purpose) to a remote backend server. Meanwhile, maintain listening to the server for any task request or cancellation request of task. The communication protocol is done via websocket connection. Which I have not much idea on how to setting up websocket client inside a ros2 node

    • @RoboticsBackEnd
      @RoboticsBackEnd  Год назад +1

      Thanks for the feedback, I might create a tutorial on threading in ROS2 in the future. In the meantime I suggest that you just learn about threading (in general). In your ROS2 node, in the constructor you can spawn a new thread that will run in parallel, and in this thread you handle the websocket connection. Then you create some class attributes so you can share data between threads (make sure to use lock guards).
      That's the very short answer, hope it still helps

    • @thomasluk4319
      @thomasluk4319 Год назад

      your answer is solid and i have tried its work, still i am not sure the correct to setting up thread and using the lock(). find out I have used websockets and asyncio to complete the task. I have create a publish repo, so you can have a look and correct me any mistake have been made@@RoboticsBackEnd

  • @weiyun5608
    @weiyun5608 9 месяцев назад

    hello,
    first of all i want to thank you for this node combination walkthrough, it's really helpful since it's never included in tutorials.
    and im now trying to build a service with the custom srv in the same package. and i #include the srv in cpp files but i keep having error when building package that says my service hpp file couldn't be found (but when i went to the install and include part the hpp file do exist)
    it makes me wonder if it is not right or possible to build custom srv and node cpp file inside the same package?
    cus i tried putting them in different pkgs and it works?
    thank you @@

  • @shridharkatkati3113
    @shridharkatkati3113 Год назад

    Hey man i love the content you put out here! hats off. I have one question though.
    is there a way to combine service and client in a single node?

    • @RoboticsBackEnd
      @RoboticsBackEnd  Год назад

      Thanks! Yes it's totally possible, you can combine anything you want (topics, services, even actions). If you're waiting in some callbacks, make sure you check how to use a multi-thread executor first.

    • @shridharkatkati3113
      @shridharkatkati3113 Год назад

      @@RoboticsBackEnd can you make a video on how to use multi thread executors?

  • @hello_world-sh1zl
    @hello_world-sh1zl Год назад

    Will the temperature_callback be executed if we are in the middle of publish_text methos?

    • @RoboticsBackEnd
      @RoboticsBackEnd  Год назад

      The publish_text() is a callback, so if you're inside the callback, any other callback will have to wait. This is true with the standard executor.
      But you can use a multihreaded executor so that multiple callbacks can run at the same time.

    • @hello_world-sh1zl
      @hello_world-sh1zl Год назад

      @@RoboticsBackEnd Thank you very much! It would be great of you to create a video with the team of multithreading because you explain really understandably.

  • @four3271
    @four3271 10 месяцев назад

    How can I create two subscribers in one node? Two separate subscribers that subscribe to different topics

    • @RoboticsBackEnd
      @RoboticsBackEnd  10 месяцев назад

      You just duplicate the code required for one subscriber. So, you'll have another subscriber object that you create in the constructor, and another callback.