您的位置:首页 > 其它

随笔之ros多线程

2016-04-06 18:46 337 查看
nt main(int argc, char **argv)
{
ros::init(argc, argv, "convert_to_mono");
ros::NodeHandle nh;

ros::Publisher image_pub = nh.advertise<sensor_msgs::Image>("image_hsv", 1000);
ros::Subscriber image_sub = nh.subscribe(image_topic, 1000, &update_image);
ros::Subscriber range_sub = nh.subscribe("sonar_height", 1000, &update_range);
ros::Publisher cmd_vel_pub=nh.advertise<geometry_msgs::Twist>("/cmd_vel",1);

ros::AsyncSpinner spinner(4); // Use 4 threads
spinner.start();

ros::Rate loop_rate(22);

while (ros::ok())
{

loop_rate.sleep();
}

ros::waitForShutdown();
return 0;
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: