Learn how to handle errors and read error logs from a RapidCodeObject.
Console.WriteLine("📜 Error Logs");
try
{
Axis axis = controller.AxisGet(axisNumber: 0);
controller.ThrowExceptions(false);
controller.RecorderStart();
var controllerErrorCount = controller.ErrorLogCountGet();
Console.WriteLine($"Controller error count: {controllerErrorCount} (expected: 1)");
Console.WriteLine($"Axis error count: {axisErrorCount} (expected: 1)");
while(controller.ErrorLogCountGet() > 0)
{
RsiError error = controller.ErrorLogGet();
Console.WriteLine($" Controller Error: {error.Message}");
}
{
Console.WriteLine($" Axis Error: {error.Message}");
}
Console.WriteLine($"Controller error count: {controller.ErrorLogCountGet()} (expected: 0)");
Console.WriteLine($"Axis error count: {axis.ErrorLogCountGet()} (expected: 0)");
if (controllerErrorCount < 1 || axisErrorCount < 1)
throw new Exception("❌ Error log did not record expected errors.");
}
finally
{
controller.Delete();
}
void MoveVelocity(double velocity)
Represents a single axis of motion control. This class provides an interface for commanding motion,...
static MotionController * Get()
Get an already running RMP EtherCAT controller.
Represents the RMP soft motion controller. This class provides an interface to general controller con...
void ThrowExceptions(bool state)
Configure a class to throw exceptions.
const RsiError *const ErrorLogGet()
Get the next RsiError in the log.
int32_t ErrorLogCountGet()
Get the number of software errors in the error log.
Represents the error details thrown as an exception by all RapidCode classes. This class contains an ...
Helpers namespace provides utility functions for common tasks in RMP applications.