ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange |
1 | initial version |
In the log you have info"
error: conversion from ‘vision_msgs::msg::Detection2DArray_<std::allocator<void> >::_detections_type’
to non-scalar type ‘vision_msgs::msg::Detection2D’
I would iterate over the array of Detection2D (detections
) in Detection2DArray.msg
to get both results
and bbox
from Detection2D
each iteration.
Detection2DArray.msg is of the form:
# A list of 2D detections, for a multi-object 2D detector.
std_msgs/Header header
# A list of the detected proposals. A multi-proposal detector might generate
# this list with many candidate detections generated from a single input.
Detection2D[] detections
Detection2D.msg is of the form:
# Defines a 2D detection result.
#
# This is similar to a 2D classification, but includes position information,
# allowing a classification result for a specific crop or image point to
# to be located in the larger image.
Header header
# Class probabilities
ObjectHypothesisWithPose[] results
# 2D bounding box surrounding the object.
BoundingBox2D bbox
# The 2D data that generated these results (i.e. region proposal cropped out of
# the image). Not required for all use cases, so it may be empty.
sensor_msgs/Image source_img
Try to write MWE code with just raw messages of both types to see how to get each part of the message you want.
I think C++11 range-based for
loops could maybe help you there?