42using RSI.RapidCode.dotNET;
46using System.Threading;
56public class PathMotion : SampleAppTestBase
65 public void Teardown()
73 jointsMultiAxis?.
Abort();
80 var actualUnits = model.UnitsGet();
81 Assert.That(actualUnits, Is.EqualTo(expectedUnits), $
"Expected model units to be '{expectedUnits}' but was '{actualUnits}' instead!");
82 var actualName = model.NameGet();
83 Assert.That(actualName, Is.EqualTo(expectedName), $
"Expected model name to be '{expectedName}' but was '{actualName}' instead!");
87 public void GantryPrimeAxis()
93 const string xLabel =
"X-Axis";
94 const string yLabel =
"Y-Axis";
95 const string primeLabel =
"Y-Prime";
106 Axis[] axes =
new Axis[] { x_axis, y_axis, prime_axis };
107 jointsMultiAxis.
AxesAdd(axes, axes.Length);
110 const string modelName =
"RSI_XY_Yp";
111 const double scaling = 1.0, offset = 0.0;
119 const int motionFrameBufferSize = 50;
120 robot =
Robot.
RobotCreate(controller, jointsMultiAxis, builder, motionFrameBufferSize);
124 VerifyModel(robot.
ModelGet(), units, modelName);
127 [Test, Timeout(Constants.MAX_TEST_TIME)]
128 public void SimplePathMotion()
132 const string xLabel =
"X-Axis";
133 const string yLabel =
"Y-Axis";
134 const string zLabel =
"Z-Axis";
135 const string aLabel =
"A-Axis";
136 const string bLabel =
"B-Axis";
137 const string cLabel =
"C-Axis";
154 Axis[] axes =
new Axis[] { x_axis, y_axis, z_axis, a_axis, b_axis, c_axis };
155 jointsMultiAxis.
AxesAdd(axes, axes.Length);
159 const string modelName =
"RSI_XYZABC_Meters";
160 const double scaling = 1.0, offset = 0.0;
188 VerifyModel(robot.
ModelGet(), units, modelName);
192 public void ChangingUnits()
196 const string xLabel =
"X-Axis";
197 const string yLabel =
"Y-Axis";
198 const string zLabel =
"Z-Axis";
199 const string aLabel =
"A-Axis";
200 const string bLabel =
"B-Axis";
201 const string cLabel =
"C-Axis";
218 Axis[] axes =
new Axis[] { x_axis, y_axis, z_axis, a_axis, b_axis, c_axis };
219 jointsMultiAxis.
AxesAdd(axes, axes.Length);
222 const string modelName =
"RSI_XYZABC_Millimeters";
223 const double scaling = 1.0, offset = 0.0;
254 VerifyModel(robot.
ModelGet(), units, modelName);
257 public void PathPoint()
260 const ulong frameCount = 500;
261 ulong totalFrames = frameCount;
262 ulong startFrame = 0;
264 while (totalFrames == frameCount)
267 totalFrames = positions.Size();
273 double xCoord = spatial.
X, yCoord = spatial.
Y, zCoord = spatial.
Z;
283 startFrame += totalFrames;
static void CheckErrors(RapidCodeObject rsiObject)
Check if the RapidCodeObject has any errors.
Helper Functions for checking logged creation errors, starting the network, etc.
void UserLabelSet(const char *const userLabel)
Set the axis User defined Label.
Represents a single axis of motion control. This class provides an interface for commanding motion,...
void UnitsSet(LinearUnits units)
Set the units the built model will use.
Describes the mathematical kinematic model of a robot.
The Builder for a linear kinematic model. Constructs a single Linear Kinematic Model to use when crea...
void JointAdd(const LinearJointMapping &joint)
adds a joint to the model using the configuration specified within the LinearJoint structure.
Vector3d Position
The position component of the Pose.
Quaternion Orientation
The orientation component of the Pose.
Quaternion for representing rotations.
uint64_t MotionDoneWait()=0
Waits for a move to complete.
RapidVector< RobotPosition > PathPlannedPositionsGet(uint64_t startFrame, uint64_t frameCount)=0
Get Positions (see RobotPosition) representing the planned motion in cartesian space that will happen...
void PathVelocitySet(double unitsPerSecond)=0
Sets the target linear cartesian velocity for each move (UserUnits/second).
bool IsRunning()=0
Returns whether or not the robot is in motion (from executor or other source). Can be used to determi...
double PathLinearScalingGet() const =0
Gets scaling between input to path motion and output of path motion to the kinematic model.
static Robot * RobotCreate(MotionController *controller, MultiAxis *multiAxis, KinematicModelBuilder *builder, uint32_t motionFrameBufferSize)
Create a Robot object to use G-Code, path motion, etc.
void PathAccelerationSet(double unitsPerSecondSquared)=0
Sets the target acceleration for the machine (UserUnits/second^2). Should be set appropriately based ...
LinearUnits PathUnitsGet() const =0
Gets the units of path motion.
void PathArc(const Pose &target, double radius, RotationDirection direction)=0
Appends an arc on to the current on the PathPlaneGet() plane XY by default.
void PathUnitsSet(LinearUnits units)=0
Defines the units Cartesian Path Motion is in.
void PathLine(const Pose &target)=0
void EStop()=0
Commands a joint EStop and clears the loaded moves.
void PathProgrammingModeSet(PathMode mode)=0
Sets the programming mode (Relative/Absolute).
void Run()=0
Run the loaded path lines/arcs. The behavior is non-blocking. Use Robot.MotionDoneWait() to block.
Represents a collection of joints in Cartesian space with forward and inverse kinematics....
void ClearFaults()=0
Clears the MultiAxis fault then the Robot's error bit.
const KinematicModel & ModelGet()=0
Get the model this robot was created with Visit our Topic Page for more information.
static void RobotDelete(MotionController *controller, Robot *robot)
Delete a Robot.
A representation of the robot containing the Pose and the positions of the free axes.
Pose Pose
The Robot's Pose.
Vector3d is used for three-dimensional points and vectors.
double Z
The Z coordinate.
double X
The X coordinate.
double Y
The Y coordinate.
static constexpr int32_t AxisFrameBufferSizeDefault
The default value of the AxisFrameBufferSize, also the minimum allowable value.
Represents the RMP soft motion controller. This class provides an interface to general controller con...
void AxisRemoveAll()
Remove all axes from a MultiAxis group.s.
void AxesAdd(Axis **axes, int32_t axisCount)
void ClearFaults()
Clear all faults for an Axis or MultiAxis.
void AmpEnableSet(bool enable)
Enable all amplifiers.
void Abort()
Abort an axis.
PathMode
Motion types. For G-code use and Cartesian path motion.
CartesianAxis
This enum specifies which Cartesian axis a LinearJointMapping maps a robot joint to.
RotationDirection
Rotational directions about an axis.
LinearUnits
Unit types. For G-code use.