enter image description hereI'm into a project wherein i have to detect the object using using yolov5 and put that object inside the map .Can anyone here please provide me a pathway to do so,It will be very useful.

my current situation .I cant find the laserscan in rviz


2 Answers 2


Here is my idea :

  1. Take the depth image provided by your camera
  2. If you only want to detect objects (and not other obstacles), modify this depth image by setting pixels outside the objects bounding boxes to a large value.
  3. use depthimage_to_laserscan to convert this depth image to a laserscan.
  4. Integrate the laserscan with your costmap

If performance is not an issue, you can directly integrate the depth image as a Voxel Layer by converting it to a PointCloud (http://wiki.ros.org/depth_image_proc) so that you have 3D object avoidance (meaning that your device will be able to say "ok there is an obstacle but it is above me so I can still go through"). If you don't need this feature, convert it using step 3.

You can also take a look at http://wiki.ros.org/spatio_temporal_voxel_layer for the integration of your laser scan or depth image with your costmap.

  • $\begingroup$ the objects which i detect using yolo need to be put as an obstacle inside the global costmap and later then use than map for navitgation purpose $\endgroup$ Nov 10, 2023 at 10:20
  • $\begingroup$ Do you use a stereo camera in order to get distance between you and the object ? $\endgroup$ Nov 10, 2023 at 10:26
  • $\begingroup$ i'm using intelsense 435d to serve the purpose $\endgroup$ Nov 10, 2023 at 10:27
  • $\begingroup$ thanks for the support really appreciate it..I need a little detail on the process between point 2 and 3 $\endgroup$ Nov 11, 2023 at 2:40
  • $\begingroup$ Imagine your object detection detects humans only and there is a dog in your image aswell (you don't detect it using yolo). Do you want to consider this dog as an obstacle aswell or not ? If yes, don't modify the depth image. If not, modify it by setting everything outside your bounding box (of the human) to a large value so that it won't be considered as an obstacle. $\endgroup$ Nov 11, 2023 at 9:56

As an example of prior art:

Here's a guy that did it with Tensor flow and a kinect camera for the object and depth detection. YOLO and Realsense is not so different in application.



I'm not saying his code will work for you, but always a good idea to study those that came before you.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.