Console.WriteLine("📜 Axis Homing: DS402 Drive");
const int offsetIdx = 0x607C;
const int offsetSub = 0x0;
const int offsetSize = 4;
const int offsetVal = 0;
const int methodIdx = 0x6098;
const int methodSub = 0x0;
const int methodSize = 1;
const int methodVal = 24;
const int targetSpeedIdx = 0x6099;
const int targetSpeedSub = 0x1;
const int targetSpeedSize = 4;
const int targetSpeedVal = 2;
const int originSpeedIdx = 0x6099;
const int originSpeedSub = 0x2;
const int originSpeedSize = 4;
const int originSpeedVal = 10;
const int accelIdx = 0x609A;
const int accelSub = 0x0;
const int accelSize = 4;
const int accelVal = 100;
const int CTRL_WORD_PREP_HOMING = 15;
const int CTRL_WORD_START_HOMING = 31;
const int DELAY_MS = 20;
const int STATUS_TARGET_REACHED = 0x400;
const int STATUS_HOMING_ATTAINED = 0x1000;
const int STATUS_HOMING_ERROR = 0x2000;
try
{
if (controller.NetworkStateGet() !=
RSINetworkState.RSINetworkStateOPERATIONAL)
{
Console.WriteLine("Network not started. Please start it before running this app.");
return;
}
Axis axis = controller.AxisGet(axisNumber: 0);
controller.SampleWait(DELAY_MS);
controller.SampleWait(DELAY_MS);
controller.SampleWait(DELAY_MS);
bool cancelHome = false;
while ((!cancelHome) && ((statusWord & STATUS_TARGET_REACHED) == 0))
{
}
if ((statusWord & STATUS_HOMING_ATTAINED) == STATUS_HOMING_ATTAINED)
Console.WriteLine("Axis homed successfully");
else if ((statusWord & STATUS_HOMING_ERROR) == STATUS_HOMING_ERROR)
Console.WriteLine("Error occurred during homing");
}
finally
{
controller.Delete();
}
Constants used in the C# sample apps.
const int AXIS_0_INDEX
Default: 0.
uint32_t NetworkIndexGet(RSINetworkIndexType indexType)
Get the PDO array index for an axis signal mapping.
void OperationModeSet(RSIOperationMode mode)
Set the axis operation mode.
NetworkNode * NetworkNode
Gets the associated NetworkNode object.
Represents a single axis of motion control. This class provides an interface for commanding motion,...
void NetworkOutputOverrideValueSet(int32_t index, uint64_t outputValue)
Sets a PDO output directly.
static MotionController * Get()
Get an already running RMP EtherCAT controller.
void NetworkOutputOverrideSet(int32_t index, bool outputOverride)
Set NetworkOutputValue to override RMP cyclic value.
Represents the RMP soft motion controller. This class provides an interface to general controller con...
void ServiceChannelWrite(int32_t index, int32_t subIndex, int32_t byteCount, int32_t sdoValue)
Write a number in the SDO.
uint16_t StatusWordGet(int32_t axisIndex)
Get the DS402 status word.
MotionController * rsiControl
Gets the parent MotionController object.
RSINetworkState
State of network.
RSIOperationMode
DS402 modes of operation.
RSINetworkIndexType
Network PDO index types for configuring axis input/output mappings.
Helpers namespace provides utility functions for common tasks in RMP applications.