ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Thank you. I was able to get the DetectionResult object using your suggestion. The detection result is made up of 3 items: the Image, list of ObjectNames and list of DetectedObject called detections. I was able to print all three. The detectedObject is made up of the following:

# Information of object detected in an image by re_vision
#

# detected points in the image
Pixel[] points2d
# detected 3d points in the camera reference
geometry_msgs/Point[] points3d
# pose of the object in the camera reference
geometry_msgs/Pose pose
# detected 3d points in the model reference
geometry_msgs/Point[] points3d_model

Basically if I print data.Detections, I get each of those items in a nicely formated output. But I am not sure how to get access to those individual items. Example output:

[points2d: 
  - 
    x: 394
    y: 49
  - 
    x: 395
    y: 49
  - 
    x: 387
    y: 48
...
...
points3d: 
  - 
    x: 0.0817023143172
    y: -0.208500802517
    z: 0.573309779167
  - 
    x: 0.082595653832
    y: -0.208231449127
    z: 0.573092222214
...
...
pose: 
  position: 
    x: 0.0
    y: 0.0
    z: 0.0
  orientation: 
    x: 0.0
    y: 0.0
    z: 0.0
    w: 0.0
points3d_model: []%

I would like to get access to individual points2d, points3d, pose, points3d_model. When I tried print data.Detections.points2d, I got an error saying that the list detections does not have a attribute points2d. So how would I go about accessing those items? I was thinking if its a string I would have to parse it with some sort of regex to get the x's, y's etc but I might complicating it too much.

Thanks for your help!