12 double const NXLIB_TIMESTAMP_OFFSET = 11644473600;
14 double timeNowAsSeconds()
18 auto nanoseconds = std::chrono::duration_cast<std::chrono::nanoseconds>(
t.time_since_epoch()).count();
19 return (
double)nanoseconds / 1e09;
22 double fixTimestamp(
double const& timestamp,
bool isFileCamera =
false)
26 if (std::isnan(timestamp))
28 ENSENSO_WARN(
"NxLib timestamp is \'nan\', using current ROS time instead.");
29 return timeNowAsSeconds();
31 else if (isFileCamera)
34 return timeNowAsSeconds();
37 return timestamp - NXLIB_TIMESTAMP_OFFSET;
43 return fixTimestamp(timestamp, isFileCamera);
52 geometry_msgs::msg::Point32
toRosPoint(NxLibItem
const& itemArray,
bool convertUnits)
54 geometry_msgs::msg::Point32 point;
63 point.x = itemArray[0].asDouble();
64 point.y = itemArray[1].asDouble();
65 point.z = itemArray[2].asDouble();
71 NxLibItem
toEnsensoPoint(geometry_msgs::msg::Point32
const& point,
bool convertUnits)
82 itemPoint[0] = point.x;
83 itemPoint[1] = point.y;
84 itemPoint[2] = point.z;
NxLibItem toEnsensoPoint(geometry_msgs::msg::Point32 const &point, bool convertUnits=true)
double nxLibToPclTimestamp(double const ×tamp, bool isFileCamera=false)
geometry_msgs::TransformStamped t
inline ::ros::Time now(ensenso::ros::NodeHandle const &nh)
void ENSENSO_WARN(T... args)
const int conversionFactor
double nxLibToRosTimestamp(double const ×tamp, bool isFileCamera=false)
geometry_msgs::msg::Point32 toRosPoint(NxLibItem const &itemArray, bool convertUnits=true)