APIs, concepts, guides, and more

◆ GearingEnable() [2/2]

void GearingEnable ( int32_t masterAxisNumber,
RSIAxisMasterType masterFeedbackSource,
int32_t numerator,
int32_t denominator )
Description:
GearingEnable enables this Axis to be follower (slave) using electronic gearing.
Parameters
masterAxisNumberAn index that represents the master axis.
masterFeedbackSourceA ::RSIAxisMasterType value.
numeratorMultiple of counts that slave follows relative to master.
denominatorDivisor of counts that slave follows relative to master.

Part of the Gearing method group.

Sample Code:
/* This sample demonstrates how to configure electronic gearing between two axes.
The follower axis position is controlled as a ratio of the moving axis position.
Moving Axis: the master axis that drives the motion.
Follower Axis: follows the moving axis at a specified gear ratio.
*/
using RSI.RapidCode; // RSI.RapidCode.dotNET;
Console.WriteLine("📜 Gearing");
// get rmp objects
MotionController controller = MotionController.Get();
// set sample config params
const int NUMERATOR = 2; // for every 1 rotation of moving axis...
const int DENOMINATOR = 1; // ...follower axis rotates 2 times (2:1 ratio)
const double POSITION = 10;
const double VELOCITY = 10;
const double ACCELERATION = 100;
const double DECELERATION = 100;
const double JERK_PERCENT = 50;
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(followerAxis);
// enable phantoms to keep commanded position after motion done
movingAxis.AmpEnableSet(true);
followerAxis.AmpEnableSet(true);
// configure follower axis to gear to moving axis
followerAxis.GearingEnable(
masterAxisNumber: movingAxis.NumberGet(),
masterFeedbackSource: RSIAxisMasterType.RSIAxisMasterTypeAXIS_COMMAND_POSITION, // use COMMAND for phantoms, ACTUAL for real axis
numerator: NUMERATOR,
denominator: DENOMINATOR);
// perform s-curve motion on moving axis
movingAxis.MoveSCurve(POSITION, VELOCITY, ACCELERATION, DECELERATION, JERK_PERCENT);
// wait for motion to complete
movingAxis.MotionDoneWait();
// print results
Console.WriteLine($"Moving axis final position: {movingAxis.CommandPositionGet()}");
Console.WriteLine($"Follower axis final position: {followerAxis.CommandPositionGet()}");
Console.WriteLine($"Gear ratio: {NUMERATOR}:{DENOMINATOR}");
// disable gearing
followerAxis.GearingDisable();
// cleanup
Helpers.AbortMotionObject(followerAxis);
}
// 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
static void AbortMotionObject(RapidCodeMotion motionObject)
Aborts motion on the given RapidCodeMotion object (Axis or MultiAxis), waits for motion to stop,...
Definition _helpers.cs:186
static void CheckErrors(RapidCodeObject rsiObject)
Checks for errors in the given RapidCodeObject and throws an exception if any non-warning errors are ...
Definition _helpers.cs:15
static void PhantomAxisReset(Axis phantomAxis)
Configures a phantom axis on the controller.
Definition _helpers.cs:144
Helpers class provides static methods for common tasks in RMP applications.
Definition _helpers.cs:5
void GearingDisable()
Disable the electronic gearing.
void GearingEnable(int32_t masterAxisNumber, RSIAxisMasterType masterFeedbackSource, int32_t numerator, int32_t denominator)
Enable this Axis to be follower (slave) using electronic gearing.
void MoveSCurve(double position, double vel, double accel, double decel, double jerkPct)
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
Notes:
The gearing ratio will be numerator/denominator.
See also
GearingRatioChange
Examples
gearing.cs.