ROS2-Path-Planning-and-Maze-Solving icon indicating copy to clipboard operation
ROS2-Path-Planning-and-Maze-Solving copied to clipboard

avoid bad image message

Open Cryst4L9527 opened this issue 2 years ago • 1 comments

In addition, considering the error when transferring the information and other noise, we mutate some of the image message and there will be a crash like following:

maze_solver:
Traceback (most recent call last):
  File "/opt/ros/foxy/lib/python3.8/site-packages/cv_bridge/core.py", line 191, in imgmsg_to_cv2
    res = cvtColor2(im, img_msg.encoding, desired_encoding)
RuntimeError: OpenCV(4.2.0) ../modules/imgproc/src/color.cpp:182: error: (-215:Assertion failed) !_src.empty() in function 'cvtColor'

It's because of a mutation of the message's width and height data, causing the cvtColor2 memset a zero-size src to transfer. Although it may be hard to happen in a stable simulation environment, we hope it can be addressed as a robust feature.

Cryst4L9527 avatar Oct 28 '22 07:10 Cryst4L9527

Maybe you can just confirm this? Just a small change of codes for better robustness, it won't change the main functions of this program.

Cryst4L9527 avatar Feb 12 '23 04:02 Cryst4L9527