RMP Motion Controller
10.6.2
APIs
, concepts, guides, and more
Community
Support
Contact
◆
AKDASCIICommand()
char * AKDASCIICommand
(
const char *const
command
)
Parameters
command
the command to send (for example, try "DRV.INFO")
Returns
the text response from the AKD drive
Axis: Homing
// 1. READY DRIVE
axis.
OperationModeSet
(
RSIOperationMode
.RSIOperationModeHOMING_MODE);
// Mode of Operation set to Homing Mode.
axis.
NetworkNode
.
AKDASCIICommand
(
"DRV.OPMODE 2"
);
// Sets the drive operation mode (0 - current | 1 = velocity | 2 = position).
axis.
NetworkNode
.
AKDASCIICommand
(
"HOME.AUTOMOVE 0"
);
// 0 = Disabled | 1 = Homing starts when drive is enabled.
// Make sure you know your motor's position, velocity, and acceleration units before you send any values.
// 2. SET YOUR LIMIT SWITCHES
axis.
NetworkNode
.
AKDASCIICommand
(
"DIN5.MODE 18"
);
// Sets the digital input modes. - DI5 is now our Positive Limit Switch.
axis.
NetworkNode
.
AKDASCIICommand
(
"DIN5.INV 1"
);
// Sets the indicated polarity of a digital input mode. - DI5 is now active when Low.
axis.
NetworkNode
.
AKDASCIICommand
(
"DIN6.MODE 19"
);
// Sets the digital input modes. - DI6 is now our Negative Limit Switch.
axis.
NetworkNode
.
AKDASCIICommand
(
"DIN6.INV 1"
);
// Sets the indicated polarity of a digital input mode. - DI6 is now active when Low.
// 3. CONFIGURE DRIVE HOMING PARAMETERS
axis.
NetworkNode
.
AKDASCIICommand
(
"HOME.MODE 1"
);
// Selects the homing method. MODE1 = Find limit input
axis.
NetworkNode
.
AKDASCIICommand
(
"HOME.V 20"
);
axis.
NetworkNode
.
AKDASCIICommand
(
"HOME.ACC 200"
);
axis.
NetworkNode
.
AKDASCIICommand
(
"HOME.DEC 200"
);
axis.
NetworkNode
.
AKDASCIICommand
(
"HOME.DIR 0"
);
// Sets homing direction (0 = negative | 1 = positive)
axis.
NetworkNode
.
AKDASCIICommand
(
"HOME.P 0"
);
axis.
NetworkNode
.
AKDASCIICommand
(
"HOME.DIST 0"
);
axis.
NetworkNode
.
AKDASCIICommand
(
"HOME.MAXDIST 0"
);
axis.
NetworkNode
.
AKDASCIICommand
(
"HOME.IPEAK"
);
// 4. READY AXIS
axis.
ErrorLimitActionSet
(
RSIAction
.RSIActionNONE);
//Set the action to none so we don't get a position error while the drive is in control.
axis.
Abort
();
// Disable axis.
axis.
ClearFaults
();
// Clear any faults.
axis.
AmpEnableSet
(
true
);
// Enable the axis.
System.Threading.Thread.Sleep(100);
// Allow time for amp enable
// 5. START HOMING
axis.
NetworkNode
.
AKDASCIICommand
(
"HOME.MOVE"
);
// Starts a homing procedure; active in opmode 2 (position) only.
Console.WriteLine(
"HOME.MOVE"
);
// 6. CHECK IF HOMING IS DONE
UInt16 statusWordValue;
int
isHomedvalue = 0;
int
axisIndex = axis.
NumberGet
();
while
(isHomedvalue != 1)
// When isHomedValue = 1, homing has finished.
{
statusWordValue = axis.
NetworkNode
.
StatusWordGet
(axisIndex);
isHomedvalue = statusWordValue >> 12;
// Get the 12th bit only. This bit tells us homing is done when it goes HIGH.
}
Console.WriteLine(
"Axis homed."
);
// 7. CLEAN UP
axis.
OriginPositionSet
(0.0);
//Set the origin to 0, otherwise repeated use will not result in Rapidcode reporting 0 at the found home position.
axis.
Abort
();
// Disable the axis.
axis.
OperationModeSet
(
RSIOperationMode
.RSIOperationModeINTERPOLATED_POSITION_MODE);
// Mode of Operation Restore
axis.
ErrorLimitActionSet
(
RSIAction
.RSIActionABORT);
// Restore the position error action to whatever you want it to be.
Examples
Homing.cs
.
RSI
RapidCode
NetworkNode
Generated by
1.10.0