Change the position of 'hardTimeToSoftTime'

This commit is contained in:
KalmanSLightech 2018-07-03 18:56:16 +08:00
parent c5b054c864
commit 27eb9e6cb2

View File

@ -44,19 +44,6 @@ MYNTEYE_BEGIN_NAMESPACE
namespace enc = sensor_msgs::image_encodings;
ros::Time hardTimeToSoftTime(double _hard_time) {
static bool isInited = false;
static double soft_time_begin(0), hard_time_begin(0);
if (false == isInited) {
soft_time_begin = ros::Time::now().toSec();
hard_time_begin = _hard_time;
isInited = true;
}
return ros::Time(soft_time_begin + (_hard_time - hard_time_begin) * 0.00001f);
}
class ROSWrapperNodelet : public nodelet::Nodelet {
public:
ROSWrapperNodelet() {}
@ -84,6 +71,20 @@ class ROSWrapperNodelet : public nodelet::Nodelet {
}
}
ros::Time hardTimeToSoftTime(double _hard_time) {
static bool isInited = false;
static double soft_time_begin(0), hard_time_begin(0);
if (false == isInited) {
soft_time_begin = ros::Time::now().toSec();
hard_time_begin = _hard_time;
isInited = true;
}
return ros::Time(
soft_time_begin + (_hard_time - hard_time_begin) * 0.00001f);
}
void onInit() override {
initDevice();
NODELET_FATAL_COND(api_ == nullptr, "No MYNT EYE device selected :(");