std::shared_ptr<ros::Subscriber> TaskManager::subscribe(const std::string &topic)
{
ROS_INFO("Subscribing to %s", topic.c_str());
ros::NodeHandle nh;
std::shared_ptr<ros::Subscriber> sub(std::make_shared<ros::Subscriber>());
ros::SubscribeOptions ops;
ops.topic = topic;
ops.queue_size = 100; // modify jiaopeng 队列大小调小
ops.md5sum = ros::message_traits::md5sum<topic_tools::ShapeShifter>();
ops.datatype = ros::message_traits::datatype<topic_tools::ShapeShifter>();
ops.helper = boost::make_shared<ros::SubscriptionCallbackHelperT<
const ros::MessageEvent<topic_tools::ShapeShifter const> &>>(
boost::bind(&TaskManager::doQueue, this, boost::placeholders::_1, topic, sub));
// ops.transport_hints = options_.transport_hints;
*sub = nh.subscribe(ops);
currently_recording_->insert(topic);
return sub;
}