20 nxLibInitialize(
true);
22 catch (NxLibException& e)
24 NODELET_ERROR(
"Error while initializing the NxLib. Shutting down.");
29 if (nhLocal.
getParam(
"threads", threads))
31 NxLibItem()[itmParameters][itmThreads] = threads;
34 std::string serial, fileCameraPath, cameraFrame, targetFrame, robotFrame, wristFrame;
37 if (!nhLocal.
getParam(
"serial", serial))
42 if (nhLocal.
getParam(
"serial", intSerial))
44 serial = std::to_string(intSerial);
50 NxLibItem cameras = NxLibItem()[itmCameras][itmBySerialNo];
51 if (cameras.count() > 0)
53 serial = cameras[0].name();
63 nhLocal.
param<std::string>(
"file_camera_path", fileCameraPath,
"");
64 nhLocal.
param(
"fixed", cameraIsFixed,
false);
66 if (!nhLocal.
getParam(
"camera_frame", cameraFrame))
68 cameraFrame =
"ensenso_optical_frame";
70 if (!nhLocal.
getParam(
"target_frame", targetFrame))
72 targetFrame = cameraFrame;
75 nhLocal.
param<std::string>(
"robot_frame", robotFrame,
"");
76 nhLocal.
param<std::string>(
"wrist_frame", wristFrame,
"");
77 if (cameraIsFixed && robotFrame.empty())
79 robotFrame = cameraFrame;
81 if (!cameraIsFixed && wristFrame.empty())
83 wristFrame = cameraFrame;
87 camera = make_unique<Camera>(nh, serial, fileCameraPath, cameraIsFixed, cameraFrame, targetFrame, robotFrame,
96 std::string settingsFile;
97 if (nhLocal.
getParam(
"settings", settingsFile))
100 if (!camera->loadSettings(settingsFile,
true))
102 NODELET_ERROR(
"Failed to load the camera settings. Shutting down.");
108 camera->startServers();
#define NODELET_ERROR(...)
PLUGINLIB_EXPORT_CLASS(BAGReader, nodelet::Nodelet)
ros::NodeHandle & getPrivateNodeHandle() const
bool param(const std::string ¶m_name, T ¶m_val, const T &default_val) const
ros::NodeHandle & getNodeHandle() const
std::unique_ptr< Camera > camera
bool getParam(const std::string &key, std::string &s) const
#define NODELET_DEBUG(...)