37using RSI.RapidCode.dotNET;
48class MultiAxisMotion : StaticMemoryTestBase
51 public void MultiAxisVelocityMotion()
59 const int NUM_OF_AXES = 6;
65 double[] accelerations =
new double[6] { 1000, 1000, 1000, 1000, 1000, 1000 };
66 double[] velocities =
new double[6];
67 Random rnd =
new Random();
69 Axis x_axis = controller.
AxisGet(Constants.X_AXIS_NUMBER);
70 Axis y_axis = controller.
AxisGet(Constants.Y_AXIS_NUMBER);
71 Axis z_axis = controller.
AxisGet(Constants.Z_AXIS_NUMBER);
72 Axis a_axis = controller.
AxisGet(Constants.A_AXIS_NUMBER);
73 Axis b_axis = controller.
AxisGet(Constants.B_AXIS_NUMBER);
74 Axis c_axis = controller.
AxisGet(Constants.C_AXIS_NUMBER);
99 for (i = 0; i < cycles; i++)
101 int random_vel1 = rnd.Next(1, 100);
102 int random_vel2 = rnd.Next(1, 100);
103 int random_vel3 = rnd.Next(1, 100);
104 int random_vel4 = rnd.Next(1, 100);
105 int random_vel5 = rnd.Next(1, 100);
106 int random_vel6 = rnd.Next(1, 100);
108 velocities =
new double[6] {random_vel1,
117 System.Threading.Thread.Sleep(100);
125 public void PointToPointMultiAxisMotion()
129 const int NUM_OF_AXES = 2;
132 double[] positions1 =
new double[NUM_OF_AXES] { 5, 10 };
133 double[] positions2 =
new double[NUM_OF_AXES] { 15, 15 };
134 double[] velocities1 =
new double[NUM_OF_AXES] { 1000, 1000 };
135 double[] velocities2 =
new double[NUM_OF_AXES] { 1000, 1000 };
136 double[] accelerations =
new double[NUM_OF_AXES] { 500, 500 };
137 double[] decelerations =
new double[NUM_OF_AXES] { 500, 500 };
138 double[] jerkPercent =
new double[NUM_OF_AXES] { 50, 50 };
143 Axis axis0 = controller.
AxisGet(Constants.X_AXIS_NUMBER);
144 Axis axis1 = controller.
AxisGet(Constants.Y_AXIS_NUMBER);
169 multi.
MoveSCurve(positions1, velocities1, accelerations, decelerations, jerkPercent);
173 Assert.That(axis0.
CommandPositionGet(), Is.EqualTo(positions1[0]),
"The first axis in the multi axis object should be commanded to move to the firt element of the array");
174 Assert.That(axis1.
CommandPositionGet(), Is.EqualTo(positions1[1]),
"The second axis in the multi axis object should be commanded to move to the second element of the array");
176 multi.
MoveTrapezoidal(positions2, velocities2, accelerations, decelerations);
180 Assert.That(axis0.
CommandPositionGet(), Is.EqualTo(positions2[0]),
"The first axis in the multi axis object should be commanded to move to the firt element of the array");
181 Assert.That(axis1.
CommandPositionGet(), Is.EqualTo(positions2[1]),
"The second axis in the multi axis object should be commanded to move to the second element of the array");
static void CheckErrors(RapidCodeObject rsiObject)
Check if the RapidCodeObject has any errors.
Helper Functions for checking logged creation errors, starting the network, etc.
double CommandPositionGet()
Get the current command position.
void ErrorLimitActionSet(RSIAction action)
Set the action that will occur when the Error Limit Event triggers.
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 MotionCountSet(int32_t motionCount)
Set the number of processed Motion Supervisors in the controller.
MultiAxis * MultiAxisGet(int32_t motionSupervisorNumber)
MultiAxisGet returns a pointer to a MultiAxis object and initializes its internals.
void AxisCountSet(int32_t axisCount)
Set the number of allocated and processed axes in the controller.
void MoveTrapezoidal(const double *const position, const double *const vel, const double *const accel, const double *const decel)
Point-to-point trapezoidal move.
void AxisRemoveAll()
Remove all axes from a MultiAxis group.s.
void MoveSCurve(const double *const position, const double *const vel, const double *const accel, const double *const decel, const double *const jerkPct)
Point-to-point S-Curve Move.
void MoveVelocity(const double *const velocity, const double *const accel)
Velocity move.
void AxisAdd(Axis *axis)
Add an Axis to a MultiAxis group.
Represents multiple axes of motion control, allows you to map two or more Axis objects together for e...
void ClearFaults()
Clear all faults for an Axis or MultiAxis.
void AmpEnableSet(bool enable)
Enable all amplifiers.
void Abort()
Abort an axis.
int32_t MotionDoneWait()
Waits for a move to complete.
RSIAction
Action to perform on an Axis.