45using RSI.RapidCode.dotNET;
50class Homing : SampleAppTestBase
52 public void MasterBasedHoming()
67 Console.WriteLine(
"Homing successful\n");
75 public void HomingWithAKDdrive()
108 System.Threading.Thread.Sleep(100);
112 Console.WriteLine(
"HOME.MOVE");
115 UInt16 statusWordValue;
116 int isHomedvalue = 0;
119 while (isHomedvalue != 1)
122 isHomedvalue = statusWordValue >> 12;
125 Console.WriteLine(
"Axis homed.");
137 public void HomingWithDS402drive()
142 const int AXIS_NUMBER = 0;
145 const int offsetIndex = 0x607C;
146 const int offsetSubindex = 0x0;
147 const int offsetByteSize = 4;
148 const int offsetValue = 0;
151 const int methodIndex = 0x6098;
152 const int methodSubindex = 0x0;
153 const int methodByteSize = 1;
154 const int methodValue = 24;
157 const int targetSpeedIndex = 0x6099;
158 const int targetSpeedSubindex = 0x1;
159 const int targetSpeedByteSize = 4;
160 const int targetSpeedValue = 2;
163 const int originSpeedIndex = 0x6099;
164 const int originSpeedSubindex = 0x2;
165 const int orignSpeedByteSize = 4;
166 const int originSpeedValue = 10;
169 const int accelerationIndex = 0x609A;
170 const int accelerationSubindex = 0x0;
171 const int accelerationByteSize = 4;
172 const int accelerationValue = 100;
175 const int CONTROL_WORD_TO_PREP_HOMING = 15;
176 const int CONTROL_WORD_TO_START_HOMING = 31;
177 const int ACCEPTABLE_DELAY_IN_MS = 20;
178 const int STATUS_WORD_TARGET_REACHED_BIT = 0x400;
179 const int STATUS_WORD_HOMING_ATTAINED_BIT = 0x1000;
180 const int STATUS_WORD_HOMING_ERROR_BIT = 0x2000;
193 controller.
SampleWait(ACCEPTABLE_DELAY_IN_MS);
197 controller.
SampleWait(ACCEPTABLE_DELAY_IN_MS);
201 controller.
SampleWait(ACCEPTABLE_DELAY_IN_MS);
203 UInt16 statusWordValue;
204 bool cancelHome =
false;
207 while ((!cancelHome) && ((statusWordValue & STATUS_WORD_TARGET_REACHED_BIT) == 0))
215 if ((statusWordValue & STATUS_WORD_HOMING_ATTAINED_BIT) == 1)
217 Console.WriteLine(
"Axis homed.");
219 else if ((statusWordValue & STATUS_WORD_HOMING_ERROR_BIT) == 1)
221 Console.WriteLine(
"Error Occured during homing.");
235 public void CustomHome()
242 const int HOME_LIMIT_NETWORK_INDEX = 99;
243 const int HOME_LIMIT_SIG_BIT = 0;
244 const int LongTime = 15000;
256 axis.
MoveVelocity(Constants.VELOCITY, Constants.ACCELERATION);
259 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.