How Motion Completion Events are Generated

There are three types of generated events related to motion completion: DONE, AT_VELOCITY, and IN_POSITION_COARSE. Motion completion for a position move is indicated by a DONE event, while motion completion for a velocity move is indicated by an AT_VELOCITY event.

AT_VELOCITY is not generated for position moves. For both position moves and velocity moves, the MPI uses a settling time window to determine when to generate a motion completed event (to indicate that motion has finished on an axis).

For position moves, the MPI uses the settling time window to determine when an axis has reached the final target location and is stable.

For velocity moves, the MPI uses the settling time window to determine when an axis has reached the final velocity. This works because during ringing, the velocity is highest when the position error is lowest. (Velocity and position error are inversely-related.)

 
Position and Velocity criteria for generating motion completion events
For a
A "motion completed" event is generated when
Criteria
Position move
ABS(position error) < inPosition.tolerance.positionFine position
Position move ABS(velocity error) < inPosition.tolerance.velocity velocity
Velocity move ABS(velocity error) < inPosition.tolerance.velocity velocity

where:  
  position error = (command position - actual position)
  velocity error = (command velocity - actual velocity)

 

For Position Moves
A DONE event is generated after a position move only after both the position and velocity criteria have been met for the period specified by the settling time. To determine if motion has completed, position moves use both position and velocity criteria.

The default (factory) value for inPosition.tolerance.velocity is 20,000,000 counts/sec. We included the ability to additionally use the velocity criteria for position moves because some users prefer to decide that an axis is "settled" only after the position error and actual velocity are both low enough.

 

For Velocity Moves
An AT_VELOCITY event is generated for a velocity move only after the velocity criteria has been met for the period specified by the settling time. To determine if motion has completed, velocity moves use only the velocity criteria (they don't use the position criteria).

Note that the motion completed event generated this time is an AT_VELOCITY event rather than a DONE event. For velocity moves, DONE events will only occur after mpiMotionAction(..., MPIActionSTOP) calls.

You can also use the velocity criteria to determine when ringing has stopped after an open loop commutation move. To do this, the position criteria is effectively disabled by setting the position tolerance to a very large value (e.g., 1.0E10). After that, the DONE event following a move is determined entirely by the velocity tolerance and settling time, and, therefore, the event will be generated only after the ringing has stopped.

Be aware that setting inPosition.tolerance.velocity to 0 does not disable the velocity criteria. For interpolated scales, setting inPosition.tolerance.velocity to 0 makes it very difficult to meet the criteria of 0 counts of motion for settlingTime seconds.

Settling Time Parameters

Four Settling Time Parameters

For position moves, the generation of DONE events depends on three parameters:

MPIAxisConfig.inPosition.settlingTime
MPIAxisConfig.inPosition.positionFine
MPIAxisConfig.inPosition.velocity

DONE events are only generated when command = target or after STOP, ESTOP or ABORT events.

For velocity moves, the generation of AT_VELOCITY events depends on two parameters:

MPIAxisConfig.inPosition.settlingTime
MPIAxisConfig.inPosition.velocity

The settlingTime value specifies the amount of time (seconds) that a motion must be within the positionFine band, in order for the motion to be considered complete (finished).

The positionFine parameter is a tolerance (encoder counts), where we know a motion is complete if the motion settles within this tolerance.

The velocity parameter specifies a band around the target velocity for velocity moves.

A fourth parameter (MPIAxisConfig.inPosition.positionCoarse) specifies a band around the final position. Optionally, an interrupt can be triggered when the motion is in the positionFine band, but not necessarily complete (finished). In this case, the interrupt becomes an early warning of motion that is about to finish (i.e., mostly finished).