Skip to content

Commit 5c059c3

Browse files
committed
Optionally publish a sim clock and use timestamps stored in svo in message headers rather than current wall time.
Sim clock appears to be working, may have some odd glitches, may mess up non svo-playback modes Adjusting some of the timestamps, not sure if all pubs are using good timestamps, some of the static frames are timestamp 0 (but that's okay for static frames?), need to figure out if faster than real time playback is possible- there must be an api that allows read frames quickly, but maybe ruled out here.
1 parent a666d67 commit 5c059c3

File tree

4 files changed

+129
-57
lines changed

4 files changed

+129
-57
lines changed

zed_nodelets/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ find_package(catkin REQUIRED COMPONENTS
4242
roscpp
4343
image_transport
4444
rosconsole
45+
rosgraph_msgs
4546
sensor_msgs
4647
stereo_msgs
4748
std_msgs

zed_nodelets/package.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
<depend>nav_msgs</depend>
1919
<depend>roscpp</depend>
2020
<depend>rosconsole</depend>
21+
<depend>rosgraph_msgs</depend>
2122
<depend>sensor_msgs</depend>
2223
<depend>stereo_msgs</depend>
2324
<depend>message_filters</depend>

zed_nodelets/src/zed_nodelet/include/zed_wrapper_nodelet.hpp

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
#include <image_transport/image_transport.h>
3232
#include <nodelet/nodelet.h>
3333
#include <ros/ros.h>
34+
#include <rosgraph_msgs/Clock.h>
3435
#include <sensor_msgs/PointCloud2.h>
3536
#include <tf2/LinearMath/Transform.h>
3637
#include <tf2_ros/static_transform_broadcaster.h>
@@ -117,6 +118,17 @@ class ZEDWrapperNodelet : public nodelet::Nodelet
117118
*/
118119
void readParameters();
119120

121+
ros::WallTimer wall_timer_;
122+
ros::Time sim_clock_base_time;
123+
/*! \brief Publish the current time when use_sim_time is true
124+
* \param t : the ros::Time to send in the clock message
125+
*/
126+
void publishSimClock(const ros::Time& stamp);
127+
128+
/*! \brief sim clock update thread
129+
*/
130+
void sim_clock_update(const ros::WallTimerEvent& e);
131+
120132
/*! \brief ZED camera polling thread function
121133
*/
122134
void device_poll_thread_func();
@@ -156,7 +168,7 @@ class ZEDWrapperNodelet : public nodelet::Nodelet
156168
/*!
157169
* \brief Publish IMU frame once as static TF
158170
*/
159-
void publishStaticImuFrame();
171+
void publishStaticImuFrame(const ros::Time& t);
160172

161173
/*! \brief Publish a sl::Mat image with a ros Publisher
162174
* \param imgMsgPtr : the image message to publish
@@ -417,6 +429,8 @@ class ZEDWrapperNodelet : public nodelet::Nodelet
417429
image_transport::CameraPublisher mPubRightGray;
418430
image_transport::CameraPublisher mPubRawRightGray;
419431

432+
ros::Publisher mPubSimClock;
433+
420434
ros::Publisher mPubConfMap; //
421435
ros::Publisher mPubDisparity; //
422436
ros::Publisher mPubCloud;
@@ -610,6 +624,7 @@ class ZEDWrapperNodelet : public nodelet::Nodelet
610624
double mCamDepthResizeFactor = 1.0;
611625

612626
// flags
627+
bool mUseSimTime = false;
613628
bool mTriggerAutoExposure = true;
614629
bool mTriggerAutoWB = true;
615630
bool mComputeDepth;

0 commit comments

Comments
 (0)