13#include "SampleAppsHelper.h"
21 const std::string SAMPLE_APP_NAME =
"Axis Configuration";
26 const int NUM_AXES = 1;
27 const int AXIS_INDEX = 0;
54 std::cout <<
"Configuring Amp Fault parameters\n" << std::endl;
57 const double AMP_FAULT_DURATION_TIME = 1;
58 const RSIAction AMP_FAULT_ACTION = RSIAction::RSIActionABORT;
59 const int AMP_FAULT_TRIGGER_STATE = 1;
72 std::cout <<
"Axis Amp Fault parameters have been set" << std::endl;
75 std::cout <<
"Configuring Hardware Limits parameters\n" << std::endl;
79 const int TRIGGER_STATE = 1;
80 const double DURATION = 0.01;
81 const RSIAction ACTION = RSIAction::RSIActionABORT;
102 std::cout <<
"Axis Hardware Limits have been set" << std::endl;
105 std::cout <<
"Configuring Settling parameters\n" << std::endl;
109 const double POSITION_TOLERANCE_FINE = 200;
110 const double POSITION_TOLERANCE_COARSE = 300;
111 const double VELOCITY_TOLERANCE = 12000;
112 const double SETTLING_TIME = 5;
127 std::cout <<
"Axis Settling parameters have been set" << std::endl;
130 std::cout <<
"Configuring Stop Rate parameters\n" << std::endl;
134 const double STOP_RATE_DEFAULT = 1.0;
135 const double ESTOP_RATE_DEFAULT = 0.05;
136 const double ESTOP_DECELERATION_RATE = 1000;
149 std::cout <<
"Axis Stop Rate parameters have been set" << std::endl;
152 std::cout <<
"Configuring User Units parameters\n" << std::endl;
156 const int ENCODER_RESOLUTION_BITS = 20;
157 const double USER_UNITS = std::pow(2, ENCODER_RESOLUTION_BITS);
167 std::cout <<
"Axis User Units have been set" << std::endl;
171 catch (
const std::exception &ex)
173 std::cerr << ex.what() << std::endl;
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.
static MotionController * Create()
Initialize and start the RMP EtherCAT controller.
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.