yolact_ros icon indicating copy to clipboard operation
yolact_ros copied to clipboard

yolact_msgs question

Open Ragnar7982 opened this issue 11 months ago • 15 comments

Hello, I would like to ask where should I put the yolact_msgs? I'm using ROS2 Humble. image Is it put at the right folder? Thank you!

Ragnar7982 avatar Jan 06 '25 13:01 Ragnar7982

No, generally, you want to put all packages in the src folder of your colcon workspace. You can put them in other subdirectories, but you shouldn't put a package in the folder of another package. Check out the colcon documentation for more information. Also, make sure you have checked out the ROS2 branches of both repositories.

Eruvae avatar Jan 06 '25 14:01 Eruvae

Hello, thank you for replying fast, so right now I have put msgs into src folder(include yolact_ros_humble and yolact_ros_msgs), but when I tryna colcon build it shows: image do u know where might be the problems? Thanks.

Ragnar7982 avatar Jan 07 '25 03:01 Ragnar7982

You have the wrong version of the message package (catkin is the build system for ROS 1, and the package name should be yolact_ros2_msgs). Make sure you checkout the ROS2 branch (run "git checkout ROS2" in the yolact_ros_msgs folder).

Eruvae avatar Jan 07 '25 07:01 Eruvae

Hello, I forget to download ros2 version, Thank you very much! But I also have another question, after colcon build successfully, it shows: image This is my config.yaml file: yolact_ros2_node: ros__parameters: yolact_path: /home/ragnar/yolact_ws/src/yolact_ros-humble/yolact_ros2/yolact #/home/ragnar/yolact_ws/src/yolact_ros-humble/yolact_ros2/yolact model_path: /home/ragnar/yolact_ws/src/yolact_ros-humble/yolact_ros2/yolact/weights/yolact_plus_resnet50_54_800000.pth image_topic: /camera/camera/color/image_raw depth_topic: /camera/camera/depth/image_rect_raw camera_info_topic: /camera/camera/color/camera_info use_compressed_image: False use_compressed_depth: False publish_visualization: True publish_detections: True publish_pointcloud: True display_visualization: True display_masks: True display_bboxes: True display_text: True display_scores: True display_fps: True score_threshold: 0.0 crop_masks: True top_k: 10 publish_namespace: /yolact_ros2

Ragnar7982 avatar Jan 07 '25 08:01 Ragnar7982

Ok, this is probably because my humble branch was outdated (I haven't been using the ROS 2 version of this package). I've merged the pull request from @fgonzalezr1998, so try updating to the latest version of the humble branch now and check if it works.

Eruvae avatar Jan 07 '25 08:01 Eruvae

Hello, thank you for the fast replying, I went to download the latest version or humble, but I still can't build successfully, it says stderr output: image

Also not sure is stderr output problems or something else, it said No module named 'yolact' image

Ragnar7982 avatar Jan 07 '25 08:01 Ragnar7982

The error "No module named yolact" indicates that you probably haven't checked out the yolact submodule, which should be in the yolact_ros2 folder. You can run "git submodule init" and then "git submodule update" initialize and update the submodule to the specified version. Alternatively, you can also just manually clone yolact into that folder.

Eruvae avatar Jan 07 '25 09:01 Eruvae

I have put yolact into workspace, but I wonder was colcon build successfully or no? it said stderr output. Now I use conda environment( which is worked for yolact and plus), but when I run launch it shows: image But I run pip list, it shows I already have pycocotools(version 2.0.7) So usually you run at conda environment as well right?

Ragnar7982 avatar Jan 07 '25 09:01 Ragnar7982

You can see the error messages from colcon in the screenshot you posted, they are just warnings to rename some variables in the setup.cfg. This doesn't affect functionality for humble, but will be required for newer ROS versions. Regarding the pycocotools error: It looks like you have a virtual environment, and pycocotools is installed in that, while the ros2 launch command might not use that environment. You can try running "colcon build" with the virtual environment already activated. If that doesn't fix your issue, have a look at the documentation for how to setup the virtual environment, or check out this github issue or this article.

Eruvae avatar Jan 07 '25 09:01 Eruvae

To clarify, I'm not using conda for ROS environments. You might be able to get it to work, but as mentioned in the documentation, you need to make sure the interpreter used by conda is the same as the system interpreter.

Eruvae avatar Jan 07 '25 10:01 Eruvae

Wait so this launch file can be used without torch or virtual environment? Or you just install in the system?

Ragnar7982 avatar Jan 07 '25 11:01 Ragnar7982

You need the python packages required by yolact (including torch), but you don't necessarily need a virtual environment. The easiest way to get it running is to just install the packages to your system or user (via apt or pip), if you don't mind doing that. But creating a virtual environment for your workspace should also be possible - how to do that with just virtualenv is described in the documentation, and I've also used virtualenvwrapper. Conda could be more problematic, but might also work. As mentioned, I haven't been using the ROS 2 version of this package. Some people mention you might need to add:

[build_scripts]
executable = /usr/bin/env python3

to the setup.cfg of the package for it to work with virtual environments. Not sure if that's still the case, but you can give it a try.

Eruvae avatar Jan 07 '25 11:01 Eruvae

Ok, I will try. Thank you for helping me a lot and replying fast, I really appreciate it! About yolact_config.yaml, I would like to know is ROS2 humble supported pointcloud? Because I saw ROS1 have pointcloud but not ROS2.

Ragnar7982 avatar Jan 07 '25 11:01 Ragnar7982

Do you mean ROS 2 in general or this package? ROS 2 has support for point clouds, but this package doesn't have anything to do with that, neither in the ROS 1 nor in the ROS 2 version. I saw you mentioned a "publish_pointcloud: True" parameter, but this is not a parameter in any of my versions of the package. The yolact ros node just subscribes to (RGB) images and can publish an image with masks and/or the results as custom message for further processing. If you want to generate a point cloud from that (possibly with labels), you need to do that separately. I have done that e.g. in my pointcloud_roi package, but this is ROS 1 and also only generates a point cloud with regions of interest, not a fully labeled one. But generally, it would be possible to create a node that subscribes to the detections, depth and optionally RGB images (or alternatively an ordered point cloud), synchronizes them, and uses the detection messages to label the points. This should probably be done in a C++ node though.

Eruvae avatar Jan 07 '25 12:01 Eruvae

Ok I see, thank you for helping me, I will try if it can works at virtual env. Thanks!

Ragnar7982 avatar Jan 07 '25 12:01 Ragnar7982