Motion Master
Loading...
Searching...
No Matches
motion_master_error.h
Go to the documentation of this file.
1#pragma once
2
3#include <map>
4#include <stdexcept>
5
6class MotionMasterError : public std::runtime_error {
7 public:
8 enum class Error : unsigned int {
9 kNone = 0,
99 kFileWriteFailed, // 90
109 kClientNotInControl, // 100
119 kFaultResetTimeout, // 110
168 kUnknown = 9999
169 };
170
172
173 explicit MotionMasterError(Error error) noexcept;
174
175 explicit MotionMasterError(Error error, const std::string& message) noexcept;
176
177 explicit operator bool() const;
178
179 bool operator==(const MotionMasterError& other) const;
180
181 Error get_error() const;
182
183 private:
184 inline static const std::map<MotionMasterError::Error, std::string>
185 error_to_message_map_ = {
186 {Error::kNone, "No error"},
187 {Error::kInvalidRequest, "Invalid request!"},
188 {Error::kSmCannotGetState,
189 "Cannot get the current state (state machine)!"},
190 {Error::kSmCannotGetOpMode,
191 "Cannot get the current OP mode (state machine)!"},
192 {Error::kSmCannotSetOpMode,
193 "Cannot set the OP mode (state machine)!"},
194 {Error::kSmCannotSetState, "Cannot set the state (state machine)!"},
195 {Error::kSmCannotSetStateOpMode,
196 "Cannot set both the state and the OP mode (state machine)!"},
197 {Error::kSmCannotSetStateStoSbc,
198 "Cannot set the state (state machine) - STO/SBC active!"},
199 {Error::kSmFaultState, "Drive in fault state (state machine)!"},
200 {Error::kSmAborted, "State transition aborted (state machine)!"},
201 {Error::kOffsetDetectionInitFailed,
202 "Offset detection initialization failed!"},
203 {Error::kOffsetDetectionNoCommutationEncoder,
204 "Offset detection requires a commutation encoder to be defined!"},
205 {Error::kOffsetDetectionTimeout,
206 "Offset detection failed (timeout)!"},
207 {Error::kOffsetDetectionFailed, "Offset detection failed!"},
208 {Error::kOffsetDetectionAborted, "Offset detection aborted!"},
209 {Error::kSystemIdentificationFailed,
210 "Failed to extract a stable model of the plant from the data. "
211 "Please restart the procedure."},
212 {Error::kSystemIdentificationAborted,
213 "System identification aborted!"},
214 {Error::kSystemIdentificationZeroTorqueAmplitude,
215 "Recorded torque amplitude is close to zero. Please check if "
216 "torque control mode operates normally or increase torque "
217 "amplitude slider."},
218 {Error::kSystemIdentificationZeroVelocityAmplitude,
219 "Recorded velocity amplitude is close to zero. Please check if "
220 "position and velocity data is available. If so, increase torque "
221 "amplitude or reduce frequency range."},
222 {Error::kSystemIdentificationWrongEncoderPolarity,
223 "Applied torque and resulting acceleration have different signs. "
224 "Please check encoder polarity."},
225 {Error::kSystemIdentificationWrongPositionVelocityPolarity,
226 "Polarity of position and velocity encoders do not match. Check "
227 "position encoder polarity."},
228 {Error::kSystemIdentificationSmallMotionAmplitude,
229 "Low frequency motion amplitude is too small to effectively "
230 "extract a plant model. Please increase applied torque or reduce "
231 "frequency range."},
232 {Error::kSystemIdentificationInsufficientVelocityResolution,
233 "The current velocity resolution isn't sufficient for precise "
234 "system identification. Please increase velocity resolution by "
235 "using the object 0x60A9 SI unit velocity."},
236 {Error::kSystemIdentificationBadDataQuality,
237 "The quality of the recorded system identification data is not "
238 "good enough to extract a stable plant model!"},
239 {Error::kAutoTuningPositionFailed,
240 "A stable process model cannot be extracted from the data. "
241 "Automatic position tuning failed!"},
242 {Error::kAutoTuningPositionAborted, "Automatic tuning aborted!"},
243 {Error::kAutoTuningNoPositionControlEncoder,
244 "The position control encoder cannot be detected! Auto-tuning "
245 "cannot be done!"},
246 {Error::kAutoTuningCannotAchieveSettlingTime,
247 "Failed to achieve requested settling time. The system likely "
248 "reached marginal stability. Consider increasing the settling "
249 "time and the damping ratio."},
250 {Error::kAutoTuningVelocityFailed,
251 "Automatic velocity tuning failed!"},
252 {Error::kAutoTuningVelocityAborted,
253 "Automatic velocity tuning aborted!"},
254 {Error::kAutoTuningPlantModelInvalid,
255 "The plant model loaded from the flash memory is corrupted or "
256 "invalid! Automatic tuning cannot be done! Please rerun system "
257 "identification."},
258 {Error::kAutoTuningPlantModelNotFound,
259 "The plant model cannot be found in the flash memory! Automatic "
260 "tuning cannot be done! Please run system identification first."},
261 {Error::kFullAutoTuningForbidden,
262 "Full automatic tuning is not possible while a controller is "
263 "enabled!"},
264 {Error::kCoggingFailedHallEncoder,
265 "Cogging torque compensation recording procedure is not possible "
266 "if a HALL encoder is used for motor shaft positioning!"},
267 {Error::kCoggingFailedInvalidResolution,
268 "Cogging torque compensation recording procedure is not possible "
269 "if the commutation encoder has resolution less than 1024!"},
270 {Error::kCoggingFailedInvalidEncoderConfigurationWithGearboxV4,
271 "The encoder configuration is invalid for Cogging Torque "
272 "recording. Assign the following functions to the motor side "
273 "encoder: Commutation and motion control. Re-tune position "
274 "control loop."},
275 {Error::kCoggingFailedInvalidEncoderConfigurationWithGearboxV5,
276 "The encoder configuration is invalid for Cogging Torque "
277 "recording. Assign the following functions to the motor side "
278 "encoder: Commutation, Velocity, Position. Re-tune position "
279 "control loop."},
280 {Error::kCoggingFailedInvalidEncoderConfigurationNoGearbox,
281 "The encoder configuration is invalid for Cogging Torque "
282 "recording. Assign encoder(s) with both the position and velocity "
283 "functions. Re-tune position control loop."},
284 {Error::kCoggingFailedPositionControllerNotTuned,
285 "Position controller gains are set to zero. The position control "
286 "loop has to be tuned in order to use the cogging torque "
287 "compensation recording procedure."},
288 {Error::kCoggingFailedSmmConfigured,
289 "Cogging torque compensation recording is not possible when "
290 "encoder monitoring in SMM is configured. Please reconfigure SMM "
291 "and set the \"Encoder source type\" to \"None\"."},
292 {Error::kCoggingInitFailed,
293 "Cogging torque compensation recording failed to initialize!"},
294 {Error::kCoggingCannotReadData,
295 "Cogging torque compensation data cannot be read, or doesn't "
296 "exist!"},
297 {Error::kCoggingDataCorrupted, "Cogging torque data corrupted!"},
298 {Error::kCoggingRecordingFailed,
299 "Cogging torque compensation recording failed!"},
300 {Error::kCoggingRecordingAborted,
301 "Cogging torque compensation recording aborted!"},
302 {Error::kCoggingRecordingTimeout,
303 "Cogging torque compensation recording failed (timeout)!"},
304 {Error::kCoggingSavingFailed,
305 "Saving of the cogging torque compensation data failed!"},
306 {Error::kCoggingSavingAborted,
307 "Saving of the cogging torque compensation data aborted!"},
308 {Error::kCoggingSavingTimeout,
309 "Saving of the cogging torque compensation data failed "
310 "(timeout)!"},
311 {Error::kCoggingNotEnoughMovementSpace,
312 "It appears there is not enough space to successfully perform "
313 "required preparations! Please move the motor away from the "
314 "software position limits and try again."},
315 {Error::kNarrowAngleCalibrationFailed,
316 "Narrow angle calibration procedure failed!"},
317 {Error::kNarrowAngleCalibrationInternalError,
318 "Narrow angle calibration experienced an internal error! Please "
319 "save the problem report and contact the support."},
320 {Error::kNarrowAngleCalibrationAborted,
321 "Narrow angle calibration procedure aborted!"},
322 {Error::kNarrowAngleCalibrationTimedOut,
323 "Narrow angle calibration timed out!"},
324 {Error::kNarrowAngleCalibrationMotorNotMoving,
325 "Narrow angle calibration - motor not moving!"},
326 {Error::kNarrowAngleCalibrationTimeoutMotorTooSlow,
327 "Narrow angle calibration - timeout - motor too slow!"},
328 {Error::kNarrowAngleCalibrationMotorTooSlow,
329 "Velocity during calibration is too slow. Make sure the velocity "
330 "control loop is tuned and encoder ring can move freely."},
331 {Error::kNarrowAngleCalibrationMotorSemiRotation,
332 "The encoder system was not able to move during calibration. Make "
333 "sure the velocity control loop is tuned and encoder ring can "
334 "move freely."},
335 {Error::kNarrowAngleCalibrationMaxMotorSpeedTooLow,
336 "Max motor speed is set too low for the calibration procedure to "
337 "reach 10 RPM on the driving shaft."},
338 {Error::kNarrowAngleCalibrationDataOutOfRange,
339 "Computed calibration values are out of range. Please tune the "
340 "velocity controller softer (set smaller demanded bandwidth)."},
341 {Error::kNarrowAngleCalibrationBadData,
342 "Calibration data is distorted. Make sure the velocity control "
343 "loop is tuned and the encoder ring isn't damaged and can move "
344 "freely."},
345 {Error::kNarrowAngleCalibrationNoniusPhaseErrorTooHigh,
346 "Nonius phase error is too high to be compensated. The absolute "
347 "position can't be computed reliably. Check mechanical assembly, "
348 "ring damage or eccentricity."},
349 {Error::kNarrowAngleCalibrationAbsResetFailed,
350 "The encoder absolute position reset has failed! Please power "
351 "cycle the drive and repeat the encoder calibration procedure. If "
352 "the issue persists, please contact support."},
353 {Error::kNarrowAngleCalibrationUnsafeAutoPositionAdjustment,
354 "Required position adjustment not possible, or not safe. Please "
355 "check the relevant parameter values and/or move the motor well "
356 "within the software position limits."},
357 {Error::kNarrowAngleCalibrationAutoPositionAdjustmentFailed,
358 "Required position adjustment failed! Please make sure the motor "
359 "can turn freely and all of the relevant parameters are correct."},
360 {Error::kNarrowAngleCalibrationInternalLimitReached,
361 "Internal limit reached! The necessary encoder calibration data "
362 "cannot be reliably recorded! Please make sure all of the "
363 "relevant parameter values are correct."},
364 {Error::kNarrowAngleCalibrationNotEnoughMovementSpace,
365 "It appears there is not enough space to perform a successful "
366 "encoder calibration! Please adjust the software position limits "
367 "and try again."},
368 {Error::kNarrowAngleCalibrationInsufficientVelocityResolution,
369 "The current velocity resolution isn't sufficient for precise "
370 "encoder calibration. Please increase velocity resolution by "
371 "using the object 0x60A9 SI unit velocity."},
372 {Error::kNarrowAngleCalibrationEncoderDataRecordingFailed,
373 "Calibration failed due to a file writing or a data logging "
374 "issue! Please restart the procedure. If the problem persists, "
375 "please download the error report and contact support."},
376 {Error::kNarrowAngleCalibrationSmmConfigured,
377 "Encoder calibration is not possible when encoder monitoring in "
378 "SMM is configured. Please reconfigure SMM and set the \"Encoder "
379 "source type\" to \"None\"."},
380 {Error::kNarrowAngleCalibrationFault,
381 "Encoder calibration failed due to a drive fault!"},
382 {Error::kNarrowAngleCalibrationNotSupported,
383 "Narrow angle calibration - not supported!"},
384 {Error::kBrakeGetStatusFailed, "Failed to get the brake status!"},
385 {Error::kBrakeSetStatusFailed, "Failed to enable/disable the brake!"},
386 {Error::kBrakeSetTimeout,
387 "Failed to enable/disable the brake (timeout)!"},
388 {Error::kBrakeNotConfigured, "Brake has not been configured yet!"},
389 {Error::kConfigurationSaveFailed,
390 "Saving of the configuration to the flash memory has failed!"},
391 {Error::kCannotReadConfigurationFile,
392 "Cannot read the configuration file!"},
393 {Error::kCannotLoadConfigurationFile,
394 "Cannot load the configuration file!"},
395 {Error::kCannotReadError, "Cannot read the current error!"},
396 {Error::kParameterChangeFailed,
397 "Configuration parameter change has failed!"},
398 {Error::kParameterNotFound,
399 "Configuration parameter cannot be found!"},
400 {Error::kZipCorrupted, "The zip file is corrupted!"},
401 {Error::kFlashFailed, "Failed to flash the device!"},
402 {Error::kFlashRefused, "Flashing already in progress!"},
403 {Error::kFlashNotSupported,
404 "Flashing not supported for this device type!"},
405 {Error::kSiiWriteFailed, "Failed to write the SII to the device!"},
406 {Error::kSiiCorrupted,
407 "The firmware package is not valid: The SII file is corrupted!"},
408 {Error::kSiiRestoreInternalError,
409 "SII restore failed due to an internal error!"},
410 {Error::kFirmwareImageNotFoundInZip,
411 "The firmware package is not valid: The binary firmware image "
412 "file is missing!"},
413 {Error::kFileWriteFailed,
414 "Failed to write the file to the device flash memory!"},
415 {Error::kFileRemoveFailed,
416 "Failed to remove the file from the device flash memory!"},
417 {Error::kFileNotFound, "File not found!"},
418 {Error::kFileAlreadyExists, "File already exists!"},
419 {Error::kFileInvalidName, "Invalid file name!"},
420 {Error::kFileDiskFull, "Flash memory full!"},
421 {Error::kFileAccessDenied, "Access denied!"},
422 {Error::kFileInvalidEthercatState, "Invalid EtherCAT device state!"},
423 {Error::kFileInternalError, "Internal file operation error!"},
424 {Error::kDeviceReloadFailed,
425 "Failed to reload the device! The PDO communication might be "
426 "down!"},
427 {Error::kClientNotInControl,
428 "The client used to issue the command currently doesn't have "
429 "control!"},
430 {Error::kInvalidTxPdoPosition, "Internal Motion Master error!"},
431 {Error::kInvalidRxPdoPosition, "Internal Motion Master error!"},
432 {Error::kPrCannotStartTimer, "Internal Motion Master error!"},
433 {Error::kPrCannotStopTimer, "Internal Motion Master error!"},
434 {Error::kUnknownMessageType, "Unknown message type!"},
435 {Error::kRespondingSlaves,
436 "Number of responding slaves has changed!"},
437 {Error::kCannotDetectSlaves,
438 "Cannot detect any slaves. Please connect or power on the slaves "
439 "and restart Motion Master."},
440 {Error::kCannotExecuteSlaveProfile,
441 "Failed to execute the profile on the slave!"},
442 {Error::kFaultResetTimeoutReactionActive,
443 "Failed to reset the fault - fault reaction active timeout!"},
444 {Error::kFaultResetTimeout, "Failed to reset the fault - timeout!"},
445 {Error::kFaultResetNoFault, "Failed to reset the fault - no fault!"},
446 {Error::kFaultResetNotPossible, "Fault reset not possible!"},
447 {Error::kDeviceNotFound, "Device not found!"},
448 {Error::kOsCommandAlreadyRunning,
449 "An OS command is already running on this device!"},
450 {Error::kOsCommandFailed, "OS command has failed!"},
451 {Error::kOsCommandTimeout, "OS command has timed out!"},
452 {Error::kOsCommandNotResponding,
453 "OS command was not responding and was aborted!"},
454 {Error::kOsCommandInvalid, "Invalid OS command!"},
455 {Error::kOsCommandNotSupported, "OS commands are not supported!"},
456 {Error::kOsCommandNotAllowed,
457 "The requested OS command is not allowed in this context!"},
458 {Error::kOsCommandReserved,
459 "The requested OS command has been reserved for internal uses "
460 "only!"},
461 {Error::kOsCommandAborted, "OS command was aborted!"},
462 {Error::kOsCommandAutoAborted,
463 "OS command was automatically aborted because the device "
464 "executing it is not running any more (not in OP enabled)!"},
465 {Error::kOsCommandInternal,
466 "OS command failed due to an internal error!"},
467 {Error::kOsCommandUnknown,
468 "OS command execution has failed with an unknown error!"},
469 {Error::kOpenLoopFieldControlAborted,
470 "Open-loop field control aborted!"},
471 {Error::kCirculoEncoderConfigurationNotSupported,
472 "Circulo encoder configuration not supported!"},
473 {Error::kCirculoEncoderConfigurationAlreadyRunning,
474 "Circulo encoder configuration is already running on this "
475 "device!"},
476 {Error::kCirculoEncoderConfigurationFailed,
477 "Circulo encoder configuration has failed!"},
478 {Error::kCirculoEncoderConfigurationEncoderNotUsed,
479 "The encoder that is being configured must be assigned to a "
480 "controller first!"},
481 {Error::kMotorOutsideSoftwarePositionLimits,
482 "The current motor position is outside of the software position "
483 "limits! Please move the motor within these limits before "
484 "continuing!"},
485 {Error::kInvalidSoftwarePositionLimits,
486 "Invalid software position limits!"},
487 {Error::kEncoderOrdinalInvalid, "Invalid encoder selected!"},
488 {Error::kEncoderPortInvalid, "Invalid encoder port!"},
489 {Error::kEncoderConfigurationInvalid,
490 "The encoder configuration seems to be invalid! Please check all "
491 "of the encoder related parameter values."},
492 {Error::kEncoderNoCommutationEncoder,
493 "Cannot find the commutation encoder!"},
494 {Error::kEncoderNoPositionControlEncoder,
495 "Cannot find the position control encoder!"},
496 {Error::kHrdStreamInitFailed,
497 "The initialization of the HRD stream OS command has failed! "
498 "Please try restarting the procedure."},
499 {Error::kHrdStreamStreamingFailed,
500 "The stream recording phase of the HRD stream OS command has "
501 "failed! Please try restarting the procedure."},
502 {Error::kHrdStreamDurationValue,
503 "OS command failed - Invalid HRD stream duration value!"},
504 {Error::kHrdStreamDataIndexValue,
505 "OS command failed - Invalid HRD stream data index value!"},
506 {Error::kHrdStreamActionValue,
507 "OS command failed - Invalid HRD stream action value!"},
508 {Error::kOpenPhaseDetectionOpenTerminalA,
509 "Open phase detected on terminal A!"},
510 {Error::kOpenPhaseDetectionOpenTerminalB,
511 "Open phase detected on terminal B!"},
512 {Error::kOpenPhaseDetectionOpenTerminalC,
513 "Open phase detected on terminal C!"},
514 {Error::kOpenPhaseDetectionOpenFetAHigh, "Open FET A high detected!"},
515 {Error::kOpenPhaseDetectionOpenFetALow, "Open FET A low detected!"},
516 {Error::kOpenPhaseDetectionOpenFetBHigh, "Open FET B high detected!"},
517 {Error::kOpenPhaseDetectionOpenFetBLow, "Open FET B low detected!"},
518 {Error::kOpenPhaseDetectionOpenFetCHigh, "Open FET C high detected!"},
519 {Error::kOpenPhaseDetectionOpenFetCLow, "Open FET C low detected!"},
520 {Error::kPolePairDetectionCurrentAmplitude,
521 "Pole pair detection - Current amplitude error!"},
522 {Error::kPhaseResistanceMeasurementCurrentAmplitude,
523 "Phase resistance measurement - Current amplitude error!"},
524 {Error::kPhaseInductanceMeasurementCurrentAmplitude,
525 "Phase inductance measurement - Current amplitude error!"},
526 {Error::kFeedConstantInvalid, "Invalid Feed Constant values!"},
527 {Error::kQuickStopTimeout, "Quick stop has failed - timeout!"},
528 {Error::kQuickStopFailed, "Quick stop has failed!"},
529 {Error::kEthercatStateChangeFailed,
530 "Failed to change the EtherCAT state of a device!"},
531 {Error::kUnknown, "Unknown error!"}};
532
533 Error error_;
534
535 static std::string get_error_message(Error error);
536};
Definition: motion_master_error.h:6
MotionMasterError()
Definition: motion_master_error.cc:3
Error get_error() const
Definition: motion_master_error.cc:19
Error
Definition: motion_master_error.h:8
@ kCoggingFailedInvalidEncoderConfigurationNoGearbox
@ kSystemIdentificationWrongPositionVelocityPolarity
@ kNarrowAngleCalibrationAutoPositionAdjustmentFailed
@ kSystemIdentificationInsufficientVelocityResolution
@ kNarrowAngleCalibrationInsufficientVelocityResolution
@ kNarrowAngleCalibrationEncoderDataRecordingFailed
@ kNarrowAngleCalibrationNoniusPhaseErrorTooHigh
@ kNarrowAngleCalibrationUnsafeAutoPositionAdjustment
@ kCoggingFailedInvalidEncoderConfigurationWithGearboxV5
@ kCoggingFailedInvalidEncoderConfigurationWithGearboxV4
bool operator==(const MotionMasterError &other) const
Definition: motion_master_error.cc:15