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

How to achieve a value of a multi-type message mesage ?

asked 2014-05-09 00:07:07 -0500

Mobile_robot gravatar image

updated 2014-05-09 00:18:30 -0500

Dear friends,

I am trying to Subscribe from a topic, this topic has been published by CMVISION (/blobs) and has this type :

Header header uint32 image_width uint32 image_height uint32 blob_count Blob[] blobs

and in this type, "Blob" is another message type itself : uint32 red uint32 green uint32 blue uint32 area uint32 x uint32 y uint32 left uint32 right uint32 top uint32 bottom

I want to subscribe the "x" and "y" from this message, but I dont know hoe to call that,

For example I want to write them on the terminal and in my "callback" function I wrote :

void callback1(const cmvision::Blobs::ConstPtr& msg1) {

ROS_INFO("I heard: [%d]", msg1->blobs ??????);

}

I tried to call that like an array, it didn't work.... can any body help me in this problem?

Thanks HAmed

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
1

answered 2014-05-09 02:54:04 -0500

BennyRe gravatar image

blobs should be a std::vector, so

msgl->blobs.at(i)

or

msgl->blobs[i]

should work

edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2014-05-09 00:07:07 -0500

Seen: 190 times

Last updated: May 09 '14