APIs, concepts, guides, and more

◆ AmpEnableSet()

int32_t AmpEnableSet ( bool enable,
int32_t ampActiveTimeoutMilliseconds = AmpEnableTimeoutMillisecondsDefault,
bool overrideRestrictedState = false )
Description:
AmpEnableSet enables (or disables) all amplifiers with a timeout to wait for AMP_ACTIVE / OPERATION_ENABLED to go high.
Parameters
enableTrue = enable all, false = disable all.
ampActiveTimeoutMilliseconds(Optional) How many milliseconds to wait for AMP_ACTIVE / OPERATION_ENABLED before timing out (0 will not wait). Default is RapidCodeMotion::AmpEnableTimeoutMillisecondsDefault. Ignored when disabling amp.
overrideRestrictedState(Optional) Set to true to allow enabling the amplifier in restricted states (MOVING, STOPPING, STOPPED). Default is false. When true, the motor may jump to its previous command position if enabled in a restricted state after manual movement. This can cause unexpected motion if the axis has moved due to gravity or external forces while disabled.
Returns
The number of milliseconds waited for AMP_ACTIVE / OPERATION_ENABLED to go high.
Exceptions
RsiErrorwith RSIErrorMessage::RSIMessageTIMEOUT if the amp is not enabled within the ampActiveTimeoutMilliseconds.
RsiErrorwith RSIErrorMessage::RSI_AMP_ENABLE_RESTRICTED_STATE if attempting to enable in MOVING, STOPPING, or STOPPED states when overrideRestrictedState is false.
Attention
For DS402 axes, the RMP firmware will automatically generate an Amp Fault action (default is to Abort) if the AMP_ACTIVE signal does not go high within one second of AmpEnableSet(true). If it fails to enable, the Axis will end in an ERROR state. This value is configurable using RSIAxisAddressType::RSIAxisAddressTypeAMP_ENABLE_AMP_FAULT_TIMEOUT with MotionController::MemoryDoubleGet() and MotionController::MemoryDoubleSet(). The default value is Axis::AmpEnableAmpFaultTimeoutSecondsDefault.
Note
The ampActiveTimeoutMilliseconds parameter controls how long this method waits before returning, while the firmware's RSIAxisAddressType::RSIAxisAddressTypeAMP_ENABLE_AMP_FAULT_TIMEOUT controls when an Amp Fault is generated. These are independent timeouts.

Part of the Action method group.

Sample Code:
ConfigAmpFault
RapidSetup:
Go to axis screen->Axis Status.
Left: Amp Enabled, Right: Amp Disabled
See also
ClearFaults, RSIAxisAddressType::RSIAxisAddressTypeAMP_ENABLE_AMP_FAULT_TIMEOUT, RapidCodeMotion::AmpEnableTimeoutMillisecondsDefault
Examples
AxisConfiguration.cpp, CalculateAccelerationFromVelocity.cpp, DifferenceOfPositionUserLimit.cpp, MotionHoldReleasedBySoftwareAddress.cpp, MultiaxisMotion.cpp, PVTmotionMultiAxis.cpp, PathMotion.cpp, PointToPoint.cpp, RandomWalk.cpp, SingleAxisSyncOutputs.cpp, SyncOutputWithMotion.cpp, UpdateBufferPoints.cpp, axis-config-ampfault.cs, axis-homing-akd-drive.cs, axis-motion-hold-via-address.cs, axis-motion-hold-via-digitalinput.cs, axis-motion-hold-via-position.cs, axis-motion-modify.cs, axis-motion-point-to-point.cs, axis-motion-streaming-pt-whilestopping.cs, axis-motion-streaming-pt.cs, axis-motion-streaming-pvajt.cs, axis-motion-streaming-pvt.cs, axis-motion-velocity-via-analoginput.cs, basic-template.cs, camming.cs, compensator-single-axis.cs, gcode-motion.cs, gearing.cs, mathblock-calculate-acceleration-from-velocity.cs, mathblock-difference-of-position-userlimit.cs, multiaxis-motion-point-to-point.cs, multiaxis-motion-velocity.cs, path-motion.cs, userlimit-command-position-direct.cs, userlimit-estop-store-position.cs, userlimit-feedrate.cs, and userlimit-position-abort.cs.