本文整理汇总了C++中MessageManager::spin方法的典型用法代码示例。如果您正苦于以下问题:C++ MessageManager::spin方法的具体用法?C++ MessageManager::spin怎么用?C++ MessageManager::spin使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MessageManager
的用法示例。
在下文中一共展示了MessageManager::spin方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
// wrapper around MessageManager::spin() that can be passed to
// pthread_create()
void*
spinFunc(void* arg)
{
MessageManager* mgr = (MessageManager*)arg;
mgr->spin();
return NULL;
}
示例2: main
int main(int argc, char** argv)
{
// Initialize ROS node "sm_talker"
ros::init(argc, argv, "sm_listener");
// Required to start timers for non-node ROS use.
ros::Time::init();
// Little message to know she's started
ROS_INFO_STREAM("STARTING SM_MANAGER");
// Create and execute manager
// * Create a TCP server connection on TCP_PORT (see common.h)
// * Initialize manager using server connection
// * Initialize handler using server connection
// * Add handler to manager
// * Execute manager spin loop
TcpServer server;
server.init(TCP_PORT);
MessageManager manager;
MyHandler handler;
manager.init(&server);
// Handler initilaized with reply connection (typically the same as
// incoming connection but now always)
handler.init(&server);
manager.add(&handler);
manager.spin();
return 0;
}
示例3: main
int main(int argc, char** argv)
{
char ip[1024] = "192.168.0.50"; // Robot IP address
TcpClient connection;
MessageManager manager;
ros::init(argc, argv, "state_interface");
ros::NodeHandle n;
JointRelayHandler jr_handler(n);
ROS_INFO("Setting up client");
connection.init(ip, StandardSocketPorts::STATE);
connection.makeConnect();
jr_handler.init(&connection);
manager.init(&connection);
manager.add(&jr_handler);
manager.spin();
}