Mech-Eye API 2.5.1
API reference documentation for Mech-Eye 3D Laser Profiler
Loading...
Searching...
No Matches
MultiProfilerErrorStatus.h
Go to the documentation of this file.
1#pragma once
2#include <string>
3#include <unordered_map>
4namespace mmind {
5namespace eye {
7{
8public:
9 enum ErrorCode {
10 MMIND_STATUS_SUCCESS = 0, //< Success.
11
12 // error code for calibration
20
21 // error code for stitcher
41
42 // error code for checking validity
65
66 // error code for IO
68
69 // error code for load calib files
74 };
75
77
79 MultiProfilerErrorStatus(ErrorCode code, const std::string& message)
80 : errorCode(code), errorDescription(message)
81 {
82 }
83
84 bool isOK() const
85 {
88 }
89
91 {
92 this->errorCode = code;
93 this->errorDescription = errorInfoMap[code];
94 }
95
96 void setErrorCodeAndDescription(const ErrorCode& code, const std::string& paraName)
97 {
98 this->errorCode = code;
99 this->errorDescription = errorInfoMap[code] + paraName;
100 }
101
102 unsigned int groupID = 0;
105 std::string errorDescription = "Success";
106
107private:
108 // description for calibration
109 std::string emptyImageDescription =
110 "Failed to access the specified image. Please check the file path and ensure the file "
111 "exists.";
112 std::string planeSegmentationFailureDescription =
113 "The number of sampling points in the point cloud available for plane segmentation is too "
114 "few. Please check the input depth maps and ensure that they only contain the six feature "
115 "planes of the calibration target.";
116 std::string noneParallelPlanesDescription =
117 "Plane 1 and 2 were not found. Please check the input depth maps and ensure that they only "
118 "contain the six feature planes of the calibration target.";
119 std::string overmuchParallelPlanesDescription =
120 "More than two parallel surfaces were identified. Please ensure the depth map only "
121 "contains the six feature planes of the calibration target. If two laser profilers share a "
122 "common field of view, laser light interference may cause this error; in that case, "
123 "the 'Trigger Delay' parameter should be set for one laser profiler.";
124 std::string reorderPlanesFailureDescription =
125 "Failed to order the feature planes. Please ensure that each lateral face forms a 45° "
126 "angle with both the upper and lower bases, and that the depth map contains only the six "
127 "feature planes of the calibration target.";
128 std::string reprojectErrorHighDescription =
129 "The reprojection error is excessive. Please verify the input parameters: (1) The depth "
130 "maps should only contain the six feature planes of the calibration target; (2) Ensure the "
131 "resolutionX/Y in deviceInfo (algorithm parameter) matches the actual specifications, and "
132 "confirm the targetSize parameters correspond with practical usage; (3) Excessive noise in "
133 "captured data may exist - appropriately increasing downsampleX/Y (downsampling intervals "
134 "along X/Y axes) might alleviate this issue, with recommended values in [10, 40]; (4) "
135 "Contaminants like dust, scratches, or reflective areas on the calibration target could "
136 "interfere with accuracy; (5) Verify the calibration target meets required mechanical "
137 "machining precision; (6) Check whether the camera contour mode parameters align with "
138 "recommended values.";
139 std::string invalidROIDescription =
140 "The ROI (Region of Interest) of the real-time collected image should match the ROI of the "
141 "device information. Please check if the ROI in depthImageInfo and dualProfilerConfig is "
142 "consistent.";
143 // description for stitcher
144 std::string nonStandardResolutionDescription =
145 "In stitching, the user-input resolution in the X direction is an LNX non-standard "
146 "resolution. Please verify that the output matches expectations. This might occur because "
147 "the user rescaled the image before stitching. If errors or unexpected results arise "
148 "during stitching, first check whether the resolution input is correct.";
149 std::string cameraModelErrorDescription = "Please input the model of the laser profiler.";
150 std::string invalidBoundaryValueDescription =
151 "In stitching, the image boundary detection during the resampling step returned invalid "
152 "values. Please check the input parameters, especially whether the RT matrix is incorrect.";
153 std::string fusionPointExceedMemoryDescription =
154 "During stitching, the point cloud fusion process required more computing space than the "
155 "available capacity.";
156 std::string multiStitchCameraModelEmptyDescription =
157 "In stitching, the 'camera model' parameter list is empty.";
158 std::string multiStitchParamsEmptyDescription =
159 "In stitching, the 'stitching parameters' list is empty.";
160 std::string multiStitchParamsSizeInconsistencyDescription =
161 "In stitching, the length of the 'stitching parameters' list does not match the length of "
162 "the 'camera model' parameter list.";
163 std::string multiFusionParamsSizeInconsistencyDescription =
164 "The length of fusionFlag or fusionParam variable input during fusion does not match the "
165 "length of the minor camera image.";
166 std::string stitchParamsAreNotCheckedDescription =
167 "Before calling the stitching function, the parameter check function must be called first.";
168 std::string pointCloudsEmptyDescription = "The input point cloud data was empty.";
169 std::string depthImageTypeWrongDescription = "The input image type was not CV_32F or CV_32F1.";
170 std::string resolutionInconsistencyDescription =
171 "During stitching, the X-axis and Y-axis resolutions must be identical, and the "
172 "resolutions for both axes should be the same across the primary and secondary laser "
173 "profilers.";
174 std::string noImageAvailableDescription =
175 "The intensity image and depth map in the input data were unavailable.";
176 std::string depthAndIntensityImageSizeWrongDescription =
177 "During stitching, the dimensions of the depth map and intensity map from the same camera "
178 "do not match.";
179 std::string intensityImageTypeWrongDescription =
180 "The input intensity image type was not CV_8UC1.";
181 std::string biasesEmptyDescription = "In fusion, the 'image bias' parameter list is empty.";
182 std::string minorInfoSizeErrorDescription =
183 "In fusion, the lengths of the ‘image data’ list and the ‘image bias’ parameter list are "
184 "inconsistent.";
185 std::string imageExtractInfomationErrorDescription =
186 "In fusion, when extracting the fused image from the fused large image, the computed ROI "
187 "exceeds the original image size. The possible reason is incorrect image size or image "
188 "bias input into the function. This interface is not open to the public, so the risk of "
189 "this error occurring is minimal.";
190 std::string imageAndMaskSizeUnmatchedDescription =
191 "In fusion, the sizes of the valid point mask image and the original image do not match.";
192 // description for checking validity
193 std::string invalidParamDescription =
194 "The input parameters were empty or contain invalid values such as infinite or Nan.";
195 std::string invalidPositiveParamDescription =
196 "Input parameters should be positive finite values.";
197 std::string invalidImageConfigPairDescription =
198 "The lengths of minorImageInfos and multiProfilerConfig input parameters are inconsistent; "
199 "please check the relevant inputs.";
200 std::string invalidImageResultPairDescription =
201 "The lengths of minorImageInfos and multiProfilerResult input parameters are inconsistent; "
202 "please check the relevant inputs.";
203 std::string emptyMultiProfilerConfigDescription =
204 "The multiProfilerConfig input parameter is empty; please check the relevant inputs.";
205 std::string invalidRotateMatrixDescription = "The rotation matrix is not an orthogonal matrix.";
206 std::string invalidMoveDirVecDescription = "The motion direction vector is not a unit vector.";
207 std::string invalidMoveDirVecYDescription =
208 "The Y component of the motion direction vector should be a non-negative number.";
209 std::string invalidTopLengthDescription =
210 "The upper base length of the frustum should be smaller than the lower base length.";
211 std::string invalidRotateRadiusInAngleModeDescription =
212 "In the Angled mode, the value of rotateRadius should be greater than half of the frustum "
213 "height.";
214 std::string invalidRotateRadiusInWideModeDescription =
215 "In the Wide mode, the value of rotateRadius should be 0.";
216 std::string invalidRotateAngleInAngleModeDescription =
217 "In the Angled mode, when one frustum is rotated relative to another along the Y axis, the "
218 "included angle between frustum axes (rotateAngleInDegree) should be within [-180, 180]; "
219 "when one frustum is rotated relative to another along the X axis, the included angle "
220 "between frustum axes (rotateAngleInDegree) should be within (-90, 90).";
221 std::string invalidRotateAngleInWideModeDescription =
222 "In the Wide mode, the rotation angle between two frustums (rotateAngleInDegree) should be "
223 "0.";
224 std::string invalidTranslateDistanceInAngleModeDescription =
225 "In the Angled mode, the translate distance between two frustums (translateDistance) "
226 "should be 0.";
227 std::string invalidRotateAxisInAngleModeDescription =
228 "In the Angled mode, the axis along which one frustum is rotated relative to another "
229 "(targetRotateAxis) should not be NullAxis.";
230 std::string invalidRotateAxisInWideModeDescription =
231 "In the Wide mode, the axis along which one frustum is rotated relative to another "
232 "(targetRotateAxis) should be NullAxis.";
233 std::string invalidTranslateAxisInAngleModeDescription =
234 "In the Angled mode, the axis along which one frustum is translated relative to another "
235 "(targetTranslateAxis) should be NullAxis.";
236 std::string invalidTranslateAxisInWideModeDescription =
237 "In the Wide mode, the axis along which one frustum is translated relative to another "
238 "(targetTranslateAxis) should not be NullAxis.";
239 std::string invalidDownSampleDescription =
240 "The input downsampling parameters (downsampleX and downsampleY) should be integers within "
241 "the range [1, 40].";
242 std::string invalidDepthGroupIDDescription =
243 "The groupID of members in the xxx data structure should match the index of their "
244 "position.";
245 std::string invalidConfigGroupIDDescription =
246 "The groupID of each dualProfilerConfig in multiProfilerConfig should correspond to its "
247 "index in the vector (a data structure). For example, if there are three members in "
248 "multiProfilerConfig named dualProfilerConfig0 to dualProfilerConfig2, the groupID of "
249 "dualProfilerConfig0 should be 0, dualProfilerConfig1 should be 1, and dualProfilerConfig2 "
250 "should be 2.";
251 std::string invalidResultGroupIDDescription =
252 "The groupID of each dualProfilerResult in multiProfilerResults should correspond to its "
253 "index in the vector (a data structure). For example, if there are three members in "
254 "multiProfilerResults named dualProfilerResult0 to dualProfilerResult2, the groupID of "
255 "dualProfilerResult0 should be 0, dualProfilerResult1 should be 1, and dualProfilerResult2 "
256 "should be 2.";
257
258 std::unordered_map<ErrorCode, std::string> errorInfoMap = {
259 // for calibration
260 {MMIND_STATUS_EMPTY_DEPTH_IMAGE, emptyImageDescription},
261 {MMIND_STATUS_PLANE_SEGMENTATION_FAILURE, planeSegmentationFailureDescription},
262 {MMIND_STATUS_NONE_PARALLEL_PLANES, noneParallelPlanesDescription},
263 {MMIND_STATUS_OVERMUCH_PARALLEL_PLANES, overmuchParallelPlanesDescription},
264 {MMIND_STATUS_REORDER_PLANES_FAILURE, reorderPlanesFailureDescription},
265 {MMIND_STATUS_REPROJECT_ERROR_HIGH, reprojectErrorHighDescription},
266 {MMIND_STATUS_INVALID_ROI, invalidROIDescription},
267 // for stitcher
268 {MMIND_STATUS_NON_STANDARD_RESOLUTION, nonStandardResolutionDescription},
269 {MMIND_STATUS_CAMERA_MODEL_ERROR, cameraModelErrorDescription},
270 {MMIND_STATUS_INVALID_BOUNDARY_VALUE, invalidBoundaryValueDescription},
271 {MMIND_STATUS_FUSION_POINT_EXCEED_MEMORY, fusionPointExceedMemoryDescription},
272 {MMIND_STATUS_MULTI_STITCH_CAMERA_MODEL_EMPTY, multiStitchCameraModelEmptyDescription},
273 {MMIND_STATUS_MULTI_STITCH_PARAMS_EMPTY, multiStitchParamsEmptyDescription},
275 multiStitchParamsSizeInconsistencyDescription},
276 {MMIND_STATUS_PARAMS_ARE_NOT_CHECKED, stitchParamsAreNotCheckedDescription},
277 {MMIND_STATUS_POINT_CLOUDS_EMPTY, pointCloudsEmptyDescription},
278 {MMIND_STATUS_DEPTH_IMAGE_TYPE_WRONG, depthImageTypeWrongDescription},
279 {MMIND_STATUS_NO_IMAGE_AVAILABLE, noImageAvailableDescription},
281 depthAndIntensityImageSizeWrongDescription},
282 {MMIND_STATUS_INTENSITY_IMAGE_TYPE_WRONG, intensityImageTypeWrongDescription},
283 {MMIND_STATUS_MAJOR_AND_MINOR_RESOLUTION_INCONSISTENCY, resolutionInconsistencyDescription},
284 {MMIND_STATUS_EMPTY_BIASES_IN_FUSION, biasesEmptyDescription},
285 {MMIND_STATUS_MINOR_INFO_UNMATCHED_IN_FUSION, minorInfoSizeErrorDescription},
286 {MMIND_STATUS_EXTRACT_IMAGE_INFO_ERROR, imageExtractInfomationErrorDescription},
288 imageAndMaskSizeUnmatchedDescription},
290 multiFusionParamsSizeInconsistencyDescription},
291
292 // for checking validity
293 {MMIND_STATUS_INVALID_PARAM, invalidParamDescription},
294 {MMIND_STATUS_INVALID_POSITIVE_PARAM, invalidPositiveParamDescription},
295 {MMIND_STATUS_INVALID_IMAGE_CONFIG_PAIR, invalidImageConfigPairDescription},
296 {MMIND_STATUS_INVALID_IMAGE_RESULT_PAIR, invalidImageResultPairDescription},
297 {MMIND_STATUS_EMPTY_MULTISYSTEM_CONFIG, emptyMultiProfilerConfigDescription},
298 {MMIND_STATUS_INVALID_ROTATION_MATRIX, invalidRotateMatrixDescription},
299 {MMIND_STATUS_INVALID_MOVE_DIR_VECTOR, invalidMoveDirVecDescription},
300 {MMIND_STATUS_INVALID_MOVE_DIR_VECTOR_Y, invalidMoveDirVecYDescription},
301 {MMIND_STATUS_INVALID_TOP_LENGTH, invalidTopLengthDescription},
302 {MMIND_STATUS_INVALID_ROTATE_RADIUS_ANGLE_MODE, invalidRotateRadiusInAngleModeDescription},
303 {MMIND_STATUS_INVALID_ROTATE_RADIUS_WIDE_MODE, invalidRotateRadiusInWideModeDescription},
304 {MMIND_STATUS_INVALID_ROTATE_ANGLE_ANGLE_MODE, invalidRotateAngleInAngleModeDescription},
305 {MMIND_STATUS_INVALID_ROTATE_ANGLE_WIDE_MODE, invalidRotateAngleInWideModeDescription},
307 invalidTranslateDistanceInAngleModeDescription},
308 {MMIND_STATUS_INVALID_ROTATE_AXIS_ANGLE_MODE, invalidRotateAxisInAngleModeDescription},
309 {MMIND_STATUS_INVALID_ROTATE_AXIS_WIDE_MODE, invalidRotateAxisInWideModeDescription},
311 invalidTranslateAxisInAngleModeDescription},
312 {MMIND_STATUS_INVALID_TRANSLATE_AXIS_WIDE_MODE, invalidTranslateAxisInWideModeDescription},
313 {MMIND_STATUS_INVALID_DOWNSAMPLE, invalidDownSampleDescription},
314 {MMIND_STATUS_INVALID_DEPTH_GROUPID, invalidDepthGroupIDDescription},
315 {MMIND_STATUS_INVALID_CONFIG_GROUPID, invalidConfigGroupIDDescription},
316 {MMIND_STATUS_INVALID_RESULT_GROUPID, invalidResultGroupIDDescription},
317 };
318};
319} // namespace eye
320} // namespace mmind
Definition MultiProfilerErrorStatus.h:7
MultiProfilerErrorStatus(ErrorCode code, const std::string &message)
Definition MultiProfilerErrorStatus.h:79
void setErrorCodeAndDescription(const ErrorCode &code, const std::string &paraName)
Definition MultiProfilerErrorStatus.h:96
ErrorSource errorSource
Definition MultiProfilerErrorStatus.h:103
ErrorCode
Definition MultiProfilerErrorStatus.h:9
@ MMIND_STATUS_INVALID_IMAGE_RESULT_PAIR
Definition MultiProfilerErrorStatus.h:46
@ MMIND_STATUS_NO_IMAGE_AVAILABLE
Definition MultiProfilerErrorStatus.h:30
@ MMIND_STATUS_INVALID_TRANSLATE_AXIS_WIDE_MODE
Definition MultiProfilerErrorStatus.h:60
@ MMIND_STATUS_NONE_PARALLEL_PLANES
Definition MultiProfilerErrorStatus.h:15
@ MMIND_STATUS_INPUT_ERROR
Definition MultiProfilerErrorStatus.h:67
@ MMIND_STATUS_CONFIG_LOAD_FAILURE
Definition MultiProfilerErrorStatus.h:70
@ MMIND_STATUS_DEPTH_LOAD_FAILURE
Definition MultiProfilerErrorStatus.h:73
@ MMIND_STATUS_INVALID_DOWNSAMPLE
Definition MultiProfilerErrorStatus.h:61
@ MMIND_STATUS_INVALID_MOVE_DIR_VECTOR_Y
Definition MultiProfilerErrorStatus.h:50
@ MMIND_STATUS_PARAMS_ARE_NOT_CHECKED
Definition MultiProfilerErrorStatus.h:28
@ MMIND_STATUS_EXTRACT_IMAGE_INFO_ERROR
Definition MultiProfilerErrorStatus.h:38
@ MMIND_STATUS_INVALID_ROTATE_ANGLE_WIDE_MODE
Definition MultiProfilerErrorStatus.h:55
@ MMIND_STATUS_DEPTH_INTENSITY_IMAGE_SIZE_UNMATCHED
Definition MultiProfilerErrorStatus.h:31
@ MMIND_STATUS_MAJOR_AND_MINOR_RESOLUTION_INCONSISTENCY
Definition MultiProfilerErrorStatus.h:34
@ MMIND_STATUS_EMPTY_DEPTH_IMAGE
Definition MultiProfilerErrorStatus.h:13
@ MMIND_STATUS_NON_STANDARD_RESOLUTION
Definition MultiProfilerErrorStatus.h:22
@ MMIND_STATUS_RESULT_LOAD_FAILURE
Definition MultiProfilerErrorStatus.h:71
@ MMIND_STATUS_MULTI_STITCH_PARAMS_SIZE_INCONSISTENCY
Definition MultiProfilerErrorStatus.h:35
@ MMIND_STATUS_INVALID_TRANSLATE_DISTANCE_ANGLE_MODE
Definition MultiProfilerErrorStatus.h:56
@ MMIND_STATUS_INVALID_MOVE_DIR_VECTOR
Definition MultiProfilerErrorStatus.h:49
@ MMIND_STATUS_MULTI_STITCH_CAMERA_MODEL_EMPTY
Definition MultiProfilerErrorStatus.h:26
@ MMIND_STATUS_INVALID_ROTATE_RADIUS_ANGLE_MODE
Definition MultiProfilerErrorStatus.h:52
@ MMIND_STATUS_INVALID_ROTATE_RADIUS_WIDE_MODE
Definition MultiProfilerErrorStatus.h:53
@ MMIND_STATUS_INVALID_ROTATE_ANGLE_ANGLE_MODE
Definition MultiProfilerErrorStatus.h:54
@ MMIND_STATUS_INVALID_ROTATE_AXIS_WIDE_MODE
Definition MultiProfilerErrorStatus.h:58
@ MMIND_STATUS_INVALID_ROI
Definition MultiProfilerErrorStatus.h:19
@ MMIND_STATUS_EMPTY_MULTISYSTEM_CONFIG
Definition MultiProfilerErrorStatus.h:47
@ MMIND_STATUS_REORDER_PLANES_FAILURE
Definition MultiProfilerErrorStatus.h:17
@ MMIND_STATUS_FUSION_POINT_EXCEED_MEMORY
Definition MultiProfilerErrorStatus.h:25
@ MMIND_STATUS_CAMERA_MODEL_ERROR
Definition MultiProfilerErrorStatus.h:23
@ MMIND_STATUS_INVALID_IMAGE_CONFIG_PAIR
Definition MultiProfilerErrorStatus.h:45
@ MMIND_STATUS_POINT_CLOUDS_EMPTY
Definition MultiProfilerErrorStatus.h:29
@ MMIND_STATUS_MULTI_FUSION_PARAMS_SIZE_INCONSISTENCY
Definition MultiProfilerErrorStatus.h:36
@ MMIND_STATUS_REPROJECT_ERROR_HIGH
Definition MultiProfilerErrorStatus.h:18
@ MMIND_STATUS_EMPTY_BIASES_IN_FUSION
Definition MultiProfilerErrorStatus.h:39
@ MMIND_STATUS_INVALID_ROTATION_MATRIX
Definition MultiProfilerErrorStatus.h:48
@ MMIND_STATUS_MINOR_INFO_UNMATCHED_IN_FUSION
Definition MultiProfilerErrorStatus.h:37
@ MMIND_STATUS_PLANE_SEGMENTATION_FAILURE
Definition MultiProfilerErrorStatus.h:14
@ MMIND_STATUS_DEPTH_IMAGE_TYPE_WRONG
Definition MultiProfilerErrorStatus.h:32
@ MMIND_STATUS_IMAGE_AND_MASK_SIZE_UNMATCHED_IN_FUSION
Definition MultiProfilerErrorStatus.h:40
@ MMIND_STATUS_INVALID_TRANSLATE_AXIS_ANGLE_MODE
Definition MultiProfilerErrorStatus.h:59
@ MMIND_STATUS_EVALS_LOAD_FAILURE
Definition MultiProfilerErrorStatus.h:72
@ MMIND_STATUS_MULTI_STITCH_PARAMS_EMPTY
Definition MultiProfilerErrorStatus.h:27
@ MMIND_STATUS_INVALID_POSITIVE_PARAM
Definition MultiProfilerErrorStatus.h:44
@ MMIND_STATUS_OVERMUCH_PARALLEL_PLANES
Definition MultiProfilerErrorStatus.h:16
@ MMIND_STATUS_INVALID_PARAM
Definition MultiProfilerErrorStatus.h:43
@ MMIND_STATUS_SUCCESS
Definition MultiProfilerErrorStatus.h:10
@ MMIND_STATUS_INVALID_BOUNDARY_VALUE
Definition MultiProfilerErrorStatus.h:24
@ MMIND_STATUS_INVALID_ROTATE_AXIS_ANGLE_MODE
Definition MultiProfilerErrorStatus.h:57
@ MMIND_STATUS_INVALID_RESULT_GROUPID
Definition MultiProfilerErrorStatus.h:64
@ MMIND_STATUS_INTENSITY_IMAGE_TYPE_WRONG
Definition MultiProfilerErrorStatus.h:33
@ MMIND_STATUS_INVALID_DEPTH_GROUPID
Definition MultiProfilerErrorStatus.h:62
@ MMIND_STATUS_INVALID_CONFIG_GROUPID
Definition MultiProfilerErrorStatus.h:63
@ MMIND_STATUS_INVALID_TOP_LENGTH
Definition MultiProfilerErrorStatus.h:51
std::string errorDescription
Definition MultiProfilerErrorStatus.h:105
ErrorCode errorCode
Definition MultiProfilerErrorStatus.h:104
ErrorSource
Definition MultiProfilerErrorStatus.h:76
@ MinorDevice
Definition MultiProfilerErrorStatus.h:76
@ System
Definition MultiProfilerErrorStatus.h:76
@ MajorDevice
Definition MultiProfilerErrorStatus.h:76
unsigned int groupID
Definition MultiProfilerErrorStatus.h:102
bool isOK() const
Definition MultiProfilerErrorStatus.h:84
void setErrorCodeAndDescription(const ErrorCode &code)
Definition MultiProfilerErrorStatus.h:90
Definition Array2D.h:8