[jsk_perception/mask_image_to_rect.cpp] check indices size before execute boundingRect #2113
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
When I execute the launch below (1) inside the robot, the error message (2) appeared.
However, it worked well with my PC.
I found the error occurred because the list of indices is empty by print debug (3).
It seems that this difference occurred because the process inside robot is slower than local PC (4).
That's why I added the line of checking indices size.
If there is any problem, please let me know.
(1) launch I wrote (I referenced jsk_perception/sample_flow_velocity_thresholding.launch)
(I modified INPUT_IMAGE and deleted rosbag_play node when executing it with robot)
(2) error of roslaunch test.launch + then executing
rostopic echo /mask_image_to_rect/output
(3) print debug
I added
std::cout << indices << std::endl;
before https://github.com/jsk-ros-pkg/jsk_recognition/blob/master/jsk_perception/src/mask_image_to_rect.cpp#L79like
the output of
std::cout << indices << std::endl;
is[]
when the error (2) occurred.
(4) rostopic hz
inside robot
my PC