leggedrobotics / darknet_ros

YOLO ROS: Real-Time Object Detection for ROS
BSD 3-Clause "New" or "Revised" License
2.14k stars 1.16k forks source link

waiting for image on ROS2 dashing #335

Closed ludovicoderic closed 3 years ago

ludovicoderic commented 3 years ago

I habe Ubuntu 18.04 and ROS1 Melodic and ROS2 dashing, and I tried making this package run on ROS2 dashing, but i couldn't make it.

The steps I did are the following one:

  1. source /opt/ros/dashing/setup.bash
  2. mkdir -p ~/darknet2_ws/src
  3. cd ~/darknet2_ws/src
  4. git clone --recursive git@github.com:leggedrobotics/darknet_ros.git -b ros2
  5. cd ..
  6. colcon build

After that, the pachage builds correctly, but when runing ros2 launch darknet_ros darknet_ros.launch.py (with or without changing the directories of the topic to subscribe to), it gets stuck loading weights as so:

[INFO] [launch]: All log files can be found below /home/valde18/.ros/log/2021-06-23-10-16-32-082029-DESKTOP-H7QOGIF-18190
[INFO] [launch]: Default logging verbosity is set to INFO
[INFO] [darknet_ros-1]: process started with pid [18200]
[darknet_ros-1] layer     filters    size              input                output
[darknet_ros-1]     0 conv     16  3 x 3 / 1   416 x 416 x   3   ->   416 x 416 x  16  0.150 BFLOPs
[darknet_ros-1]     1 max          2 x 2 / 2   416 x 416 x  16   ->   208 x 208 x  16
[darknet_ros-1]     2 conv     32  3 x 3 / 1   208 x 208 x  16   ->   208 x 208 x  32  0.399 BFLOPs
[darknet_ros-1]     3 max          2 x 2 / 2   208 x 208 x  32   ->   104 x 104 x  32
[darknet_ros-1]     4 conv     64  3 x 3 / 1   104 x 104 x  32   ->   104 x 104 x  64  0.399 BFLOPs
[darknet_ros-1]     5 max          2 x 2 / 2   104 x 104 x  64   ->    52 x  52 x  64
[darknet_ros-1]     6 conv    128  3 x 3 / 1    52 x  52 x  64   ->    52 x  52 x 128  0.399 BFLOPs
[darknet_ros-1]     7 max          2 x 2 / 2    52 x  52 x 128   ->    26 x  26 x 128
[darknet_ros-1]     8 conv    256  3 x 3 / 1    26 x  26 x 128   ->    26 x  26 x 256  0.399 BFLOPs
[darknet_ros-1]     9 max          2 x 2 / 2    26 x  26 x 256   ->    13 x  13 x 256
[darknet_ros-1]    10 conv    512  3 x 3 / 1    13 x  13 x 256   ->    13 x  13 x 512  0.399 BFLOPs
[darknet_ros-1]    11 max          2 x 2 / 1    13 x  13 x 512   ->    13 x  13 x 512
[darknet_ros-1]    12 conv   1024  3 x 3 / 1    13 x  13 x 512   ->    13 x  13 x1024  1.595 BFLOPs
[darknet_ros-1]    13 conv    512  3 x 3 / 1    13 x  13 x1024   ->    13 x  13 x 512  1.595 BFLOPs
[darknet_ros-1]    14 conv    425  1 x 1 / 1    13 x  13 x 512   ->    13 x  13 x 425  0.074 BFLOPs
[darknet_ros-1]    15 detection
[darknet_ros-1] mask_scale: Using default '1.000000'
[darknet_ros-1] [INFO] [darknet_ros]: [YoloObjectDetector] Node started.
[darknet_ros-1] [INFO] [darknet_ros]: [YoloObjectDetector] Xserver is running.
[darknet_ros-1] [INFO] [darknet_ros]: [YoloObjectDetector] init().
[darknet_ros-1] YOLO V3
[darknet_ros-1] Loading weights from /home/valde18/darknet2_ws/install/darknet_ros/share/darknet_ros/yolo_network_config/weights/yolov2-tiny.weights...Done!

Then after a few minutes (2-3 min) without displaying anything else besides the loading weights line, it displays dozens of [darknet_ros-1] Waiting for image., but the image is being published onto the /camera/rgb/camera_raw topic, so it shouldn't be neccesary to change the path onto darknet_ros.launch.py, YoloObjectDetector.cpp and ros.yaml. Also, by doing a ros2 topic echo /camera/rgb/camera_raw, I can see how the data it's being published correctly, and its of type sensor_msgs/msg/Image.

AnukritiSinghh commented 2 years ago

Hey, how did you solve this? I am facing the same issue

ludovicoderic commented 2 years ago

In my case it was a problem with the publisher that I had on ROS2 on windows, and the subscriber in WSL Dashing, since I was able to make a ros2 topic echo on WSL and see the data being published, but I was unable for some reason to subscribe to it. That being said, I ended making another publisher that send the data of the image that I needed properly, and to make sure that from a standar topic on ROS2 dashing I was able to subcribe to it and see the image. Once I properly send the image topic, it did work as espected.