ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange |
1 | initial version |
Here is the cmvision/Blobs message structure:
std_msgs/Header header
uint32 seq
time stamp
string frame_id
uint32 image_width
uint32 image_height
uint32 blob_count
cmvision/Blob[] blobs
string name
uint32 red
uint32 green
uint32 blue
uint32 area
uint32 x
uint32 y
uint32 left
uint32 right
uint32 top
uint32 bottom
When you access your cmvision::Blobs struct like so pow(lastobjectpose.x-lastFollowerPose.x,2)
, you are implying that the Blobs message type has some x
member. However, the x and y that you are looking for are in actuality in lastobjectpose.blobs[some_index].x
and so it goes for y. Hence it might make sense for you to instead loop through lastobjectpose.blobs
, using lastobjectpose.blob_count
as your bound, i.e,
for (i = 0; i < lastobjectpose.blob_count; i++) {
//Do your stuff.
}