APIs, concepts, guides, and more
axis-homing-master-based.cs
/* This sample application demonstrates master-based homing using the RapidCode .NET API.
Master-based homing is when the RMP controller executes the homing routine instead of the drive.
*/
using RSI.RapidCode; // RSI.RapidCode.dotNET;
Console.WriteLine("📜 Axis Homing: Master-Based");
// set sample config params
const RSIHomeMethod HOME_METHOD = RSIHomeMethod.RSIHomeMethodImprovedFALLING_HOME_NEGATIVE_START_POSITIVE_MOMENTUM;
// get rmp controller
try
{
Helpers.CheckErrors(controller);
// check is network is started
if (controller.NetworkStateGet() != RSINetworkState.RSINetworkStateOPERATIONAL)
{
Console.WriteLine("Network not started. Please start it before running this app.");
return;
}
// get axis
Axis axis = controller.AxisGet(Constants.AXIS_0_INDEX);
// configure limit action
axis.HardwareNegLimitActionSet(RSIAction.RSIActionSTOP); // neg limit action set to STOP
// configure homing parameters
axis.HomeMethodSet(HOME_METHOD); // set the homing method
axis.HomeVelocitySet(10); // set the home velocity
axis.HomeSlowVelocitySet(1); // set the slow home velocity (used for final move if necessary)
axis.HomeAccelerationSet(100); // set the acceleration used for homing
axis.HomeDecelerationSet(100); // set the deceleration used for homing
axis.HomeOffsetSet(0.5); // set position offset from home (zero) position
// execute homing routine
axis.Home();
// check if homing was successful
if (axis.HomeStateGet() == true)
Console.WriteLine("Homing successful");
// clean up
axis.ClearFaults();
axis.AmpEnableSet(false);
}
// handle errors as needed
finally
{
controller.Delete(); // dispose
}
static void CheckErrors(RapidCodeObject rsiObject)
Checks for errors in the given RapidCodeObject and throws an exception if any non-warning errors are ...
Definition _helpers.cs:15
Helpers class provides static methods for common tasks in RMP applications.
Definition _helpers.cs:5
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 HomeVelocitySet(double velocity)
Set the home 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 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 HomeOffsetSet(double offset)
Sets the user coordinate value assigned to the detected homing reference point.
Represents a single axis of motion control. This class provides an interface for commanding motion,...
Definition rsi.h:5870
Axis * AxisGet(int32_t axisNumber)
AxisGet returns a pointer to an Axis object and initializes its internals.
RSINetworkState NetworkStateGet()
static MotionController * Get()
Get an already running RMP EtherCAT controller.
void Delete(void)
Delete the MotionController and all its objects.
Represents the RMP soft motion controller. This class provides an interface to general controller con...
Definition rsi.h:800
void ClearFaults()
Clear all faults for an Axis or MultiAxis.
int32_t AmpEnableSet(bool enable, int32_t ampActiveTimeoutMilliseconds=AmpEnableTimeoutMillisecondsDefault, bool overrideRestrictedState=false)
Enable all amplifiers.
RSINetworkState
State of network.
Definition rsienums.h:568
RSIAction
Action to perform on an Axis.
Definition rsienums.h:1115