MotionController Axis MultiAxis IO IOPoint NetworkNode RsiError
Sample Apps Changelog

RapidCode API

AxisSettling.cpp
#include "rsi.h" // Import our RapidCode Library.
#include "HelperFunctions.h" // Import our SampleApp helper functions.
static void PrintParameters(Axis *axis)
{
printf("Fine Position Tolerance: %f ", axis->PositionToleranceCoarseGet()); // Print fine position tolerance.
printf("Coarse Position Tolerance: %f ", axis->PositionToleranceCoarseGet()); // Print coarse position tolerance.
printf("Velocity Tolerance: %f ", axis->VelocityToleranceGet()); // Print velocity tolerance.
printf("Settling Time: %f \n", axis->SettlingTimeGet()); // Print settling time.
}
void AxisSettlingMain()
{
using namespace RSI::RapidCode;
const int AXIS_NUMBER = 0; // Specify which axis/motor to control.
const int POSITION_TOLERANCE_FINE = 40; // Specify the fine position tolerance.
const int POSITION_TOLERANCE_COARSE = 5; // Specify the coarse position tolerance.
const int VELOCITY_TOLERANCE = 50; // Specify the velocity tolerance.
const int SETTLING_TIME = 10; // Specify the settling time.
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.
try
{
SampleAppsCPP::HelperFunctions::StartTheNetwork(controller); // [Helper Function] Initialize the network.
Axis *axis = controller->AxisGet(AXIS_NUMBER); // Initialize the axis->
SampleAppsCPP::HelperFunctions::CheckErrors(axis); // [Helper Function] Check that the axis has been initialized correctly.
printf("Settling Criteria Example\n");
printf("\nOld Criteria\n");
PrintParameters(axis); // Print current axis settling parameters.
axis->PositionToleranceFineSet(POSITION_TOLERANCE_FINE); // Set fine position tolerance.
axis->PositionToleranceCoarseSet(POSITION_TOLERANCE_COARSE); // Set coarse position tolerance.
axis->VelocityToleranceSet(VELOCITY_TOLERANCE); // Set velocity tolerance.
axis->SettlingTimeSet(SETTLING_TIME); // Set settling time.
printf("\nNew Criteria\n");
PrintParameters(axis); // Print current axis settling parameters.
}
catch (RsiError const& err)
{
printf("%s\n", err.text); // If there are any exceptions/issues this will be printed out.
}
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.
}