mpiAxisCommandPositionSet

Declaration

int32_t mpiAxisCommandPositionSet(MPIAxis  axis,
                               double   command) 

Required Header: axis.h

Description

mpiAxisCommandPositionSet sets the value of the command position of an Axis (axis) from command. The motor will servo directly to the new command position the next servo sample after the new command position is set. This change in position will not be gradual or controlled, as it is in mpiMotionSimpleTrapezoidalMove (for example). Use one of the motion methods (e.g. mpiMotionSimpleTrapezoidalMove) for controlled, gradual motion.

mpiAxisCommandPositionSet should not be called when the axis is in a STOPPING, STOPPED, or MOVING state. If called while in these states, mpiAxisCommandPostionSet will not set the command position and return a MPIAxisMessageCOMMAND_NOT_SET error which is necessary to protect the application from conflicting with the controller's trajectory generation.

axis a handle to an Axis object.
command value to which the Actual command position will be set
Return Values
MPIMessageOK
MPIMessageARG_INVALID
MPIAxisMessageCOMMAND_NOT_SET

Remarks

Setting the Axis Actual Position causes the axis to jump if the ampEnable is enabled. See the discussion of the Axis Origin before using the mpiAxisActualPositionSet(...) and mpiAxisCommandPositionSet(...) methods.

Sample Code

Zero the command and actual postions.

returnValue =
	mpiAxisCommandPositionSet(axis, 0.0);

if (returnValue == MPIMessageOK) {
	returnValue =
		mpiAxisActualPositionSet(axis, 0.0);
}

See Also

MPIMotorDisableAction | AxisActualPositionSet | AxisCommandOriginSet | Controller Positions