◆ AxisGet()

virtual Axis* AxisGet ( int32_t  axisNumber)
pure virtual

AxisGet returns a pointer to an Axis object and initializes its internals.

ℹ This function is avaliable in RapidCode

Part of the Create and Initialize RapidCode Objects method group.

Description:
AxisGet takes an axis reference number and returns a pointer to the Axis object it represents.
Parameters
axisNumberThe reference number for the axis.
Returns
(Axis*) A pointer to the Axis specified.
Sample Code:
}
public void DisableAllAxis()
{
for (int i=0; i < controller.AxisCountGet(); i++)
{
Axis axis = controller.AxisGet(i);
axis.Abort();
axis.AmpEnableSet(false);
}
}
public void ResetAxis(Axis myAxis)
{
myAxis.ErrorLimitTriggerValueSet(1000);
myAxis.UserUnitsSet(Constants.USER_UNITS); // Specify the counts per Unit.
myAxis.PositionSet(0); // Sets the current position as 0 effectively 'homing' it.
myAxis.Abort(); // If there is any motion happening, abort it (creates a fault).
myAxis.DefaultAccelerationSet(Constants.ACCELERATION);
myAxis.DefaultDecelerationSet(Constants.ACCELERATION);
myAxis.DefaultVelocitySet(Constants.VELOCITY);
//@[EnableAmp]
myAxis.ClearFaults(); // To enable after an abort faults must be cleared.
myAxis.AmpEnableSet(true); // Enable the motor.
//@[EnableAmp]
}
public void TearDownFixture()
{
DisableAllAxis();
controller.Shutdown();
controller.Delete();
}
}
public class SampleAppTestBase : TestBase
{
[SetUp]
public void SetUp()
{
for (int i = 0; i < controller.AxisCountGet(); i++)
{
Axis axis = controller.AxisGet(i);
ResetAxis(axis);
}
}
[OneTimeSetUp]
public void OneTimeSetUp()
{
controller = MotionController.CreateFromSoftware(TestContext.CurrentContext.TestDirectory);// Insert the path location of the RMP.rta (usually the RapidSetup folder)
HelperFunctions.CheckErrors(controller); // [Helper Function] Check that the controller has been initialize correctly.
controller.AxisCountSet(Constants.AXIS_COUNT);
Note
SynqNet assigns a logical number to each axis as it encounters them during network initialization. The first axis is 0, the second 1, and so on. This logical sequential number is the axisNumber passed to AxisGet.

Getting the Axis will cause all of its internal default values and low-level objects to be recreated.

Examples
Gantry.cpp, HardwareLimits.cpp, Memory.cpp, MotionHoldReleasedBySoftwareAddress.cpp, MultiaxisMotion.cpp, PathMotion.cpp, PVTmotionMultiAxis.cpp, SingleAxisSyncOutputs.cpp, SyncInterrupt.cpp, SyncOutputWithMotion.cpp, Template.cpp, and UpdateBufferPoints.cpp.