Axis Motion Control Functions.
More...
Axis Motion Control Functions.
Execute Point-To-Point Motion according with target (or default) velocity.
- Parameters
-
DevID | Device ID (DevID) |
AxisIndex | Axis Index |
Dir | Direction. 1:Forward, -1:Reverse |
PMaxVel | Input target velocity with a pointer variable. Moreover, input 0 directly for no target velocity, and the driver will get the configuration in axis parameter AXP_VM as the target velocity. |
- Returns
- Return an error code.
If the function is called successfully, the return value is ERR_NEXMOTION_SUCCESS (0). Otherwise, the return value is an error code. All error codes are defined in the header file, NexMotionError.h.
Usage:
- The function can be called for point-to-point motion if the axis is excitation.
- If the axis is homing, the function will return the error code.
- If the axis is in the axis state
AXIS_STATE_STOPPING
, AXIS_STATE_STOPPED
or AXIS_STATE_ERROR
, the function will return the error code. After NMC_AxisResetState() is called to reset the axis to normal excitation (AXIS_STATE_STAND_STILL
), the function can be called for JOG motion successfully.
- After the function is called, the drive will increase/decrease the velocity to the target velocity in accordance with the configuration in the axis parameter
AXP_ACC
, and the axis state will transfer to AXIS_STATE_CONTINUOUS_MOTION
.
- After the target velocity is input with the pointer variable PMaxVel, the axis parameter
AXP_VM
will be modified accordingly. The input target velocity can be 0.
- After the function is called and the target velocity is reached, the bit 8 of the axis status becomes to 0, and the motion is continued at the target velocity.
- If the axis is executing other motions, it will execute the corresponding behavior depended on the axis parameter
AXP_BUFF_PARAM
after the function is called.
- After the function is called, NMC_AxisHalt() can be called to stop the motion.
Examples:
Reference:
- NMC_AxisSetParamI32(), NMC_AxisSetParamF64()
- NMC_AxisResetState()
- NMC_AxisGetStatus()
- NMC_AxisHalt()
Execute Point-To-Point Motion according with target position.
- Parameters
-
DevID | Device ID (DevID) |
AxisIndex | Axis index |
TargetPos | Taget Position (Unit: user unit). The value will be interpreted to absolute or relative distance based on the axis parameter 0x30 (absolute or relative programming). |
PMaxVel | Input the target velocity with a pointer variable. Moreover, input 0 directly for no target velocity, and the driver can plan the motion based on the velocity configuratio of the axis parameter AXP_VM . |
- Returns
- Return an error code.
If the function is called successfully, the return value is ERR_NEXMOTION_SUCCESS (0). Otherwise, the return value is an error code. All error codes are defined in the header file, NexMotionError.h.
Usage:
- The function can be called for point-to-point motion if the axis is excitation.
- If the axis is homing, the function will return the error code.
- If the axis is in the axis state AXIS_STATE_STOPPING, AXIS_STATE_STOPPED or AXIS_STATE_ERROR, the function will return the error code. After NMC_AxisResetState() is called to reset the axis to normal excitation (AXIS_STATE_STAND_STILL), the function can be called for point-to-point motion successfully.
- If the axis is executing other motions, it will execute the corresponding behavior depended on the axis parameter AXP_BUFF_PARAM after the function is called.
- The function can be called to enable the point-to-point motion. After the motion completely, the axis will move to the input target position. If the axis parameter 0x30 (Absolute or relative programming) is set to 1, the target position and the relative distance from the current position shall be input in the function. If the relative distance is set to 0, the target position will be set as an absolute position.
- If the axis is excuting the point-to-point motion, the axis state will transfer to AXIS_STATE_DISCRETE_MOTION. After the axis moves to the target position and there is no successive motion, the bit 9 of axis status will become to 1, and the axis will transfer to the normal excitation (AXIS_STATE_STAND_STILL).
- The drive will plan the velocity curve depended on the axis parameters, AXP_PROF_TYPE, AXP_ACC, AXP_DEC and AXP_JERK.
- The maximum velocity can be input with the pointer variable, PMaxVel. Then the corresponding axis parameter AXP_VM will be modified to the input value, and the velocity plan will be performed accordingly.
- If the pointer variable, PMaxVel, is set to 0, the drive will perform the velocity plan based on the axis parameter AXP_VM as the target velocity.
- If the axis state is AXIS_STATE_STAND_STILL, the function will enable the point-to-point motion immediately after called whether the content of axis parameter AXP_BUFF_PARAM.
- After the function is called and if the axis state is AXIS_STATE_WAIT_SYNC and the axis parameter AXP_BUFF_PARAM is aborting, the motions stored in the motion queue will be removed. Then the point-to-point motion will be stored into the motion queue and wait for trigger signal.
- If the axis has not reach the target position during the point-to-point motion, NMC_AxisHalt() can be called to stop the motion.
Examples:
Reference:
- NMC_AxisSetParamI32(), NMC_AxisSetParamF64()
- NMC_AxisResetState()
- NMC_AxisGetStatus()
- NMC_AxisHalt()