42#include "ErrorStatus.h"
43#include "CommonTypes.h"
44#include "profiler/parameters/ScanParameters.h"
46#include "ProfilerInfo.h"
53 std::cout <<
"........................................." << std::endl;
54 std::cout <<
"Model: " << profilerInfo.
model << std::endl;
56 const auto consoleCP = GetConsoleOutputCP();
57 SetConsoleOutputCP(CP_UTF8);
59 std::cout <<
"Device name: " << profilerInfo.
deviceName << std::endl;
61 SetConsoleOutputCP(consoleCP);
63 std::cout <<
"Controller serial number: " << profilerInfo.
controllerSN << std::endl;
64 std::cout <<
"Sensor head serial number: " << profilerInfo.
sensorSN << std::endl;
65 std::cout <<
"IP address: " << profilerInfo.
ipAddress << std::endl;
66 std::cout <<
"Subnet mask: " << profilerInfo.
subnetMask << std::endl;
67 std::cout <<
"IP address assignment method: "
70 std::cout <<
"Hardware version: "
72 std::cout <<
"Firmware version: "
74 std::cout <<
"Support status: "
75 << (profilerInfo.
supported ?
"Supported" :
"Unsupported") << std::endl;
77 std::cout <<
"Last supported version: "
80 std::cout <<
"........................................." << std::endl;
81 std::cout << std::endl;
86 std::cout <<
".....Profiler temperatures....." << std::endl;
87 std::cout << std::fixed << std::setprecision(1);
92 std::cout <<
"..............................." << std::endl;
93 std::cout << std::defaultfloat << std::setprecision(6);
94 std::cout << std::endl;
103 std::cout <<
"Looking for available profilers..." << std::endl;
104 std::vector<mmind::eye::ProfilerInfo> profilerInfoList =
107 if (profilerInfoList.empty()) {
108 std::cout <<
"No profilers are available." << std::endl;
112 for (
size_t i = 0; i < profilerInfoList.size(); i++) {
113 std::cout <<
"Mech-Eye device index: " << i << std::endl;
114 printProfilerInfo(profilerInfoList[i]);
117 std::cout <<
"Enter the index of the device to which you want to connect: ";
118 unsigned inputIndex = 0;
123 if (std::regex_match(str.begin(), str.end(), std::regex{
"[0-9]+"}) &&
124 atoi(str.c_str()) <
static_cast<int>(profilerInfoList.size())) {
125 inputIndex = atoi(str.c_str());
128 std::cout <<
"The entered index is invalid. Please enter the device index again: ";
132 status = profiler.
connect(profilerInfoList[inputIndex]);
134 if (!status.
isOK()) {
139 std::cout <<
"Successfully connected to the profiler." << std::endl;
143inline std::vector<mmind::eye::Profiler> findAndConnectMultiProfiler()
145 std::cout <<
"Looking for available profilers..." << std::endl;
146 std::vector<mmind::eye::ProfilerInfo> profilerInfoList =
149 if (profilerInfoList.empty()) {
150 std::cout <<
"No profilers are available." << std::endl;
154 for (
size_t i = 0; i < profilerInfoList.size(); i++) {
155 std::cout <<
"Mech-Eye device index: " << i << std::endl;
156 printProfilerInfo(profilerInfoList[i]);
160 std::set<unsigned> indices;
163 std::cout <<
"Enter the indices of the devices to which you want to connect: " << std::endl;
164 std::cout <<
"Enter the character \"c\" at the end of all the indices" << std::endl;
169 if (std::regex_match(str.begin(), str.end(), std::regex{
"[0-9]+"}) &&
170 atoi(str.c_str()) <
static_cast<int>(profilerInfoList.size()))
171 indices.insert(atoi(str.c_str()));
173 std::cout <<
"The entered indices are invalid. Please enter the device indices again: ";
176 std::vector<mmind::eye::Profiler> profilerList{};
178 for (
const auto index : indices) {
180 const auto status = profiler.
connect(profilerInfoList[index]);
182 profilerList.push_back(profiler);
190inline bool confirmCapture()
193 <<
"Do you want the profiler to capture image? Enter \"y\" to confirm or \"n\" to cancel: "
196 std::string confirmStr;
197 std::cin >> confirmStr;
198 if (confirmStr ==
"y") {
200 }
else if (confirmStr ==
"n") {
201 std::cout <<
"The capture command was canceled." << std::endl;
204 std::cout <<
"The entered character was invalid. Please enter \"y\" ot confirm or "
213 bool saveCSV =
true,
bool isOrganized =
false)
219 double xResolution{};
220 auto status = userSet.
getFloatValue(mmind::eye::point_cloud_resolutions::XAxisResolution::name,
222 if (!status.
isOK()) {
228 double yResolution{};
230 userSet.
getFloatValue(mmind::eye::point_cloud_resolutions::YResolution::name, yResolution);
231 if (!status.
isOK()) {
253 int lineScanTriggerSource{};
254 status = userSet.
getEnumValue(mmind::eye::trigger_settings::LineScanTriggerSource::name,
255 lineScanTriggerSource);
256 if (!status.
isOK()) {
261 bool useEncoderValues =
262 lineScanTriggerSource ==
263 static_cast<int>(mmind::eye::trigger_settings::LineScanTriggerSource::Value::Encoder);
265 int triggerInterval{};
266 status = userSet.
getIntValue(mmind::eye::trigger_settings::EncoderTriggerInterval::name,
268 if (!status.
isOK()) {
273 std::cout <<
"Save the point cloud." << std::endl;
276 xResolution, yResolution, useEncoderValues, triggerInterval,
277 mmind::eye::FileFormat::CSV,
"PointCloud.csv", mmind::eye::CoordinateUnit::Millimeter,
281 xResolution, yResolution, useEncoderValues, triggerInterval,
282 mmind::eye::FileFormat::PLY,
"PointCloud.ply", mmind::eye::CoordinateUnit::Millimeter,
293 double xResolution{};
294 auto status = userSet.
getFloatValue(mmind::eye::point_cloud_resolutions::XAxisResolution::name,
296 if (!status.
isOK()) {
302 double yResolution{};
304 userSet.
getFloatValue(mmind::eye::point_cloud_resolutions::YResolution::name, yResolution);
305 if (!status.
isOK()) {
327 int lineScanTriggerSource{};
328 status = userSet.
getEnumValue(mmind::eye::trigger_settings::LineScanTriggerSource::name,
329 lineScanTriggerSource);
330 if (!status.
isOK()) {
335 bool useEncoderValues =
336 lineScanTriggerSource ==
337 static_cast<int>(mmind::eye::trigger_settings::LineScanTriggerSource::Value::Encoder);
339 int triggerInterval{};
340 status = userSet.
getIntValue(mmind::eye::trigger_settings::EncoderTriggerInterval::name,
342 if (!status.
isOK()) {
348 triggerInterval, mmind::eye::CoordinateUnit::Millimeter);
358 double xResolution{};
359 auto status = userSet.
getFloatValue(mmind::eye::point_cloud_resolutions::XAxisResolution::name,
361 if (!status.
isOK()) {
367 double yResolution{};
369 userSet.
getFloatValue(mmind::eye::point_cloud_resolutions::YResolution::name, yResolution);
370 if (!status.
isOK()) {
392 int lineScanTriggerSource{};
393 status = userSet.
getEnumValue(mmind::eye::trigger_settings::LineScanTriggerSource::name,
394 lineScanTriggerSource);
395 if (!status.
isOK()) {
400 bool useEncoderValues =
401 lineScanTriggerSource ==
402 static_cast<int>(mmind::eye::trigger_settings::LineScanTriggerSource::Value::Encoder);
404 int triggerInterval{};
405 status = userSet.
getIntValue(mmind::eye::trigger_settings::EncoderTriggerInterval::name,
407 if (!status.
isOK()) {
413 mmind::eye::CoordinateUnit::Millimeter);
Represents the data struct of the profile data.
Represents a batch of profiles, which can be obtained by calling Profiler::retrieveBatchData()....
bool isEmpty() const
Checks if the ProfileBatch object has no elements.
TexturedPointCloud getTexturedPointCloud(double xResolution, double yResolution, bool useEncoderValues, int triggerInterval, CoordinateUnit coordinateUnit=CoordinateUnit::Millimeter) const
Gets the textured point cloud data in the batch. Each point in TexturedPointCloud contains the X,...
UntexturedPointCloud getUntexturedPointCloud(double xResolution, double yResolution, bool useEncoderValues, int triggerInterval, CoordinateUnit coordinateUnit=CoordinateUnit::Millimeter) const
Gets the untextured point cloud data in the batch. Each point in UntexturedPointCloud contains the X,...
ErrorStatus saveUntexturedPointCloud(double xResolution, double yResolution, bool useEncoderValues, int triggerInterval, FileFormat fileFormat, const std::string &fileName, CoordinateUnit coordinateUnit=CoordinateUnit::Millimeter, bool isOrganized=false) const
Saves the untextured point cloud data in the batch. Each point in UntexturedPointCloud contains the X...
Operates the laser profiler. Use Profiler::connect to connect an available laser profiler,...
ErrorStatus connect(const ProfilerInfo &info, unsigned int timeoutMs=5000)
Connects to a laser profiler via ProfilerInfo.
static std::vector< ProfilerInfo > discoverProfilers(unsigned int timeoutMs=5000)
Discovers all available laser profilers and returns the list of information of all available laser pr...
ErrorStatus getIntValue(const std::string ¶meterName, int &value) const
Gets the current value of an _Int-type device parameter. See Parameter for details.
ErrorStatus getFloatValue(const std::string ¶meterName, double &value) const
Gets the current value of a _Float-type device parameter. See Parameter for details.
ErrorStatus getEnumValue(const std::string ¶meterName, int &value) const
Gets the current value of an _Enum-type device parameter in the form of the integer value....
std::string toString() const
Converts a Version object to a string.
bool isEmpty() const
Checks if a Version object is empty.
Describes the types of errors.
bool isOK() const
Returns true if the operation succeeded.
Describes the laser profiler information.
Version hardwareVersion
The version of the hardware. The hardware cannot be upgraded.
Version firmwareVersion
The version of the firmware. The firmware can be upgraded.
std::string subnetMask
The IP subnet mask of the laser profiler.
Version lastSupportedVersion
The last supported version of the device.
IpAssignmentMethod ipAssignmentMethod
The IP address assignment method of the laser profiler.
std::string model
The laser profiler model.
bool supported
The support status of the device.
std::string controllerSN
The controller serial number.
std::string deviceName
The device name (UTF-8 encoded).
std::string sensorSN
The sensor serial number.
std::string ipAddress
The IP address of the laser profiler.
Describes the laser profiler's statuses.
float controllerCpuTemperature
The temperature (in °C) of the controller CPU.
float sensorCpuTemperature
The temperature (in °C) of the FPGA.