using RSI.RapidCode.dotNET;
using NUnit.Framework;
using System;
class Homing : SampleAppTestBase
{
public void MasterBasedHoming()
{
axis.
HomeMethodSet(RSIHomeMethod.RSIHomeMethodImprovedFALLING_HOME_NEGATIVE_START_POSITIVE_MOMENTUM);
{
Console.WriteLine("Homing successful\n");
}
}
public void HomingWithAKDdrive()
{
System.Threading.Thread.Sleep(100);
Console.WriteLine("HOME.MOVE");
UInt16 statusWordValue;
int isHomedvalue = 0;
while (isHomedvalue != 1)
{
isHomedvalue = statusWordValue >> 12;
}
Console.WriteLine("Axis homed.");
axis.
OperationModeSet(RSIOperationMode.RSIOperationModeINTERPOLATED_POSITION_MODE);
}
public void HomingWithDS402drive()
{
const int AXIS_NUMBER = 0;
const int offsetIndex = 0x607C;
const int offsetSubindex = 0x0;
const int offsetByteSize = 4;
const int offsetValue = 0;
const int methodIndex = 0x6098;
const int methodSubindex = 0x0;
const int methodByteSize = 1;
const int methodValue = 24;
const int targetSpeedIndex = 0x6099;
const int targetSpeedSubindex = 0x1;
const int targetSpeedByteSize = 4;
const int targetSpeedValue = 2;
const int originSpeedIndex = 0x6099;
const int originSpeedSubindex = 0x2;
const int orignSpeedByteSize = 4;
const int originSpeedValue = 10;
const int accelerationIndex = 0x609A;
const int accelerationSubindex = 0x0;
const int accelerationByteSize = 4;
const int accelerationValue = 100;
const int CONTROL_WORD_TO_PREP_HOMING = 15;
const int CONTROL_WORD_TO_START_HOMING = 31;
const int ACCEPTABLE_DELAY_IN_MS = 20;
const int STATUS_WORD_TARGET_REACHED_BIT = 0x400;
const int STATUS_WORD_HOMING_ATTAINED_BIT = 0x1000;
const int STATUS_WORD_HOMING_ERROR_BIT = 0x2000;
int axisControlWordIndex = (int)axis.
NetworkIndexGet(RSINetworkIndexType.NetworkIndexTypeCONTROL_WORD_INDEX);
UInt16 statusWordValue;
bool cancelHome = false;
while ((!cancelHome) && ((statusWordValue & STATUS_WORD_TARGET_REACHED_BIT) == 0))
{
}
if ((statusWordValue & STATUS_WORD_HOMING_ATTAINED_BIT) == STATUS_WORD_HOMING_ATTAINED_BIT)
{
Console.WriteLine("Axis homed.");
}
else if ((statusWordValue & STATUS_WORD_HOMING_ERROR_BIT) == STATUS_WORD_HOMING_ATTAINED_BIT)
{
Console.WriteLine("Error Occured during homing.");
}
axis.
OperationModeSet(RSIOperationMode.RSIOperationModeCYCLIC_SYNCHRONOUS_POSITION_MODE);
}
public void CustomHome()
{
const int HOME_LIMIT_NETWORK_INDEX = 99;
const int HOME_LIMIT_SIG_BIT = 0;
const int LongTime = 15000;
axis.
MoveVelocity(Constants.VELOCITY, Constants.ACCELERATION);
Boolean done = false;
while (!done)
{
switch (eventType)
{
case RSIEventType.RSIEventTypeMOTION_DONE:
done = true;
break;
case RSIEventType.RSIEventTypeTIMEOUT:
done = true;
break;
default:
break;
}
}
{
}
else
{
}
}
}
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.