custom_callback_processing.cpp File Reference

#include "ros/ros.h"
#include "ros/callback_queue.h"
#include <boost/shared_ptr.hpp>
#include "ros/types.h"
#include "ros/time.h"
#include <boost/thread/mutex.hpp>
#include <boost/thread/shared_mutex.hpp>
#include <boost/thread/condition_variable.hpp>
#include <boost/thread/tss.hpp>
#include <list>
#include <deque>
#include "std_msgs/String.h"
#include <boost/thread.hpp>
Include dependency graph for custom_callback_processing.cpp:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

void callbackThread ()
void chatterCallbackCustomQueue (const std_msgs::String::ConstPtr &msg)
void chatterCallbackMainQueue (const std_msgs::String::ConstPtr &msg)
int main (int argc, char **argv)

Variables

ros::CallbackQueue g_queue

Function Documentation

void callbackThread (  ) 

Definition at line 59 of file custom_callback_processing.cpp.

void chatterCallbackCustomQueue ( const std_msgs::String::ConstPtr &  msg  ) 

This callback gets called from the custom queue

Definition at line 50 of file custom_callback_processing.cpp.

void chatterCallbackMainQueue ( const std_msgs::String::ConstPtr &  msg  ) 

This tutorial demonstrates the use of custom separate callback queues that can be processed independently, whether in different threads or just at different times. This callback gets called from the main queue processed in spin()

Definition at line 42 of file custom_callback_processing.cpp.

int main ( int  argc,
char **  argv 
)

The SubscribeOptions structure lets you specify a custom queue to use for a specific subscription. You can also set a default queue on a NodeHandle using the NodeHandle::setCallbackQueue() function.

AdvertiseOptions and AdvertiseServiceOptions offer similar functionality.

Now we subscribe using the normal method, to demonstrate the difference.

Start a thread to service the custom queue

Now do a custom spin, to demonstrate the difference.

Definition at line 70 of file custom_callback_processing.cpp.


Variable Documentation

ros::CallbackQueue g_queue

The custom queue used for one of the subscription callbacks

Definition at line 58 of file custom_callback_processing.cpp.

 All Classes Namespaces Files Functions Variables Typedefs


roscpp_tutorials
Author(s): Morgan Quigley
autogenerated on Fri Jan 11 09:54:49 2013