71using RSI.RapidCode.dotNET;
78public class AxisConfig : SampleAppTestBase
80 [Test, Timeout(Constants.MAX_TEST_TIME)]
81 public void AxisSettling()
90 const double POSITION_TOLERANCE_FINE = 200;
91 const double POSITION_TOLERANCE_COARSE = 300;
92 const double VELOCITY_TOLERANCE = 12000;
93 const double SETTLING_TIME = 5;
110 Assert.That(posTolFine, Is.EqualTo(POSITION_TOLERANCE_FINE),
"The getter function should return a value equal to POSITION_TOLERANCE_FINE");
111 Assert.That(posTolCoarse, Is.EqualTo(POSITION_TOLERANCE_COARSE),
"The getter function should return a value equal to POSITION_TOLERANCE_COARSE");
112 Assert.That(velTol, Is.EqualTo(VELOCITY_TOLERANCE),
"The getter function should return a value equal to VELOCITY_TOLERANCE");
113 Assert.That(setTime, Is.EqualTo(SETTLING_TIME),
"The getter function should return a value equal to SETTLING_TIME");
121 [Test, Timeout(Constants.MAX_TEST_TIME)]
122 public void ConfigAmpFault()
130 const double AMP_FAULT_DURATION_TIME = 1;
147 Assert.That(isEnabled, Is.EqualTo(
false),
"The getter function should return a value equal to false");
148 Assert.That(faultAction, Is.EqualTo(
RSIAction.RSIActionABORT),
"The getter function should return a value equal to RSIActionABORT");
149 Assert.That(faultTriggerState, Is.EqualTo(
false),
"The getter function should return a value equal to false");
150 Assert.That(faultDuration, Is.EqualTo(AMP_FAULT_DURATION_TIME),
"The getter function should return a value equal to AMP_FAULT_DURATION_TIME");
158 [Test, Timeout(Constants.MAX_TEST_TIME)]
159 public void SetUserUnits()
165 const int ENCODER_RESOLUTION_BITS = 20;
169 double USER_UNITS = Math.Pow(2, ENCODER_RESOLUTION_BITS);
180 Assert.That(userUnits, Is.EqualTo(USER_UNITS));
181 Assert.That(userUnits, Is.EqualTo(1048576));
186 [Test, Timeout(Constants.MAX_TEST_TIME)]
187 public void StopRate()
190 const double STOP_RATE = 1.2;
191 const double ESTOP_RATE = 1.3;
192 const double ESTOP_DECELERATION_RATE_T = 1.5;
197 Assert.That(axis.
StopTimeGet(), Is.EqualTo(STOP_RATE));
198 Assert.That(axis.
EStopTimeGet(), Is.EqualTo(ESTOP_RATE));
203 const double STOP_RATE_DEFAULT = 1.0;
204 const double ESTOP_RATE_DEFAULT = 0.05;
205 const double ESTOP_DECELERATION_RATE = 1000;
214 [Test, Timeout(Constants.MAX_TEST_TIME)]
215 public void HardwareLimits()
221 const bool ACTIVE_HIGH =
true;
222 const bool ACTIVE_LOW =
false;
223 const double HW_POS_DURATION_TIME = 0.01;
224 const double HW_NEG_DURATION_TIME = 0.01;
249 Assert.That(hPosLimAct, Is.EqualTo(
RSIAction.RSIActionE_STOP),
"Hardware Positive Limit Action should be set to RSIAction.RSIActionE_STOP");
250 Assert.That(hPosLimTrigState, Is.EqualTo(ACTIVE_HIGH),
"Hardware Positive Limit TriggerState should be set to ACTIVE_HIGH");
251 Assert.That(hPosLimDur, Is.EqualTo(HW_POS_DURATION_TIME),
"Hardware Positive Limit Duration set to HW_POS_DURATION_TIME");
253 Assert.That(hNegLimAct, Is.EqualTo(
RSIAction.RSIActionE_STOP),
"Hardware Positive Limit Action should be set to RSIAction.RSIActionE_STOP");
254 Assert.That(hNegLimTrigState, Is.EqualTo(ACTIVE_LOW),
"Hardware Positive Limit TriggerState should be set to ACTIVE_LOW");
255 Assert.That(hNegLimDur, Is.EqualTo(HW_POS_DURATION_TIME),
"Hardware Positive Limit Duration set to HW_POS_DURATION_TIME");
262 public void PhantomAxis()
269 axis = controller.
AxisGet(axisNumber);
281 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.