APIs, concepts, guides, and more

◆ Home()

void Home ( bool moveToZero = true)
Description:
Home executes the homing routine as configured with the other homing methods. At the completion of finding the index / marker pulse, or the desired switch, the Axis will set the Home Offset, and then move to the zero position. If you don't want the Axis to move to zero after homing, set "moveToZero" false.
Parameters
moveToZeroSet true if you want the Axis to move to zero at the end of homing. (Default: true)

Part of the Homing method group.

Sample Code:
Axis: Homing
/* 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");
int exitCode = 0;
// set sample config params
const RSIHomeMethod HOME_METHOD = RSIHomeMethod.RSIHomeMethodImprovedFALLING_HOME_NEGATIVE_START_POSITIVE_MOMENTUM;
// get rmp controller
MotionController controller = MotionController.Get();
try
{
Helpers.CheckErrors(controller);
Helpers.VerifyHardwareUsage(controller);
Helpers.VerifyAxisCount(controller);
// check is network is started
if (controller.NetworkStateGet() != RSINetworkState.RSINetworkStateOPERATIONAL)
{
Console.WriteLine("Network not started. Please start it before running this app.");
}
// get axis
Axis axis = controller.AxisGet(axisNumber: Constants.AXIS_0_INDEX);
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);
exitCode = Constants.EXIT_SUCCESS;
}
// handle errors as needed
catch (Exception e)
{
Console.WriteLine($"❌ Error: {e.Message}");
exitCode = Constants.EXIT_FAILURE;
}
finally
{
controller.Delete(); // dispose
}
return exitCode;
Constants used in the C# sample apps.
Definition _constants.cs:3
const int EXIT_FAILURE
Exit code for failed execution.
Definition _constants.cs:69
const int AXIS_0_INDEX
Default: 0.
Definition _constants.cs:20
const int EXIT_SUCCESS
Exit code for successful execution.
Definition _constants.cs:68
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 Home(bool moveToZero=true)
Execute the homing routine.
void HomeVelocitySet(double velocity)
Set the home velocity.
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:5921
RSINetworkState
State of network.
Definition rsienums.h:573
RSIAction
Action to perform on an Axis.
Definition rsienums.h:1122
Helpers namespace provides utility functions for common tasks in RMP applications.
Definition helpers.h:21
Notes:
Be sure to set Home Action to ::RSIActionSTOP. Also set HW Positive/Negative Limit actions to STOP if homing with limit switches.
See also
HomeMethodSet, HomeOffsetSet, HomeVelocitySet, HomeAccelerationSet, HomeDecelerationSet, HomeActionSet
Master-based homing.
Examples
PathMotion.cpp, and axis-homing-master-based.cs.