37#include "MechEyeApi.h"
38#include "MechEyeLNXApi.h"
44 std::cout <<
"Error Code : " << status.
errorCode
50 std::cout <<
"............................" << std::endl;
51 std::cout <<
"Camera Model Name: " << deviceInfo.
model << std::endl;
52 std::cout <<
"Camera ID: " << deviceInfo.
id << std::endl;
53 std::cout <<
"Camera IP Address: " << deviceInfo.
ipAddress << std::endl;
54 std::cout <<
"Hardware Version: "
56 std::cout <<
"Firmware Version: "
58 std::cout <<
"............................" << std::endl;
59 std::cout << std::endl;
64 std::cout <<
".....Device Temperature....." << std::endl;
65 std::cout <<
"CPU : " << deviceTemperature.
cpuTemperature <<
"°C" << std::endl;
68 std::cout <<
"............................" << std::endl;
70 std::cout << std::endl;
73inline bool isNumber(
const std::string& str)
76 if (it <
'0' || it >
'9')
84 std::cout <<
"Color Map size : (width : " << deviceResolution.
colorMapWidth
85 <<
", height : " << deviceResolution.
colorMapHeight <<
")." << std::endl;
86 std::cout <<
"Depth Map size : (width : " << deviceResolution.
depthMapWidth
87 <<
", height : " << deviceResolution.
depthMapHeight <<
")." << std::endl;
90inline void printCameraMatrix(
const std::string& title,
const double* cameraMatrix)
92 std::cout << title <<
": " << std::endl
93 <<
" [" << cameraMatrix[0] <<
", " << 0 <<
", " << cameraMatrix[2] <<
"]"
96 <<
" [" << 0 <<
", " << cameraMatrix[1] <<
", " << cameraMatrix[3] <<
"]"
99 <<
" [" << 0 <<
", " << 0 <<
", " << 1 <<
"]" << std::endl;
100 std::cout << std::endl;
103inline void printCameraDistCoeffs(
const std::string& title,
const double* distCoeffs)
105 std::cout << title <<
": " << std::endl
106 <<
" k1: " << distCoeffs[0] <<
", k2: " << distCoeffs[1]
107 <<
", p1: " << distCoeffs[2] <<
", p2: " << distCoeffs[3] <<
", k3: " << distCoeffs[4]
109 std::cout << std::endl;
112inline void printTransform(
const std::string& title,
const mmind::api::Pose& pose)
114 std::cout <<
"Rotation: " << title <<
": " << std::endl;
115 for (
int i = 0; i < 3; i++) {
117 for (
int j = 0; j < 3; j++) {
122 std::cout <<
"]" << std::endl;
124 std::cout << std::endl;
125 std::cout <<
"Translation " << title <<
": " << std::endl;
127 <<
"mm, Z: " << pose.
translation[2] <<
"mm" << std::endl;
128 std::cout << std::endl;
133 printCameraMatrix(
"Texture Camera Matrix", deviceIntri.textureCameraIntri.
cameraMatrix);
134 printCameraDistCoeffs(
"Texture Camera Distortion Coefficients",
138 printCameraDistCoeffs(
"Depth Camera Distortion Coefficients",
141 printTransform(
"from Depth Camera to Texture Camera", deviceIntri.
depthToTexture);
146 std::cout <<
"Find Mech-Eye Industrial 3D Cameras..." << std::endl;
147 std::vector<mmind::api::MechEyeDeviceInfo> deviceInfoList =
150 if (deviceInfoList.empty()) {
151 std::cout <<
"No Mech-Eye Industrial 3D Cameras found." << std::endl;
155 for (
int i = 0; i < deviceInfoList.size(); i++) {
156 std::cout <<
"Mech-Eye device index : " << i << std::endl;
157 printDeviceInfo(deviceInfoList[i]);
160 std::cout <<
"Please enter the device index you want to connect: ";
161 unsigned inputIndex = 0;
166 if (isNumber(str) && atoi(str.c_str()) < deviceInfoList.size()) {
167 inputIndex = atoi(str.c_str());
170 std::cout <<
"Input invalid! Please enter the device index you want to connect: ";
174 status = device.
connect(deviceInfoList[inputIndex]);
176 if (!status.isOK()) {
181 std::cout <<
"Connect Mech-Eye Industrial 3D Camera Successfully." << std::endl;
187 std::cout <<
"Find Mech-Eye device..." << std::endl;
188 std::vector<mmind::api::MechEyeDeviceInfo> deviceInfoList =
191 std::vector<mmind::api::MechEyeDeviceInfo> lnxInfos;
193 for (
const auto& info : deviceInfoList) {
194 if (info.model ==
"Mech-Eye LNX 8030")
195 lnxInfos.emplace_back(info);
198 if (lnxInfos.empty()) {
199 std::cout <<
"No Mech-Eye device found." << std::endl;
203 for (
int i = 0; i < lnxInfos.size(); i++) {
204 std::cout <<
"Mech-Eye LNX device index : " << i << std::endl;
205 printDeviceInfo(lnxInfos[i]);
208 std::cout <<
"Please enter the device index you want to connect: ";
209 unsigned inputIndex = 0;
214 if (isNumber(str) && atoi(str.c_str()) < lnxInfos.size()) {
215 inputIndex = atoi(str.c_str());
218 std::cout <<
"Input invalid! Please enter the device index you want to connect: ";
222 status = device.
connect(lnxInfos[inputIndex]);
224 if (!status.isOK()) {
229 std::cout <<
"Connect Mech-Eye Successfully." << std::endl;
233inline std::pair<mmind::api::MechEyeDevice*, int> findAndConnectMulti()
235 std::cout <<
"Find Mech-Eye Industrial 3D Cameras..." << std::endl;
236 std::vector<mmind::api::MechEyeDeviceInfo> deviceInfoList =
239 if (deviceInfoList.empty()) {
240 std::cout <<
"No Mech-Eye Industrial 3D Cameras found." << std::endl;
241 return std::make_pair(
nullptr, 0);
244 for (
int i = 0; i < deviceInfoList.size(); i++) {
245 std::cout <<
"Mech-Eye device index : " << i << std::endl;
246 printDeviceInfo(deviceInfoList[i]);
250 std::set<unsigned> indices;
253 std::cout <<
"Please enter the device index you want to connect: " << std::endl;
254 std::cout <<
"Enter a c to terminate adding devices" << std::endl;
259 if (isNumber(str) && atoi(str.c_str()) < deviceInfoList.size())
260 indices.emplace(atoi(str.c_str()));
262 std::cout <<
"Input invalid! Please enter the device index you want to connect: ";
267 auto it = indices.begin();
268 for (
int i = 0; i < indices.size() && it != indices.end(); ++i, ++it) {
269 showError(devices[i].connect(deviceInfoList[*it]));
272 return std::make_pair(devices,
static_cast<int>(indices.size()));
Interface that is used to connect the Mech-Eye Industrial 3D Camera and access basic information of t...
static std::vector< MechEyeDeviceInfo > enumerateMechEyeDeviceList()
Enumerates Mech-Eye Industrial 3D Camera by the type of MechEyeDeviceInfo identifying the device.
ErrorStatus connect(const MechEyeDeviceInfo &info, int timeout=10000)
Connects to the device by the MechEyeDeviceInfo identifying a device.
Interface that is used to connect the LNX Mech-Eye device and access basic information of the device.
ErrorStatus connect(const MechEyeDeviceInfo &info, const int timeout=10000)
Connect to the device by the MechEyeDeviceInfo identifying a device.
static std::vector< api::MechEyeDeviceInfo > enumerateMechEyeDeviceList()
Enumerate Mech-Eye devices by the MechEyeDeviceInfo identifying the device.
double cameraMatrix[4]
Camera matrix, which arrange in [fx, fy, cx, cy].
This struct defines device intrinsic parameters, including texture camera and depth camera.
CameraIntri depthCameraIntri
The intrinsic parameters of the camera for capturing color map.
Pose depthToTexture
The intrinsic parameters of the camera for capturing depth map.
This struct defines camera map resolution.
unsigned colorMapHeight
The height of the color map.
unsigned depthMapWidth
The width of the depth map.
unsigned colorMapWidth
The width of the color map.
unsigned depthMapHeight
The height of the depth map.
This struct describes the device temperature information.
float projectorModuleTemperature
projector module temperature in degrees Celsius.
float cpuTemperature
CPU temperature in the device motherboard in degrees Celsius.
This enumeration defines the types of errors.
std::string errorDescription
This struct defines device information.
std::string ipAddress
IP address of the device.
std::string model
Device model name, such as Mech-Eye Nano.
std::string firmwareVersion
The version of the firmware which can be upgraded.
std::string hardwareVersion
The version of the hardware which is pre-determined from the factory.
This struct defines rigid body transformations, including rotation matrix and translation vector.
double rotation[3][3]
3*3 rotation matrix.
double translation[3]
3*1 translation vector in [x(mm), y(mm), z(mm)].