#include <cmath>
#include "SampleAppsHelper.h"
#include "rsi.h"
int main()
{
const std::string SAMPLE_APP_NAME = "Axis Configuration";
const int NUM_AXES = 1;
const int AXIS_INDEX = 0;
int exitCode = -1;
try
{
std::cout << "Configuring Amp Fault parameters\n" << std::endl;
const double AMP_FAULT_DURATION_TIME = 1;
const RSIAction AMP_FAULT_ACTION = RSIAction::RSIActionABORT;
const int AMP_FAULT_TRIGGER_STATE = 1;
std::cout << "Axis Amp Fault parameters have been set" << std::endl;
std::cout << "Configuring Hardware Limits parameters\n" << std::endl;
const int TRIGGER_STATE = 1;
const double DURATION = 0.01;
const RSIAction ACTION = RSIAction::RSIActionABORT;
std::cout << "Axis Hardware Limits have been set" << std::endl;
std::cout << "Configuring Settling parameters\n" << std::endl;
const double POSITION_TOLERANCE_FINE = 200;
const double POSITION_TOLERANCE_COARSE = 300;
const double VELOCITY_TOLERANCE = 12000;
const double SETTLING_TIME = 5;
std::cout << "Axis Settling parameters have been set" << std::endl;
std::cout << "Configuring Stop Rate parameters\n" << std::endl;
const double STOP_RATE_DEFAULT = 1.0;
const double ESTOP_RATE_DEFAULT = 0.05;
const double ESTOP_DECELERATION_RATE = 1000;
std::cout << "Axis Stop Rate parameters have been set" << std::endl;
std::cout << "Configuring User Units parameters\n" << std::endl;
const int ENCODER_RESOLUTION_BITS = 20;
const double USER_UNITS = std::pow(2, ENCODER_RESOLUTION_BITS);
std::cout << "Axis User Units have been set" << std::endl;
exitCode = 0;
}
catch (const std::exception &ex)
{
std::cerr << ex.what() << std::endl;
exitCode = -1;
}
return exitCode;
}
void HardwareNegLimitActionSet(RSIAction action)
Set the action that will occur when the Hardware Negative Limit Event triggers.
RSIAction AmpFaultActionGet()
Get the Amp Fault action.
double SettlingTimeGet()
Get the Settling time.
void HardwareNegLimitDurationSet(double seconds)
Set the duration required before the Hardware Negative Limit event triggers.
void HardwarePosLimitActionSet(RSIAction action)
Set the action that will occur when the Hardware Positive Limit Event triggers.
void PositionToleranceCoarseSet(double tolerance)
Set the Coarse Position Tolerance for Axis settling.
double UserUnitsGet()
Get the number of counts per User Unit.
double PositionToleranceFineGet()
Get the Fine Position Tolerance for axis settling.
RSIAction HardwarePosLimitActionGet()
Get the action that will occur when the Hardware Positive Limit Event triggers.
void HardwarePosLimitTriggerStateSet(bool state)
sets the trigger state.
void UserUnitsSet(double countsPerUserUnit)
Sets the number of counts per User Unit.
void AmpFaultActionSet(RSIAction action)
Set the Amp Fault action.
void AmpFaultTriggerStateSet(bool state)
Set the trigger state of the Amp Fault input.
void PositionToleranceFineSet(double tolerance)
Set the Fine Position Tolerance for Axis settling.
double AmpFaultDurationGet()
Get the duration required before the Amp Fault event triggers.
double HardwareNegLimitDurationGet()
Get the duration required before the Hardware Negative Limit event triggers.
bool HardwarePosLimitTriggerStateGet()
trigger state return.
void HardwarePosLimitDurationSet(double seconds)
Set the duration required before the Hardware Positive Limit event triggers.
void VelocityToleranceSet(double tolerance)
Set the Velocity Tolerance used for settling.
double PositionToleranceCoarseGet()
Get the Coarse Position Tolerance for axis settling.
double EStopDecelerationGet()
Get the deceleration rate for an E-Stop, Modify Event.
bool AmpFaultTriggerStateGet()
Get the Amp Fault trigger state.
double VelocityToleranceGet()
Get the velocity tolerance used for settling.
void EStopDecelerationSet(double decel)
Set the deceleration rate for an E-Stop, Modify Event.
bool HardwareNegLimitTriggerStateGet()
Trigger state return.
double HardwarePosLimitDurationGet()
Get the duration required before the Hardware Positive Limit event triggers.
void AmpFaultDurationSet(double seconds)
Set the duration required before the Amp Fault event triggers.
RSIAction HardwareNegLimitActionGet()
Get the action that will occur when the Hardware Negative Limit Event triggers.
void HardwareNegLimitTriggerStateSet(bool state)
Sets the trigger state.
void SettlingTimeSet(double time)
Set the settling time.
Represents a single axis of motion control. This class provides an interface for commanding motion,...
Axis * AxisGet(int32_t axisNumber)
AxisGet returns a pointer to an Axis object and initializes its internals.
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...
void AmpEnableSet(bool enable)
Enable all amplifiers.
void StopTimeSet(double seconds)
Set the deceleration time for a Stop Event.
double EStopTimeGet()
Get E-Stop Event deceleration time.
void EStopTimeSet(double seconds)
Set the deceleration time for an E-Stop Event.
double StopTimeGet()
Get Stop Event deceleration time.
RSIAction
Action to perform on an Axis.
static void PrintFooter(std::string sampleAppName, int exitCode)
Print a message to indicate the sample app has finished and if it was successful or not.
static void CheckErrors(RapidCodeObject *rsiObject)
Checks for errors in the given RapidCodeObject and throws an exception if any non-warning errors are ...
static void PrintHeader(std::string sampleAppName)
Print a start message to indicate that the sample app has started.
static void Cleanup(MotionController *controller)
Cleanup the controller and restore the object counts to the original values.
static MotionController::CreationParameters GetCreationParameters()
Returns a MotionController::CreationParameters object with user-defined parameters.
static void SetupController(MotionController *controller, int numAxes=0)
Setup the controller with user defined axis counts and configuration.
CreationParameters for MotionController::Create.