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)
24 if (std::isnan(timestamp))
27 ENSENSO_WARN(
"NxLib timestamp is \'nan\', using current ROS time instead.");
28 return timeNowAsSeconds();
30 else if (isFileCamera)
33 return timeNowAsSeconds();
36 return timestamp - NXLIB_TIMESTAMP_OFFSET;
42 return fixTimestamp(timestamp, isFileCamera);
51 geometry_msgs::msg::Point32
toRosPoint(NxLibItem
const& itemArray,
bool convertUnits)
53 geometry_msgs::msg::Point32 point;
62 point.x = itemArray[0].asDouble();
63 point.y = itemArray[1].asDouble();
64 point.z = itemArray[2].asDouble();
70 NxLibItem
toEnsensoPoint(geometry_msgs::msg::Point32
const& point,
bool convertUnits)
81 itemPoint[0] = point.x;
82 itemPoint[1] = point.y;
83 itemPoint[2] = point.z;