bag_player.cpp
Go to the documentation of this file.
1 #include "rosbag/bag_player.h"
2 
3 #define foreach BOOST_FOREACH
4 
5 namespace rosbag
6 {
7 
9  bag.open(fname, rosbag::bagmode::Read);
11  View v(bag);
12  bag_start_ = v.getBeginTime();
13  bag_end_ = v.getEndTime();
14  last_message_time_ = rs2rosinternal::Time(0);
15  playback_speed_ = 1.0;
16 }
17 
19  bag.close();
20 }
21 
23  return last_message_time_;
24 }
25 
27  bag_start_ = start;
28 }
29 
31  bag_end_ = end;
32 }
33 
35  if (scale > 0.0)
37 }
38 
40  return play_start_ + (msg_time - bag_start_) * (1 / playback_speed_);
41 }
42 
44 
45  std::vector<std::string> topics;
46  std::pair<std::string, BagCallback *> cb;
47  foreach(cb, cbs_)
48  topics.push_back(cb.first);
49 
52 
53  foreach(MessageInstance const m, view)
54  {
55  if (cbs_.find(m.getTopic()) == cbs_.end())
56  continue;
57 
59 
60  last_message_time_ = m.getTime(); /* this is the recorded time */
61  cbs_[m.getTopic()]->call(m);
62  }
63 }
64 
66  delete cbs_[topic];
67  cbs_.erase(topic);
68 }
69 
70 }
71 
std::map< std::string, BagCallback * > cbs_
Definition: bag_player.h:120
GLuint GLuint end
rs2rosinternal::Time getEndTime()
Definition: view.cpp:202
const GLfloat * m
Definition: glext.h:6814
GLenum GLenum GLenum GLenum GLenum scale
Definition: glext.h:10806
void set_end(const rs2rosinternal::Time &end)
Definition: bag_player.cpp:30
Base class for rosbag exceptions.
Definition: exceptions.h:43
void set_playback_speed(double scale)
Definition: bag_player.cpp:34
GLsizei const GLchar *const * string
void unregister_callback(const std::string &topic)
Definition: bag_player.cpp:65
void set_start(const rs2rosinternal::Time &start)
Definition: bag_player.cpp:26
rs2rosinternal::Time getBeginTime()
Definition: view.cpp:187
void close()
Close the bag file.
Definition: bag.cpp:161
rs2rosinternal::Time const & getTime() const
virtual ~BagPlayer()
Definition: bag_player.cpp:18
rs2rosinternal::Time bag_start_
Definition: bag_player.h:121
A class pointing into a bag file.
Time representation. May either represent wall clock time or ROS clock time.
Definition: time.h:177
GLuint start
static bool sleepUntil(const Time &end)
Sleep until a specific time has been reached.
Definition: time.cpp:354
BagPlayer(const std::string &filename)
Definition: bag_player.cpp:8
rs2rosinternal::Time real_time(const rs2rosinternal::Time &msg_time)
Definition: bag_player.cpp:39
rs2rosinternal::Time bag_end_
Definition: bag_player.h:122
double playback_speed_
Definition: bag_player.h:124
rs2rosinternal::Time last_message_time_
Definition: bag_player.h:123
fname
Definition: rmse.py:13
Definition: bag.h:66
rs2rosinternal::Time play_start_
Definition: bag_player.h:125
static void init()
Definition: time.cpp:272
std::string const & getTopic() const
static Time now()
Retrieve the current time. If ROS clock time is in use, this returns the time according to the ROS cl...
Definition: time.cpp:244
::std_msgs::Time_< std::allocator< void > > Time
Definition: Time.h:47
GLdouble v
rs2rosinternal::Time get_time()
Definition: bag_player.cpp:22


librealsense2
Author(s): Sergey Dorodnicov , Doron Hirshberg , Mark Horn , Reagan Lopez , Itay Carpis
autogenerated on Mon May 3 2021 02:45:07