50using RSI.RapidCode.dotNET;
55class Homing : SampleAppTestBase
57 public void MasterBasedHoming()
72 Console.WriteLine(
"Homing successful\n");
80 public void HomingWithAKDdrive()
113 System.Threading.Thread.Sleep(100);
117 Console.WriteLine(
"HOME.MOVE");
120 UInt16 statusWordValue;
121 int isHomedvalue = 0;
124 while (isHomedvalue != 1)
127 isHomedvalue = statusWordValue >> 12;
130 Console.WriteLine(
"Axis homed.");
142 public void HomingWithDS402drive()
147 const int AXIS_NUMBER = 0;
150 const int offsetIndex = 0x607C;
151 const int offsetSubindex = 0x0;
152 const int offsetByteSize = 4;
153 const int offsetValue = 0;
156 const int methodIndex = 0x6098;
157 const int methodSubindex = 0x0;
158 const int methodByteSize = 1;
159 const int methodValue = 24;
162 const int targetSpeedIndex = 0x6099;
163 const int targetSpeedSubindex = 0x1;
164 const int targetSpeedByteSize = 4;
165 const int targetSpeedValue = 2;
168 const int originSpeedIndex = 0x6099;
169 const int originSpeedSubindex = 0x2;
170 const int orignSpeedByteSize = 4;
171 const int originSpeedValue = 10;
174 const int accelerationIndex = 0x609A;
175 const int accelerationSubindex = 0x0;
176 const int accelerationByteSize = 4;
177 const int accelerationValue = 100;
180 const int CONTROL_WORD_TO_PREP_HOMING = 15;
181 const int CONTROL_WORD_TO_START_HOMING = 31;
182 const int ACCEPTABLE_DELAY_IN_MS = 20;
183 const int STATUS_WORD_TARGET_REACHED_BIT = 0x400;
184 const int STATUS_WORD_HOMING_ATTAINED_BIT = 0x1000;
185 const int STATUS_WORD_HOMING_ERROR_BIT = 0x2000;
198 controller.
SampleWait(ACCEPTABLE_DELAY_IN_MS);
202 controller.
SampleWait(ACCEPTABLE_DELAY_IN_MS);
206 controller.
SampleWait(ACCEPTABLE_DELAY_IN_MS);
208 UInt16 statusWordValue;
209 bool cancelHome =
false;
212 while ((!cancelHome) && ((statusWordValue & STATUS_WORD_TARGET_REACHED_BIT) == 0))
220 if ((statusWordValue & STATUS_WORD_HOMING_ATTAINED_BIT) == STATUS_WORD_HOMING_ATTAINED_BIT)
222 Console.WriteLine(
"Axis homed.");
224 else if ((statusWordValue & STATUS_WORD_HOMING_ERROR_BIT) == STATUS_WORD_HOMING_ATTAINED_BIT)
226 Console.WriteLine(
"Error Occured during homing.");
240 public void CustomHome()
247 const int HOME_LIMIT_NETWORK_INDEX = 99;
248 const int HOME_LIMIT_SIG_BIT = 0;
249 const int LongTime = 15000;
261 axis.
MoveVelocity(Constants.VELOCITY, Constants.ACCELERATION);
264 Boolean done =
false;
uint32_t NetworkIndexGet(RSINetworkIndexType indexType)
Get the Network Index associated with a DS402 Axis Feature.
void HardwareNegLimitActionSet(RSIAction action)
Set the action that will occur when the Hardware Negative Limit Event triggers.
void HomeSlowVelocitySet(double velocity)
Set the slow home velocity.
void OriginPositionSet(double position)
Set the origin position.
void OperationModeSet(RSIOperationMode mode)
Set the axis operation mode.
void HomeVelocitySet(double velocity)
Set the home velocity.
NetworkNode * NetworkNode
Gets the associated NetworkNode object.
void HomeActionSet(RSIAction action)
Set the action that will occur when the Home Event triggers.
void ErrorLimitActionSet(RSIAction action)
Set the action that will occur when the Error Limit Event triggers.
void MoveVelocity(double velocity)
void Home()
Execute the homing routine.
void HomeDecelerationSet(double decel)
Set the decleration to be used for homing when using the switch is not detected before the HomeTravel...
void HomeStateSet(bool homed)
Set the home state.
void HomeAccelerationSet(double accel)
Set the deceleration used for homing.
void HomeMethodSet(RSIHomeMethod method)
Set the method to be used for homing.
bool HomeStateGet()
Get the home state.
void HomeLimitCustomConfigSet(uint64_t address, int32_t bitIndex)
void HomeOffsetSet(double offset)
Set the home offset.
void NetworkOutputOverrideValueSet(int32_t index, uint64_t outputValue)
Sets a PDO output directly.
void NetworkOutputOverrideSet(int32_t index, bool outputOverride)
Set NetworkOutputValue to override RMP cyclic value.
uint64_t NetworkInputValueGet(int32_t index)
void SampleWait(uint32_t samples)
Wait for controller firmware to execute samples.
uint64_t NetworkInputAddressGet(int32_t index)
char * AKDASCIICommand(const char *const command)
Send a Kollmorgen AKD ASCII command (NodeType must equal KOLLMORGEN_AKD)
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.
RSIEventType InterruptWait(int32_t milliseconds)
Suspend the current thread until an interrupt arrives from the controller.
void ClearFaults()
Clear all faults for an Axis or MultiAxis.
void AmpEnableSet(bool enable)
Enable all amplifiers.
void Abort()
Abort an axis.
int32_t NumberGet()
Get the axis number.
MotionController * rsiControl
Gets the parent MotionController object.
RSIEventType
Event Types or Status Bits.
RSIAction
Action to perform on an Axis.
RSIOperationMode
DS402 modes of operation.
RSINetworkIndexType
Network index types for Axis.