Ask Your Question

Revision history [back]

When I see your problem it looks a bit similar to the problem here: http://answers.ros.org/question/212347/how-to-publish-images-quickly/

For you, I just would add a image counter for 10, so you do not do the subscribing thing all the time and keep it open. Trade off would be, that of course you will still lose the bandwidth, if that is critical to your application, this might be not the way, otherwise I guess it is. (The images will be constantly transmitted, but you ignore them.)

void callback(...)
{
  if(image_processing_enable) 
  {
   //.... Save your image, processing ... what ever ...
   image_no++;
   if(image_no==10)
   {
     image_processing_enable=false; // for getting only ten images. 
     image_no=0;
   }
  }
}

When I see your problem it looks a bit similar to the problem here: http://answers.ros.org/question/212347/how-to-publish-images-quickly/

For you, I just would add a image counter for 10, so you do not do the subscribing thing all the time and keep it open. Trade off would be, that of course you will still lose the bandwidth, if that is critical to your application, this might be not the way, otherwise I guess it is. (The images will be constantly transmitted, but you ignore them.)

void callback(...)
{
  if(image_processing_enable) 
  {
   //.... Save your image, processing ... what ever ...
   image_no++;
   if(image_no==10)
   {
     image_processing_enable=false; // for getting only ten images. 
     image_no=0;
   }
  }
}

If it is the bandwith, you might create a node on your own which can republish 10 images for you on one system and transmits them to the target system when you do a call to a rosservice it.

ImageNode -Topic-> Gatherimages  -Topic-> Receiver Node
                       ^----------rosservice-----|

I would suggest an type std_srvs/Empty with name /get_images.

When I see your problem it looks a bit similar to the problem here: http://answers.ros.org/question/212347/how-to-publish-images-quickly/

For you, I just would add a image counter for 10, so you do not do the subscribing thing all the time and keep it open. Trade off would be, that of course you will still lose the bandwidth, if that is critical to your application, this might be not the way, otherwise I guess it is. (The images will be constantly transmitted, but you ignore them.)

void callback(...)
{
  if(image_processing_enable) 
  {
   //.... Save your image, processing ... what ever ...
   image_no++;
   if(image_no==10)
   {
     image_processing_enable=false; // for getting only ten images. 
     image_no=0;
   }
  }
}

If it is the bandwith, you might create a node on your own which can republish 10 images for you on one system and transmits them to the target system when you do a call to a rosservice it.

ImageNode -Topic-> Gatherimages Republish-Images  -Topic-> Receiver Node
                       ^----------rosservice-----|

I would suggest an type std_srvs/Empty with name /get_images.