APIs, concepts, guides, and more

◆ MoveCamLinear()

void MoveCamLinear ( int32_t masterAxisNumber,
RSIAxisMasterType masterFeedbackSource,
const double *const masterDistances,
const double *const slavePositions,
int32_t pointCount )
Description:
MoveCamLinear enables this Axis to be linear follower (slave) using an electronic cam.
Parameters
masterAxisNumberWhich Axis is the master? (0 to 31).
masterFeedbackSourceA ::RSIAxisMasterType value.
*masterDistancesRelative distance btween points on the master.
*slavePositionsPosition of the slave at given master distances.
pointCountNumber of points in the cam table.

Part of the Camming method group.

Sample Code:
/* This sample demonstrates how to command nonlinear coordinated motion between two axes.
The follower axis position is controlled as a function of the moving axis position.
Moving Axis: may or may not be controlled by the motion controller.
Follower Axis: controlled by the motion controller as a function of the moving axis.
*/
using RSI.RapidCode; // RSI.RapidCode.dotNET;
Console.WriteLine("📜 Camming");
// set sample config params
const double MOVING_POSITION = 25; // total distance to move on moving axis
// get rmp objects
MotionController controller = MotionController.Get();
try
{
Helpers.CheckErrors(controller);
// get axes
Axis movingAxis = controller.AxisGet(Constants.AXIS_0_INDEX);
Helpers.CheckErrors(movingAxis);
Axis followerAxis = controller.AxisGet(Constants.AXIS_1_INDEX);
Helpers.CheckErrors(followerAxis);
// configure phantom axes
Helpers.PhantomAxisReset(movingAxis);
Helpers.PhantomAxisReset(followerAxis);
// enable phantoms to keep commanded position after motion done
movingAxis.AmpEnableSet(true);
followerAxis.AmpEnableSet(true);
// cam profile - relative moving axis distances and absolute follower positions
double[] movingAxisDistances = [4, 8, 12]; // relative distances on moving axis (x-axis) (4 + 8 + 12 = 24)
double[] followerAxisPositions = [10, 20, 15]; // absolute positions for follower axis (y-axis)
// command cam motion on follower before moving axis starts
followerAxis.MoveCamLinear(
masterAxisNumber: movingAxis.NumberGet(),
masterFeedbackSource: RSIAxisMasterType.RSIAxisMasterTypeAXIS_COMMAND_POSITION, // use COMMAND for phantoms, ACTUAL for real axis
masterDistances: movingAxisDistances,
slavePositions: followerAxisPositions,
pointCount: movingAxisDistances.Length);
// command motion on moving axis
movingAxis.MoveRelative(MOVING_POSITION);
// wait for cam motion to complete
followerAxis.MotionDoneWait();
// print results
Console.WriteLine($"Moving axis final position: {movingAxis.CommandPositionGet()}");
Console.WriteLine($"Follower final position: {followerAxis.CommandPositionGet()}");
// cleanup
Helpers.AbortMotionObject(followerAxis);
Helpers.AbortMotionObject(movingAxis);
}
// handle errors as needed
finally
{
controller.Delete(); // dispose
}
Constants used in the C# sample apps.
Definition _constants.cs:3
const int AXIS_0_INDEX
Default: 0.
Definition _constants.cs:11
const int AXIS_1_INDEX
Default: 1.
Definition _constants.cs:12
void MoveCamLinear(int32_t masterAxisNumber, RSIAxisMasterType masterFeedbackSource, const double *const masterDistances, const double *const slavePositions, int32_t pointCount)
Enable this Axis to be linear follower (slave) using an electronic cam.
void MoveRelative(double relativePosition, double vel, double accel, double decel, double jerkPct)
Command a relative point-to-point S-Curve motion.
Represents a single axis of motion control. This class provides an interface for commanding motion,...
Definition rsi.h:5863
int32_t MotionDoneWait()
Waits for a move to complete.
int32_t AmpEnableSet(bool enable, int32_t ampActiveTimeoutMilliseconds=AmpEnableTimeoutMillisecondsDefault, bool overrideRestrictedState=false)
Enable all amplifiers.
int32_t NumberGet()
Get the axis number.
RSIAxisMasterType
Sources available to a slave Axis for electronic gearing & camming.
Definition rsienums.h:1218
Helpers namespace provides utility functions for common tasks in RMP applications.
Definition helpers.h:21
Notes:
MoveCamLinear is only functional in RapidCode 03.03.XX releases.
See also
MoveCamCubic, FrameBufferSizeGet and FrameBufferSizeSet
Examples
camming.cs.