31 buffer_frequency_(buffer_frequency),
37 if (
topics_.size() != sonar_msgs.size() )
39 std::cerr <<
"Incorrect number of sonar range messages in sonar recorder. " << sonar_msgs.size() <<
"/" <<
topics_.size() << std::endl;
43 for(
size_t i=0; i<sonar_msgs.size(); ++i)
45 if (!sonar_msgs[i].header.stamp.isZero()) {
46 gr_->write(
topics_[i], sonar_msgs[i], sonar_msgs[i].header.stamp);
56 boost::mutex::scoped_lock lock_write_buffer(
mutex_ );
57 boost::circular_buffer< std::vector<sensor_msgs::Range> >::iterator it;
84 boost::mutex::scoped_lock lock_bufferize(
mutex_ );
98 boost::mutex::scoped_lock lock_bufferize(
mutex_ );
void bufferize(const std::vector< sensor_msgs::Range > &sonar_msgs)
void reset(boost::shared_ptr< naoqi::recorder::GlobalRecorder > gr, float conv_frequency)
boost::circular_buffer< std::vector< sensor_msgs::Range > > buffer_
void setBufferDuration(float duration)
std::vector< std::string > topics_
static const float bufferDefaultDuration
boost::shared_ptr< naoqi::recorder::GlobalRecorder > gr_
SonarRecorder(const std::vector< std::string > &topics, float buffer_frequency=0)
void writeDump(const ros::Time &time)
void write(const std::vector< sensor_msgs::Range > &sonar_msgs)