Console.WriteLine("📜 MathBlock: PDO Copy");
const int MB_INDEX = 0;
const int BIAS = 8000;
try
{
if (controller.NetworkStateGet() !=
RSINetworkState.RSINetworkStateOPERATIONAL)
{
Console.WriteLine("Network not started. Please start it before running this app.");
return;
}
controller.MathBlockCountSet(1);
{
Console.WriteLine("One or both axes are phantom (not real). Please use real axes for this sample app.");
return;
}
controller.MemorySet(userBufferAddr0, BIAS);
ulong torqueActualAddress = controller.NetworkInputAddressGet((int)torqueActualIndex);
ulong targetTorqueAddress = controller.NetworkOutputAddressGet((
int)targetTorqueIndex,
RSINetworkOutputAddressType.RSINetworkOutputAddressTypeOVERRIDE_VALUE);
controller.NetworkOutputOverrideSet((int)targetTorqueIndex, true);
var mbConfig = controller.MathBlockConfigGet(MB_INDEX);
mbConfig.InputAddress0 = torqueActualAddress;
mbConfig.InputAddress1 = userBufferAddr0;
mbConfig.InputDataType0 = INT32;
mbConfig.InputDataType1 = INT32;
mbConfig.Operation = ADD;
mbConfig.ProcessDataType = INT32;
mbConfig.OutputAddress = targetTorqueAddress;
mbConfig.OutputDataType = INT32;
controller.MathBlockConfigSet(MB_INDEX, mbConfig);
controller.SampleWait(1);
Console.WriteLine($"MathBlock configured to copy axis {Constants.AXIS_0_INDEX} torque actual to axis {Constants.AXIS_1_INDEX} target torque with bias {BIAS}");
Console.WriteLine($"Operation: {mbConfig.Operation}");
Console.WriteLine("✅ MathBlock PDO copy with bias configured successfully");
}
finally
{
controller.Delete();
}
Constants used in the C# sample apps.
const int AXIS_0_INDEX
Default: 0.
const int AXIS_1_INDEX
Default: 1.
uint32_t NetworkIndexGet(RSINetworkIndexType indexType)
Get the PDO array index for an axis signal mapping.
NetworkNode * NetworkNode
Gets the associated NetworkNode object.
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...
bool Exists()
Returns true if this NetworkNode exists on a physical network.
RSIMathBlockOperation
MathBlock operations.
RSINetworkState
State of network.
RSIControllerAddressType
Used to get firmware address used in User Limits, Recorders, etc.
RSIDataType
Data types for User Limits and other triggers.
RSINetworkOutputAddressType
Network output address types.
RSINetworkIndexType
Network PDO index types for configuring axis input/output mappings.
Helpers namespace provides utility functions for common tasks in RMP applications.