Object detection in Gazebo using Yolov5 and ROS2

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

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

  • @knnurl
    @knnurl 2 года назад +6

    I, as a person who watches a lot of youtube videos about a large variety of subjects, haven't come across to a video that is as straight-forward, useful and free of any non-sense bs as this one. Felt real good. Thanks. Can't wait to implement what you talked about.

    • @robotmania8896
      @robotmania8896  2 года назад

      Hi Kaan Ural!
      Thanks for watching my video!
      It is my pleasure if this video helps you.

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

    The video and the author replying to questions make this a good experience

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

      Hi Shenlong!
      Thank you! I am trying to answer questions to the best of my knowledge. I actually learn from it too.

  • @alisons3910
    @alisons3910 3 года назад +1

    Wow! Such a useful tutorial!

  • @PrajapatiSmit-b1i
    @PrajapatiSmit-b1i Год назад

    thanks bro !
    this tutorial helped a lot

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

      Hi Prajapati Smit!
      Thanks for watching my video!
      It is my pleasure if this video has helped you!

    • @Izaq-b2i
      @Izaq-b2i 11 месяцев назад

      hey how did you do this can you give me some guidance??

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

    Hi robot mania, I got following problem while running python3 ros_recognition_yolo.py
    Traceback (most recent call last): File "ros_recognition_yolo.py", line 13, in import torch File "/home/orin/.local/lib/python3.8/site-packages/torch/init.py", line 1122, in from .serialization import save, load File "/home/orin/.local/lib/python3.8/site-packages/torch/serialization.py", line 17, in from typing_extensions import TypeAlias # Python 3.10+ ImportError: cannot import name 'TypeAlias' from 'typing_extensions' (/usr/lib/python3/dist-packages/typing_extensions.py)
    could you please help me to solve the problem

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

      Hi mdmahedihassan2444!
      This may help.
      pip3 install typing-extensions -upgrade

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

    Hey one question, how to modify this code so that is runs in gz sim instead of the old gazebo?

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

      Hi Adrian Kriewitz!
      Thanks for watching my video!
      What exactly do you mean by “gz sim”? Isn’t it just a newer version of gazebo which you can launch with the same launch commands that I have used in this video?

  • @Alex-wl3ze
    @Alex-wl3ze 2 года назад

    Hi, I'm facing an AttributeError: 'Upsample' object has no attribute 'recompute_scale_factor'. After a research I found out that it seems to be a torch version issue, but I tested both 1.12 and 1.11 and still the same error, also it seems I cannot downgrade torch any further. Which torch version does work for you guys?

    • @robotmania8896
      @robotmania8896  2 года назад +1

      Hi alejandro!
      Thanks for watching my video!
      Can you please try it out with python 3.8 and pytorch 1.10?

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

    Hi , I have a question , I want to use a different robot , how would I do that? I have the urdf files for it

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

      Hi zorohunter3!
      If there are no paths to mesh files in your URDF file, just replace the file with the “yolobot.urdf” file inside the “yolobot_description/robot” directory. Do not forget to rename your file to “yolobot.urdf”.

  • @gsheo1
    @gsheo1 2 года назад +1

    Thank you for a nice presentation about Yolov5-ros2. How can I control the yolobot by keyboard? It moves very slowly by itself. I want to control it to move it fast as like at your video.

    • @robotmania8896
      @robotmania8896  2 года назад +1

      Hi Gwi Suk Heo!
      Thanks for watching my video!
      If you want to control this robot using keyboard, you have to install “teleop_twist_keyboard” package. Install it by “$ sudo apt install ros-foxy-teleop-twist-keyboard”. Also, don’t forget to remap the “/cmd_vel” topic to “/yolobot/cmd_vel”.

    • @gsheo1
      @gsheo1 2 года назад

      @@robotmania8896 Thank you. I remap and it works. But yolobot moves very slowly although I increased the speed of the yolobot by q and w keys. Rotation speed is increased well by e key. How can I increase the speed of yolobot by changing the code?

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

    how to make the robot move faster ?
    it is moving very very slow for me

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

      Hi srimidhineshsankurabhukta8461!
      Thanks for watching my video!
      Sorry for the late response, I have missed your comment.
      In the “robot_control.py” script in lines 43 and 45 multiply some constant number bigger then 1 to data.axes[1] and data.axes[0] respectively. It should make the robot faster.

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

    Hi how can i implement with real camera instead of gazebo

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

      Hi ELASTICO!
      Thanks for watching my video!
      If your camera publishes the “rgb_cam/image_raw” topic, you should be able to use the code as it is. In other words, please publish the “rgb_cam/image_raw” topic.

  • @widedmahjoub8763
    @widedmahjoub8763 2 года назад

    Hi, great job but i have a doubt. I can't find the gazebo directory at home directory

    • @robotmania8896
      @robotmania8896  2 года назад

      Hi wided MAHJOUB!
      Thanks for watching my video!
      If there is no gazebo directory in your home directory, please open a terminal and execute “$ gazebo”. Also, note that “.gazebo” is a hidden folder, so if there still will be no “.gazebo” folder after execution of the command, check the “Show Hidden Files” option on the upper right side of the “Files” window.

  • @joeljames4509
    @joeljames4509 2 года назад

    hello ty for the video. id like to know if its possible to run this in ros melodic with yolo v3. any suggestions please reply.

    • @robotmania8896
      @robotmania8896  2 года назад

      Hi Joel James!
      Thanks for watching my video!
      You cannot run this simulation in ROS melodic since Yolo v5 uses python3. I have another video “Calculating object position using Jetson Nano and ROS Melodic” (ruclips.net/video/jxH68h8wzTM/видео.html). You can use the code of that video to do simulation on ROS melodic.

    • @joeljames4509
      @joeljames4509 2 года назад

      ​@@robotmania8896 mkay thank you very much. can i get your mail id to contact some errors ive got on yolo 3

    • @robotmania8896
      @robotmania8896  2 года назад

      @@joeljames4509 This is my e-mail address: robotmania8867@yahoo.com

  • @harshitarora9417
    @harshitarora9417 2 года назад

    Hi I am not getting the all the files when I clone the repository , , can anyone help me with that !

    • @robotmania8896
      @robotmania8896  2 года назад

      Hi Harshit Arora9!
      Thanks for watching my video!
      In what repository exactly are you experiencing a problem? Maybe you have to add the “--recursive” option?

  • @Izaq-b2i
    @Izaq-b2i 11 месяцев назад

    Hi, i love this video but i am new to this could you explain how do i do this if i clone your repo i have installed virtual box and inside installed ubuntu and have gazebo and ros2 but i need start up point how do i do this
    thanks

    • @robotmania8896
      @robotmania8896  11 месяцев назад

      Hi Izaq!
      Thanks for watching my video!
      What do you mean by “start up point”?

    • @Izaq-b2i
      @Izaq-b2i 11 месяцев назад

      @@robotmania8896 i have to much confusion in my mind i just need to clone the repo and change the files or i have to do the coding part by my own. how do i do the human detection at traffic light and create human and add sensors in gazebo and how do i create the environment in gazebo to detect human and integrate the yolov8 to detect human

    • @Izaq-b2i
      @Izaq-b2i 11 месяцев назад

      can you provide the readme file

    • @robotmania8896
      @robotmania8896  11 месяцев назад

      @@Izaq-b2i Since there is no git repository, I haven’t prepared a “readme” file. But all information required to execute the simulation is in the video. Where exactly are you experiencing a problem?

  • @olarewajulawal1827
    @olarewajulawal1827 2 года назад

    Well done. While using cuda GPU, I recorded error in line 80 of ros_recognition_yolo.py...
    self.model(torch.zero (1, 3, imgsz, imgsz). to(self.device).type_as(next(model.parameters ())))
    NameError: name 'model' is not defined. Did you mean: 'Node'?
    Any solution to this problem?

    • @robotmania8896
      @robotmania8896  2 года назад

      Hi Olarewaju Lawal!
      Thanks for watching my video!
      There was a bug in my code. I have fixed it and uploaded a new code.
      To fix this problem please add “self” before “model”.
      .type_as(next(self.model.parameters ())))

  • @mehmetkaanrs6829
    @mehmetkaanrs6829 Месяц назад

    what was your python version When you made this video ? Do you remember ?

    • @mehmetkaanrs6829
      @mehmetkaanrs6829 Месяц назад

      these days gazebo 11 released so I'm struggling with version problems.

    • @robotmania8896
      @robotmania8896  Месяц назад

      Hi Mehmet Kaan Genç!
      Thanks for watching my video!
      I think this tutorial should work with gazebo11 as well. In this tutorial I used python 3.8.2.

  • @sreepavangoli7879
    @sreepavangoli7879 2 года назад

    Is there C++ implementation of the project available?

    • @robotmania8896
      @robotmania8896  2 года назад

      Hi Sree Pavan Goli!
      Thanks for watching my videos!
      Unfortunately, I don’t have C++ implementation of this project.

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

    It would be very useful if you make a tutorial making new models in Gazebo, for example the boxes with pictures. Looks like your models are created in Blender, so I tried make such, but with no success, despite of using several tutorials. I trained YOLOv5 with my custom dataset (drywall-joint-detection in roboflow) and wanted to create such boxes, so the robot could point the detected objects. I easily managed just to change the picture of your model with mine, as a temporal solution.

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

      Hi Simeon Tsvetkov!
      Thank you for a suggestion. I will consider it.

  • @gsheo1
    @gsheo1 2 года назад

    I remap and it works. But yolobot moves very slowly although I increased the speed of the yolobot by q and w keys. Rotation speed is increased well by e key. How can I increase the speed of yolobot by changing the code?

    • @robotmania8896
      @robotmania8896  2 года назад

      Hi Gwi Suk Heo!
      You can increase speed of “yolobot” by modifying line 38 in robot_control.py. Multiply a value bigger than 1 to “data.axes[1]”. This should increase linear velocity of the robot.

    • @gsheo1
      @gsheo1 2 года назад

      @@robotmania8896 Thank you.

  • @avadhpatel8100
    @avadhpatel8100 2 года назад

    I am having trouble trying to recreate the yolov5 on ros noetic with realsense. Could I send you my code?

    • @robotmania8896
      @robotmania8896  2 года назад +1

      Hi avadh patel.
      Thanks for watching my video!
      I can not promise that I can fix the code but at least I can give you some advice.
      Also please write where exactly you are experiencing a problem.
      Here is my e-mail address.
      robotmania8867@yahoo.com

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

      I'm also trying to implement yolov5 on ros noetic with realsense camera, were you able to make it work?

  • @ngochoangtran9544
    @ngochoangtran9544 2 года назад

    Nice job, bro. Could I ask ? In this project, you used the ROS 2 Foxy or ROS Noetic. ? Thank you !

    • @robotmania8896
      @robotmania8896  2 года назад +1

      Hi NgocHoang Tran!
      Thanks for watching my video!
      I used ROS2 Foxy in this project.

  • @王文-t2g
    @王文-t2g 3 года назад

    What a great project! Can I use ros1 to start the project? Hope to get your answer

    • @robotmania8896
      @robotmania8896  3 года назад

      Hi 王文!
      Thanks for watching my video!
      You need ROS2 Foxy to run this project. But you can use python scripts from this project in ROS Noetic. Yolov5 recognition script will not work with ROS versions prior to ROS Noetic (like Melodic, Kinetic) because in these versions python2 is used.

    • @raviregalo461
      @raviregalo461 3 года назад

      @@robotmania8896 ​ hey! i'm currently working on a project of a autonomous boat. i am trying to use yolov5 for the detection of sea markers and have so far obtained a trained model. Would I be able to implement it in a ros node using ros melodic? Thanks!

    • @robotmania8896
      @robotmania8896  3 года назад

      Hi Ravi Regalo!
      Thanks for watching my video!
      You can not use yolov5 with ros melodic because yolov5 needs python>=3.8, and ros melodic uses python2. If you want to do object detection using yolo in ros melodic, I think you can use C++ implementation of yolo.

    • @raviregalo461
      @raviregalo461 3 года назад

      @@robotmania8896 Thank you very much for your reply. As I really need to use ROS melodic I think I will stick with yolov3 and darknet. Keep up the great videos!

  • @ahmadabdelghany3851
    @ahmadabdelghany3851 2 года назад

    WOW; thanks a lot for such amazing video! it helped me a lot. I am new to such thing and your video made it clear and understandable. can it work with turtlebot3?

    • @robotmania8896
      @robotmania8896  2 года назад

      Hi Ahmad Abdelghany!
      Thanks for watching my video!
      I am not very familiar with turtlebot3, but if you are using ROS Foxy, it should work. Note that maybe you should change topic name in the subscriber to the topic which turtlebot3 camera publishes.

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

    what version of ubuntu?

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

      In this tutorial I am using Ubuntu 20.04.

    • @Izaq-b2i
      @Izaq-b2i 11 месяцев назад

      hey did you figured it out ?

  • @Adroitbit
    @Adroitbit 2 года назад

    My only issue is the gazebo world taking so long to load xD

    • @robotmania8896
      @robotmania8896  2 года назад

      Hi VeryHardBit!
      Thanks for watching my video!
      If you just want to test the program, you can reduce the number of objects in the world. This may help.

  • @niranjansujay8487
    @niranjansujay8487 3 года назад +1

    Hi, Robot mania, Thanks for all your content!!... they are super useful and informative,
    I have a question -
    1. Can we integrate an intel real sense camera instead of a normal camera for object recognition,
    2. With your help I was able to get the distance and height of the object in front of the rover, how can integrate these two things along with object detection
    what I mean to say is that - along with detecting object how can I make it show the distance and height of an object in front of it?
    Thank you so much!! for everything your the best

    • @robotmania8896
      @robotmania8896  3 года назад +1

      Hi Niranjan Sujay!
      1. Yes, you can. For example, in the yolo_angle_estimation.py script, lines 79~89, 94~104 are where I set up and get frames. You can use this part of the code.
      2. If you want to show the distance and height on the monitor, use this code:
      text1 = "height : " + str(height) + “, distance : “ + str(distance)
      cv2.putText(img0, text1, (int((xyxy[0] + xyxy[2])/2), int((xyxy[1] + xyxy[3])/2)), cv2.FONT_HERSHEY_PLAIN, 3, [225, 255, 255], thickness=2, lineType=cv2.LINE_AA)
      this code should display distance and height in the middle of the bounding box.

  • @hamidrezaie5866
    @hamidrezaie5866 3 года назад

    Nice Job, thanks!
    Do you have a e-mail? I would like to ask you something regarding computer vision project.