17 ENSENSO_ERROR(nh,
"%s. Shutting down node.", errorMsg.c_str());
29 catch (NxLibException& e)
31 abortInit(nh,
"Error while initializing the NxLib");
37 ENSENSO_DEBUG(nh,
"Opening TCP port %d on the NxLib...", tcpPort);
42 nxLibOpenTcpPort(tcpPort, &openedPort);
43 ENSENSO_INFO(nh,
"Opened TCP port %d on the NxLib.", openedPort);
45 catch (NxLibException& e)
47 abortInit(nh,
"Error while opening TCP port (NxLib error message: " + e.getErrorText() +
")");
54 NxLibItem()[itmParameters][itmThreads] = threads;
66 std::size_t pos = serial.find(
"!");
67 if (pos != std::string::npos)
81 serial = std::to_string(intSerial);
84 NxLibItem cameraNode = NxLibItem()[itmCameras][itmBySerialNo][serial];
85 if (!serial.empty() && !cameraNode.exists())
88 "If the camera serial only consists of digits, its numerical value might be too large to be "
89 "interpreted as a 32-bit integer. Append an \"!\" to the serial so that it can be interpreted as a "
90 "string, e.g. _serial:=1234567890!. If you are using a launch file, just define the parameter's type "
91 "as string, e.g. type=\"string\".");
92 abortInit(nh,
"Could not find camera with serial " + serial);
103 bool foundAppropriateCamera =
false;
106 NxLibItem cameras = NxLibItem()[itmCameras];
107 for (
int i = 0; i < cameras.count(); i++)
109 NxLibItem camera = cameras[i];
110 NxLibItem cameraType = camera[itmType];
111 if (camera[itmStatus][itmAvailable].
exists() && camera[itmStatus][itmAvailable].asBool() && cameraType.exists() &&
112 cameraType.asString() == cameraNodeType)
114 foundAppropriateCamera =
true;
115 serial = camera.name();
120 if (!foundAppropriateCamera)
122 abortInit(nh,
"Could not find any camera");
143 std::string settingsFile;
149 abortInit(nh,
"Failed to load the camera settings");
154 template <
typename CameraType>
163 auto camera = ensenso::std::make_unique<CameraType>(nhw.
getNodeHandle(), std::move(params));
177 std::string
const& nodeType);
179 std::string
const& nodeType);