MotionController Axis MultiAxis IO IOPoint NetworkNode RsiError
Sample Apps Changelog

RapidCode API

#include "rsi.h" // Import our RapidCode Library.
#include "HelperFunctions.h" // Import our SampleApp helper functions.
void HardwareLimitsMain()
using namespace RSI::RapidCode;
// Constants
const int AXIS_NUMBER = 0; // Specify which axis/motor we will be controlling.
const bool ACTIVE_HIGH = true; // Constant for active high.
const bool ACTIVE_LOW = false; // Constant for active low.
const double HW_POS_DURATION_TIME = 0.01; // Positive limit duration. (in seconds)
const double HW_NEG_DURATION_TIME = 0.01; // Negative limit duration. (in seconds)
char rmpPath[] = "C:\\RSI\\X.X.X\\"; // Insert the path location of the RMP.rta (usually the RapidSetup folder)
// Initialize MotionController class.
MotionController *controller = MotionController::CreateFromSoftware(/*rmpPath*/); // NOTICE: Uncomment "rmpPath" if project directory is different than rapid setup directory.
SampleAppsCPP::HelperFunctions::CheckErrors(controller); // [Helper Function] Check that the axis has been initialize correctly.
SampleAppsCPP::HelperFunctions::StartTheNetwork(controller); // [Helper Function] Initialize the network.
Axis *axis = controller->AxisGet(AXIS_NUMBER); // Initialize Axis Class. (Use RapidSetup Tool to see what is your axis number)
SampleAppsCPP::HelperFunctions::CheckErrors(axis); // [Helper Function] Check that the axis has been initialize correctly.
printf("Hardware Limits Example\n");
// Change Hardware POSITIVE (+) Limit characteristicpp.
axis->HardwarePosLimitActionSet(RSIAction::RSIActionE_STOP); // Set the positive limit action to E_STOP.
printf("\nHardware Positive Limit Action set to %i", axis->HardwarePosLimitActionGet());
axis->HardwarePosLimitTriggerStateSet(ACTIVE_HIGH); // Set the positive limit trigger state to ACTIVE_HIGH.
printf("\nHardware Positive Limit TriggerState set to %i", axis->HardwarePosLimitTriggerStateGet());
axis->HardwarePosLimitDurationSet(HW_POS_DURATION_TIME); // Set the positive limit duration to 0.01 seconds.
printf("\nHardware Positive Limit Duration set to %f seconds", axis->HardwarePosLimitDurationGet());
// Change Hardware NEGATIVE (-) Limit charateristicpp.
axis->HardwareNegLimitActionSet(RSIAction::RSIActionE_STOP); // Set the negative limit action to E_STOP.
printf("\nHardware Negative Limit Action set to %i", axis->HardwareNegLimitActionGet());
axis->HardwareNegLimitTriggerStateSet(ACTIVE_LOW); // Set the negative limit trigger state to ACTIVE_LOW.
printf("\nHardware Negative Limit TriggerState set to %i", axis->HardwareNegLimitTriggerStateGet());
axis->HardwareNegLimitDurationSet(HW_NEG_DURATION_TIME); // Set the negative limit duration to 0.01 seconds.
printf("\nHardware Negative Limit Duration set to %f seconds", axis->HardwareNegLimitDurationGet());
printf("\nAll Hardware Limit characteristicpp set\n");
catch (RsiError const& err)
printf("\n%s\n", err.text);
controller->Delete(); // Delete the controller as the program exits to ensure memory is deallocated in the correct order.
system("pause"); // Allow time to read Console.