Create a ROS2 Node with Python and OOP - ROS2 Tutorial 5

แชร์
ฝัง
  • เผยแพร่เมื่อ 7 ก.ย. 2024

ความคิดเห็น • 73

  • @RoboticsBackEnd
    @RoboticsBackEnd  ปีที่แล้ว

    Thank you for watching!
    🔥 To go further with ROS2, check out this complete and step-by-step ROS2 course
    👉 rbcknd.com/ros2-for-beginners

    • @greendsnow
      @greendsnow ปีที่แล้ว

      the -able suffixes at the end of the nouns are not pronounced /eibl/ as in table /teibl/
      but like /əbl/ or /ibl/ as in executable /egzekutəbl/

  • @MohamadAlajouz
    @MohamadAlajouz 3 หลายเดือนก่อน

    My man I watched all the playlist 3 month ago to work on my graduation project, I only skipped this video and had to always type colcon build during these 3 months 😆, I even tried searching for a solution online but none actually helped. Your content is really simple and straight forward

  • @impostercoding
    @impostercoding 6 หลายเดือนก่อน

    I have been reading articles, docs and watching other tutorials for three days. This series got me up and going in a few minutes. I just wanted to add if the a KeyboardInterrupt error bothers you you can use "ctrl+z" || new output => [1]+ Stopped ros2 run my_robot_controller test_node

  • @saikeertanareddy4607
    @saikeertanareddy4607 3 หลายเดือนก่อน

    I am learning ROS2 for a project and this video really helped me! Thank you!

  • @codewithdominic9318
    @codewithdominic9318 ปีที่แล้ว +4

    Love this! For a ROS beginner like myself it’s been very helpful

  • @SA-ec9uo
    @SA-ec9uo 3 หลายเดือนก่อน

    Merhaba ; Ben ilk ROS neotikle başladım ve eksiksiz öğrettiklerinizi tamamladım. Şimdide ROS2 başladım ve beşinci derse kadar eksiksiz devam ediyorum .Eğitimin için sana cok teşekkür ederim . python yeni öğrenen biriyim ama buna rağmen tüm derslerini eksiksiz yerine getirebiliyorum . Ama herşeyi bakarak yapıyorum ilerde tek başımada yapabilirmiyim bilmiyorum.

  • @Potatonater-it7gw
    @Potatonater-it7gw 10 หลายเดือนก่อน +1

    thanks for making this

  • @tutorstown973
    @tutorstown973 8 หลายเดือนก่อน

    Thanks....
    This is heavenly tutorial

  • @hemrajpandeya81
    @hemrajpandeya81 ปีที่แล้ว

    you are a real hero, thank you for the content

  • @abhinavmathew2789
    @abhinavmathew2789 2 หลายเดือนก่อน +1

    the rclpy is not working for me. I downloaded the extentsion and there is an error in the code

  • @pyakpepyak
    @pyakpepyak ปีที่แล้ว +3

    good course, one note though: the dark blue path part of the prompt in bash is not readable, so it makes it harder to follow.

    • @RoboticsBackEnd
      @RoboticsBackEnd  11 หลายเดือนก่อน +1

      thanks! Yes I noticed that a bit too late. It's been fixed for future tutorial though :)

  • @user-vm3im7td2m
    @user-vm3im7td2m 8 หลายเดือนก่อน

    thank you brother keep it move on .

  • @tekashisun585
    @tekashisun585 ปีที่แล้ว

    this is immensely helpful, thank you

  • @mahamaneirochapiou4388
    @mahamaneirochapiou4388 ปีที่แล้ว

    you are a genuis, thx

  • @kin_1997
    @kin_1997 11 หลายเดือนก่อน

    amazing tutorial

  • @valeriiaokhmak3329
    @valeriiaokhmak3329 7 หลายเดือนก่อน

    Amazing1 thank you very much

  • @spaghettiman512
    @spaghettiman512 ปีที่แล้ว +2

    Hi! I'm running into a problem at 15:26 where after having source ~/.bashrc, I could not run the command ros2 run because it reported an error because it oculd not find any executable. Does anyone know why?
    I have been trying to find searching it but I havent been successful at all.

    • @RoboticsBackEnd
      @RoboticsBackEnd  ปีที่แล้ว

      Double check the setup.py of your python package, and make sure you've specificed an executable here. Probably an error here, or in your code. When everything is good, go to your ~/ros2_ws folder, remove install/ and build/, and run "colcon build" again

  • @teetanrobotics5363
    @teetanrobotics5363 2 ปีที่แล้ว +6

    Could you please make more complicated projects ? These are way too simple. For example: UR5 robot manipulator that uses lidar to see and moves around using local planner using dijsktras algorithm/RRT ?

  • @jerryhsieh2791
    @jerryhsieh2791 ปีที่แล้ว +4

    At 10:13, how did you execute a python file using "./" ?
    I tried the cmd "./my_first_node.py" but it didn't work.
    It only works if I do "python3 my_first_node.py".
    Please explain, thank you!

    • @2anta
      @2anta ปีที่แล้ว +3

      If i'm not mistaken it's the command on the left screen : "chmod +x my_first_node.py" that make the file executable. Happy coding

    • @jerryhsieh2791
      @jerryhsieh2791 11 หลายเดือนก่อน +1

      @@2anta Yes, I did "chmod +x my_first_node.py", but when I then do "./ my_first_node.py", it just outputs "bash: ./: Is a directory" and the code doesn't execute.

    • @jerryhsieh2791
      @jerryhsieh2791 11 หลายเดือนก่อน +2

      Ok I figured it out. It should be "./my_first_node.py" (without the space between / and m).

    • @jeriljudes7822
      @jeriljudes7822 9 หลายเดือนก่อน

      Im also stuck here , I have checked the items in the directory and ran '.my_first_node_.py' but shows an erroe bad interprector no such file or directory

    • @ramzibouderrah7425
      @ramzibouderrah7425 7 หลายเดือนก่อน

      @@jeriljudes7822 have you found a way to fix it??

  • @ashoksaini2141
    @ashoksaini2141 ปีที่แล้ว +2

    Hey When i am running the my_frist_node ,
    i found an error : No module Named " rclpy._rclpy_pybind11"

    • @Bardomp
      @Bardomp 25 วันที่ผ่านมา +1

      Try to deactivate Conda, that was my issue, ros2 doesnt work with Conda and maybe with other enviroments.
      After that use "pip list" and see if you have rclpy in it.

  • @drawingninja4773
    @drawingninja4773 10 หลายเดือนก่อน +1

    i have a problem at 3:54 bcs rclpy is still not found in my code even though i installed the extention and checked the python version as well as if rclpy is correctly installed :/

    • @omkarprusty3784
      @omkarprusty3784 4 หลายเดือนก่อน

      did it get resolved?
      cause i'm facing same issue

  • @rahultom4310
    @rahultom4310 5 หลายเดือนก่อน

    First of all thank you for the wonderful explanation.
    I have an error when I am trying to run node as ros2 functionality(ros2 run) as per video time line 15.25. Th error saying that "Package 'my_robot_controller' not found". Can you please help me?
    NB: 1). Usually the auto completion is available in my terminal, but not during this terminal session.
    2). I am able to run the same node as python script from the same terminal.

    • @RoboticsBackEnd
      @RoboticsBackEnd  5 หลายเดือนก่อน

      Probably you didn't source your ROS2 workspace in this terminal. You need to source the workspace so that you can find the packages with ros2 run

  • @zhuozhang9956
    @zhuozhang9956 ปีที่แล้ว +1

    Hi, thanks for the excellent tutorial! I am a newer of the terminal. And when I run 'ros2 run my_robot_controller test_node' it says 'Package 'my_robot_controller' not found'. I don't know if it is related that I used zsh and run 'source ~/.zshrc' rather than 'source ~/.bashrc'. Or it is about 'colcon build' (no error appeared from this command)? thanks!

    • @RoboticsBackEnd
      @RoboticsBackEnd  ปีที่แล้ว +1

      Hard to tell, and as for zsh: I haven't tried yet (only using bash), but will have a look. From what I quickly found it seems that zsh could have some issues with ROS2: answers.ros.org/question/394021/no-completion-for-ros2-run-in-zsh/
      But the error could also be because you have forgotten a step when building the node, a typo somewhere, etc. So I'd say, first redo all the steps one by one, then try with bash if possible, and if it works then troubleshoot with zsh.

    • @urbanspoken
      @urbanspoken ปีที่แล้ว

      All you need is just run instead of .bash 🙂

    • @tuanphammanh7122
      @tuanphammanh7122 7 หลายเดือนก่อน

      @@urbanspoken i have the same problem. BUt I do not run .bash because my source ./bash not work

  • @thebasementengineer
    @thebasementengineer 5 หลายเดือนก่อน

    If source ~/.bashrc doesn't work, use source install/setup.bash instead

  • @blokpm
    @blokpm 7 หลายเดือนก่อน

    22:15 suppose you want to automatically exit the Python program after receiving 10 counts, how can you do that? Basically break out the rclpy.spin? What’s the best solution for that? rclpy.shutdown() doesn’t work for me as the “context is not initiated”

    • @RoboticsBackEnd
      @RoboticsBackEnd  7 หลายเดือนก่อน

      Then I would suggest to stop the timer with smth like "timer.cancel()", but not shutting down the node from the inside.

    • @thebasementengineer
      @thebasementengineer 5 หลายเดือนก่อน

      Use a while or for loop around the timer

  • @user-qz7uz3cq2r
    @user-qz7uz3cq2r 7 หลายเดือนก่อน

    heyy thats a good tutorial for a newbie like me , thnaks for making these videos
    though I’m running into a slight problem at 15:12 ,ros2 run my_robot_cotroller , this aint working for me , it says the following arguements require executable_name , though i have give the executable _name which is test_node , executable name and the package_name put togather it is ros2 run my_robot_controller test_name as youve shown in the video ,still it says error and package my_robot_controller not found
    can you pls help me with this

    • @5zigen371
      @5zigen371 3 หลายเดือนก่อน

      probably because your my_first_node.py isn't is the good folder. It Should be under the 2nd folder my_robot_controller next to the __init__.py

  • @MrEngineer_
    @MrEngineer_ 6 หลายเดือนก่อน

    Hi, what happens If I use colcon build inside the src directory ? I was mistakenly doing this and I was so anxious that the updated code was not being tracked. Later on carefully watching the blue text, I realized you were doing it inside ros2_ws and not inside src. It fixed the problem of updates. But, what are the consequences ?

    • @RoboticsBackEnd
      @RoboticsBackEnd  6 หลายเดือนก่อน +1

      If you use colcon build in the wrong directory, then it will add an install/, build/ and log/ folder there. Just remove those folders and you will be fine.
      If you keep different install/ folders in different places this is when you can get some weird errors and package collisions.

    • @MrEngineer_
      @MrEngineer_ 6 หลายเดือนก่อน

      Okay, Thank you for the clarification !! @@RoboticsBackEnd

  • @xavieronieves-garcia3879
    @xavieronieves-garcia3879 ปีที่แล้ว

    Hey! Great tutorial for newboo like me, though I’m running into a slight problem at 17:42 where after running colcon build - -symlink install, It starts and finishes but when I execute the ros2 run my_robot_controller test_node, it doesn’t update automatically the new code (changing it from printing “ROS2” to “ROS”) and I have to press save every time. Is that how it’s supposed to work? Since I understood that the colcon build - -symlink install is so the you wouldn’t have to manually save it each time.

    • @RoboticsBackEnd
      @RoboticsBackEnd  ปีที่แล้ว +1

      Maybe I see where the confusion is here:
      - with symlink-install you don't have to build again
      - but you have to save the file. If you don't save the file then of course the new version is not used.

    • @xavieromar7981
      @xavieromar7981 ปีที่แล้ว

      @@RoboticsBackEnd thank you so much! For the clarification! Your videos has helped me a lot!

  • @iamshakeelsindho
    @iamshakeelsindho 19 วันที่ผ่านมา

    Just like others, I am also having the same error at 1520:
    usage: ros2 run [-h] [--prefix PREFIX] package_name executable_name ...
    ros2 run: error: the following arguments are required: executable_name, argv
    I have looked my code in setup.py and my_first_node, they both are fine. Plus, I deleted the folders build&install and run colcon build again in the workspace. Later run the bashrc in the terminal and colcon build in the workspace, the folders are back however when I run the ros2 run my_robot_controller, it shows the same error. Anyone has solution?

    • @RoboticsBackEnd
      @RoboticsBackEnd  17 วันที่ผ่านมา

      In the video I don't run this command, I press TAB for autocompletion (please first watch a tutorial on autocompletion)
      The full command is ros2 run my_robot_controller + executable name

  • @greendsnow
    @greendsnow ปีที่แล้ว

    I understood more from this crash course than the udemy course...

    • @RoboticsBackEnd
      @RoboticsBackEnd  ปีที่แล้ว +2

      Both courses are teaching in a different way, and if you understood more here, maybe it's because you finally "got it" here after having watched the other course. Happens all the time to me, I read from different sources and finally I get it, but it's because the brain actually combines the knowledge from all learning material :) so the tutorial that made you understand is probably not the only one that was important.

    • @greendsnow
      @greendsnow ปีที่แล้ว

      @@RoboticsBackEnd I needed a concise recap.

  • @yuribespaloff7274
    @yuribespaloff7274 4 หลายเดือนก่อน

    Hi! Nothing happens when I run node in the terminal. Not even an error

    • @sarimkhan2306
      @sarimkhan2306 3 หลายเดือนก่อน

      Have you initialized the node in main() function?

  • @sarimkhan2306
    @sarimkhan2306 3 หลายเดือนก่อน

    --symlink-install for automating the code is not working. Manual build is working fine.

  • @ahmedelmogii2914
    @ahmedelmogii2914 ปีที่แล้ว

    21:13
    i always get this messege (( AttributeError: 'MyNode' object has no attribute 'Timer_callback' ))
    what is the problem and how to solve it?

    • @kenankortan
      @kenankortan 8 หลายเดือนก่อน +1

      Probably, your timer_callback function is inside of the constructor(__init__). Just put it outside to the constructor. In short, get your cursor on head of def time_callback function and push the "backspace" in the keyboard. Also, same for self.get_logger()...
      I hope that will work.

  • @Ducerobot
    @Ducerobot ปีที่แล้ว

    Can I install ros2 in lunar lobster?

  • @SohailSiadat
    @SohailSiadat ปีที่แล้ว +6

    Blue 🟦 colour text in terminal should be banned.

    • @RoboticsBackEnd
      @RoboticsBackEnd  ปีที่แล้ว

      I know, just found out after I published the tutorial :/
      Fixed in other tutorials

    • @izurzuhri
      @izurzuhri ปีที่แล้ว +1

      why should be banned?

  • @DeathTempler
    @DeathTempler 4 หลายเดือนก่อน

    2:11
    *♪Союз нерушимый республик свободных♪*
    So this tutorial is how Atomic Heart started 🤣

  • @EdRlld98
    @EdRlld98 11 หลายเดือนก่อน

    Moi je dis cocorico

  • @rakesharks6643
    @rakesharks6643 2 หลายเดือนก่อน

    @RoboticsBackEnd
    Traceback (most recent call last):
    File "/home/rocky/ros2_ws/src/my_robot/my_robot/./my_node.py", line 3, in
    from rclpy import Node
    ImportError: cannot import name 'Node' from 'rclpy' (/opt/ros/humble/local/lib/python3.10/dist-packages/rclpy/__init__.py)
    I am getting this error :(
    someone pls help me

    • @pavanmeesala5943
      @pavanmeesala5943 25 วันที่ผ่านมา

      Did you find any solution
      I am too facing this problem

    • @Bardomp
      @Bardomp 25 วันที่ผ่านมา

      Try to deactivate Conda, that was my issue, ros2 doesnt work with Conda and maybe with other enviroments.
      After that use "pip list" and see if you have rclpy in it.