65using RSI.RapidCode.dotNET;
72public class AxisConfig : SampleAppTestBase
74 [Test, Timeout(Constants.MAX_TEST_TIME)]
75 public void AxisSettling()
84 const double POSITION_TOLERANCE_FINE = 200;
85 const double POSITION_TOLERANCE_COARSE = 300;
86 const double VELOCITY_TOLERANCE = 12000;
87 const double SETTLING_TIME = 5;
104 Assert.That(posTolFine, Is.EqualTo(POSITION_TOLERANCE_FINE),
"The getter function should return a value equal to POSITION_TOLERANCE_FINE");
105 Assert.That(posTolCoarse, Is.EqualTo(POSITION_TOLERANCE_COARSE),
"The getter function should return a value equal to POSITION_TOLERANCE_COARSE");
106 Assert.That(velTol, Is.EqualTo(VELOCITY_TOLERANCE),
"The getter function should return a value equal to VELOCITY_TOLERANCE");
107 Assert.That(setTime, Is.EqualTo(SETTLING_TIME),
"The getter function should return a value equal to SETTLING_TIME");
115 [Test, Timeout(Constants.MAX_TEST_TIME)]
116 public void ConfigAmpFault()
124 const double AMP_FAULT_DURATION_TIME = 1;
141 Assert.That(isEnabled, Is.EqualTo(
false),
"The getter function should return a value equal to false");
142 Assert.That(faultAction, Is.EqualTo(
RSIAction.RSIActionABORT),
"The getter function should return a value equal to RSIActionABORT");
143 Assert.That(faultTriggerState, Is.EqualTo(
false),
"The getter function should return a value equal to false");
144 Assert.That(faultDuration, Is.EqualTo(AMP_FAULT_DURATION_TIME),
"The getter function should return a value equal to AMP_FAULT_DURATION_TIME");
152 [Test, Timeout(Constants.MAX_TEST_TIME)]
153 public void SetUserUnits()
159 const int ENCODER_RESOLUTION_BITS = 20;
163 double USER_UNITS = Math.Pow(2, ENCODER_RESOLUTION_BITS);
174 Assert.That(userUnits, Is.EqualTo(USER_UNITS));
175 Assert.That(userUnits, Is.EqualTo(1048576));
180 [Test, Timeout(Constants.MAX_TEST_TIME)]
181 public void StopRate()
184 const double STOP_RATE = 1.2;
185 const double ESTOP_RATE = 1.3;
186 const double ESTOP_DECELERATION_RATE_T = 1.5;
191 Assert.That(axis.
StopTimeGet(), Is.EqualTo(STOP_RATE));
192 Assert.That(axis.
EStopTimeGet(), Is.EqualTo(ESTOP_RATE));
197 const double STOP_RATE_DEFAULT = 1.0;
198 const double ESTOP_RATE_DEFAULT = 0.05;
199 const double ESTOP_DECELERATION_RATE = 1000;
208 [Test, Timeout(Constants.MAX_TEST_TIME)]
209 public void HardwareLimits()
215 const bool ACTIVE_HIGH =
true;
216 const bool ACTIVE_LOW =
false;
217 const double HW_POS_DURATION_TIME = 0.01;
218 const double HW_NEG_DURATION_TIME = 0.01;
243 Assert.That(hPosLimAct, Is.EqualTo(
RSIAction.RSIActionE_STOP),
"Hardware Positive Limit Action should be set to RSIAction.RSIActionE_STOP");
244 Assert.That(hPosLimTrigState, Is.EqualTo(ACTIVE_HIGH),
"Hardware Positive Limit TriggerState should be set to ACTIVE_HIGH");
245 Assert.That(hPosLimDur, Is.EqualTo(HW_POS_DURATION_TIME),
"Hardware Positive Limit Duration set to HW_POS_DURATION_TIME");
247 Assert.That(hNegLimAct, Is.EqualTo(
RSIAction.RSIActionE_STOP),
"Hardware Positive Limit Action should be set to RSIAction.RSIActionE_STOP");
248 Assert.That(hNegLimTrigState, Is.EqualTo(ACTIVE_LOW),
"Hardware Positive Limit TriggerState should be set to ACTIVE_LOW");
249 Assert.That(hNegLimDur, Is.EqualTo(HW_POS_DURATION_TIME),
"Hardware Positive Limit Duration set to HW_POS_DURATION_TIME");
256 public void PhantomAxis()
263 axis = controller.
AxisGet(axisNumber);
275 const double positionToleranceMax = Double.MaxValue / 10.0;
static void CheckErrors(RapidCodeObject rsiObject)
Check if the RapidCodeObject has any errors.
Helper Functions for checking logged creation errors, starting the network, etc.
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.
bool AmpEnableGet()
Get the state of the Amp Enable Output.
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 SoftwareNegLimitActionSet(RSIAction action)
Set the action that will occur when the Software Negative Limit Event triggers.
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 HomeActionSet(RSIAction action)
Set the action that will occur when the Home Event triggers.
void ErrorLimitTriggerValueSet(double triggerValue)
Set the Position Error Limit trigger value.
void PositionToleranceFineSet(double tolerance)
Set the Fine Position Tolerance for Axis settling.
void ErrorLimitActionSet(RSIAction action)
Set the action that will occur when the Error Limit Event triggers.
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.
void MotorTypeSet(RSIMotorType type)
Set the motor type.
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.
void SoftwarePosLimitActionSet(RSIAction action)
Set the action that will occur when the Software Positive Limit Event triggers.
Axis * AxisGet(int32_t axisNumber)
AxisGet returns a pointer to an Axis object and initializes its internals.
int32_t AxisCountGet()
Get the number of axes processing.
void AxisCountSet(int32_t axisCount)
Set the number of allocated and processed axes in the controller.
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.