Console.WriteLine("📜 MathBlock: Difference of Position UserLimit");
const int INDEX_ZERO = 0;
try
{
controller.MathBlockCountSet(1);
controller.UserLimitCountSet(1);
ulong mbProcessValueAddr = controller.AddressGet(
RSIControllerAddressType.RSIControllerAddressTypeMATHBLOCK_PROCESS_VALUE, INDEX_ZERO);
var mbConfig = controller.MathBlockConfigGet(INDEX_ZERO);
mbConfig.Operation = SUBTRACT;
mbConfig.InputAddress0 = axis0PositionAddr;
mbConfig.InputAddress1 = axis1PositionAddr;
mbConfig.InputDataType0 = DOUBLE;
mbConfig.InputDataType1 = DOUBLE;
mbConfig.ProcessDataType = DOUBLE;
controller.MathBlockConfigSet(INDEX_ZERO, mbConfig);
controller.SampleWait(1);
controller.UserLimitConditionSet(
number: INDEX_ZERO,
conditionNumber: 0,
addressOfDouble: mbProcessValueAddr,
controller.UserLimitConfigSet(
number: INDEX_ZERO,
duration: 0);
relativePosition: 10,
vel: 1,
accel: 1,
decel: 1,
jerkPct: 0);
Console.WriteLine($"Axis 0 state: {axis0State} (expected: {RSIState.RSIStateERROR})");
if (axis0State !=
RSIState.RSIStateERROR)
throw new Exception("❌ UserLimit did not trigger correctly - both axes should be in error state.");
}
finally
{
controller.UserLimitDisable(INDEX_ZERO);
controller.Delete();
}
Constants used in the C# sample apps.
const double AXIS_0_USER_UNITS
Default: 1.
const int AXIS_0_INDEX
Default: 0.
const int AXIS_1_INDEX
Default: 1.
uint64_t AddressGet(RSIAxisAddressType addressType)
Get the an address for some location on the Axis.
void MoveRelative(double relativePosition, double vel, double accel, double decel, double jerkPct)
Command a relative point-to-point S-Curve motion.
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...
int32_t MotionDoneWait()
Waits for a move to complete.
RSIState StateGet()
Get the Axis or MultiAxis state.
int32_t AmpEnableSet(bool enable, int32_t ampActiveTimeoutMilliseconds=AmpEnableTimeoutMillisecondsDefault, bool overrideRestrictedState=false)
Enable all amplifiers.
RSIMathBlockOperation
MathBlock operations.
RSIControllerAddressType
Used to get firmware address used in User Limits, Recorders, etc.
RSIDataType
Data types for User Limits and other triggers.
RSIUserLimitLogic
Logic options for User Limits.
RSIAction
Action to perform on an Axis.
RSIAxisAddressType
Used to get firmware address used in User Limits, Recorders, etc.
RSIUserLimitTriggerType
Trigger types for UserLimits.
Helpers namespace provides utility functions for common tasks in RMP applications.