mpiAxisCommandOriginSet

Declaration

int32_t mpiAxisCommandOriginSet(MPIAxis  axis,
                               double   command) 

Required Header: axis.h

Description

mpiAxisCommandOriginSet sets the value of the command and actual positions of an axis. mpiAxisCommandOriginSet writes to the controller's axis' origin to adjust the command position so that it equals the commandparameter. The axis' actual position will also be changed by the same amount. Because the origin is an offset from the controller's command and actual positions, the mpiAxisCommandOriginSet will not cause a change to the position error. Thus, if the motor is enabled, it will not jump when mpiAxisCommandOriginSet is called.

mpiAxisCommandOriginSet should not be called when the axis is in a STOPPING, STOPPED, or MOVING state. If called while in these states, mpiAxisCommandOriginSet 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 Command Position will be set
Return Values
MPIMessageOK
MPIMessageARG_INVALID
MPIAxisMessageCOMMAND_NOT_SET

Sample Code

Zero the command and actual postions.

returnValue =
	mpiAxisCommandOriginSet(axis, 0.0);

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

See Also

Origin | MPIMotorDisableAction | AxisActualPositionSet | AxisCommandPositionSet | Controller Positions