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