Change the position of 'hardTimeToSoftTime'
This commit is contained in:
parent
c5b054c864
commit
27eb9e6cb2
|
@ -44,19 +44,6 @@ MYNTEYE_BEGIN_NAMESPACE
|
||||||
|
|
||||||
namespace enc = sensor_msgs::image_encodings;
|
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 {
|
class ROSWrapperNodelet : public nodelet::Nodelet {
|
||||||
public:
|
public:
|
||||||
ROSWrapperNodelet() {}
|
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 {
|
void onInit() override {
|
||||||
initDevice();
|
initDevice();
|
||||||
NODELET_FATAL_COND(api_ == nullptr, "No MYNT EYE device selected :(");
|
NODELET_FATAL_COND(api_ == nullptr, "No MYNT EYE device selected :(");
|
||||||
|
|
Loading…
Reference in New Issue
Block a user