APIs, concepts, guides, and more

◆ AxisGet()

Axis * AxisGet ( int32_t axisNumber)
Description:

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

Parameters
axisNumberThe reference number for the axis.
Returns
(Axis*) A pointer to the Axis specified.
Sample Code (C#):
Axis axis = controller.AxisGet(i);
Note
The RMP 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.


Part of the Create and Initialize RapidCode Objects method group.

Note
Important usage instructions for all RapidCode creation methods: All creation methods, such as and Create(), AxisGet(), NetworkNodeGet(), etc. Each return valid pointers to RapidCode objects. These pointers are never null, even when there is an error during object creation.
Error Checking After Creation
Immediately after the creation of a RapidCode object, you need to check if there were any errors during its creation. You do this by calling the ErrorLogCountGet() method on the created object. If ErrorLogCountGet() returns a value greater than zero, it means there were errors during the object creation.
Handling Errors
To handle the errors, you call the ErrorLogGet() method once for each error on the created object to retrieve an RsiError object. You can then inspect the RsiError object to understand more about the error.
Helper Functions
RapidCode also provides helper functions in both C++ and C#, like HelperFunctions::CheckErrors(), that work with all RapidCode objects. These helper functions operate on RapidCodeObject, hence they are compatible with all RapidCode objects. For example:
Notes on creation methods with the C# API (vs. C++)
In the C# API, the pointers are replaced by references due to differences between C++ and C#. The creation methods return a reference to the object instead of a pointer. However, the method calls and error handling procedures remain the same. Null references are not returned by the creation methods in C#. Always check for errors after object creation, as described above.
Note
Object Cleanup Any and all objects created by RapidCode creation methods will be cleaned up by calling MotionController::Delete(). This should be done with your application is finished using RapidCode objects.
See also
ErrorLogCountGet , ErrorLogGet , Delete , HelperFunctions.CheckErrors
Examples
AxisConfig.cs, AxisConfiguration.cpp, CalculateAccelerationFromVelocity.cpp, DifferenceOfPositionUserLimit.cpp, GearingCamming.cs, HardwareLimits.cpp, HelperFunctions.cs, MathBlock.cs, Memory.cpp, MotionHold.cs, MotionHoldReleasedBySoftwareAddress.cpp, MultiAxisMotion.cs, MultiaxisMotion.cpp, PVTmotionMultiAxis.cpp, PathMotion.cpp, PhantomAxis.cpp, PointToPoint.cpp, SampleAppsHelper.h, SingleAxisSyncOutputs.cpp, SyncOutputWithMotion.cpp, Template.cpp, Template.cs, TouchProbe.cs, UpdateBufferPoints.cpp, and VelocitySetByAnalogInputValue.cs.