APIs, concepts, guides, and more
axis-homing-master-based.cs
Note
See Axis: Homing 📜 for a detailed explanation of this sample code.
Warning
This is a sample program to assist in the integration of the RMP motion controller with your application. It may not contain all of the logic and safety features that your application requires. We recommend that you wire an external hardware emergency stop (e-stop) button for safety when using our code sample apps. Doing so will help ensure the safety of you and those around you and will prevent potential injury or damage.

The sample apps assume that the system (network, axes, I/O) are configured prior to running the code featured in the sample app. See the Configuration page for more information.
/* 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(axisNumber: 0);
Helpers.CheckErrors(axis);
// 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
Helpers.AbortMotionObject(axis);
}
// handle errors as needed
finally
{
controller.Delete(); // dispose
}
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:5863
static MotionController * Get()
Get an already running RMP EtherCAT controller.
Represents the RMP soft motion controller. This class provides an interface to general controller con...
Definition rsi.h:800
RSINetworkState
State of network.
Definition rsienums.h:568
RSIAction
Action to perform on an Axis.
Definition rsienums.h:1115
Helpers namespace provides utility functions for common tasks in RMP applications.
Definition helpers.h:21