Please enable JavaScript to view this site.

Function that performs the movement of a generic unit, moving initially at a certain speed, to a target point to be reached with desired cruising speed and final speed.

Syntax

real mv_to_vel (i32 return, real pAct, real vAct, real pDes, real vDes, real vFin, real baseTime, real acc [, real dec=acc] [, real perc=0.8])

return

Variable containing information about the status of the function (see returns codes).

Value

Description

-5 [M_ILLEGAL_ARGS]

Illegal parameter(acc=0 or baseTime=0)

13 [M_OVERSHOOTING]

Target exceeded. The move proceeds inertially

-4 [M_LOW_ACCELERATION]

Too fast to reach target point with specified vFin

6 [M_REACHED]

Target point reached (applies only if you have specified vFin=0)

15 [M_ACCEL]

Acceleration in progress

16 [M_AT_SPEED]

Motion at speed with vDes

17 [M_DECEL]

Deceleration in progress

18 [M_LAST_CYCLE]

Last cycle before passing target

pAct

Current position

vAct

Current speed

pDes

Position to be reached

vDes

Desired speed (intended in absolute value)

vFin

Final speed (intended in absolute value)

baseTime

Time base (normally SI)

acc

Desired acceleration (intended in absolute value)

dec

Desired deceleration (intended in absolute value). (optional, default acc)

perc

Percentage value affecting deceleration (0-1). (optional, default 0.8)

During arrival calculations at the target point, the number of samplings required to arrive from the current position to the desired position with the specified velocity vFin is evaluated. This number is truncated to the lower integer if the remainder is < perc (so the actual deceleration will be a little larger than dec) or will be increased to the next integer if the remainder is > perc (lower resultant deceleration)

Result

Updated position value

Validity

Rule

Note

vFin is understood to agree with the direction of the requested movement (if pDes > pAct, vFin is understood to be positive, otherwise it is understood to be negative).

Updating the velocity vAct must be done externally to the function by the user

If vFin > 0, the target position is passed, after which the function continues inertially as long as it is invoked. If vFin = 0, the function stops at the desired point.

If the deceleration parameter does not allow it to get from pAct to pDes with the specified vFin, mv_to_vel() still tends to reach vFin; pDes will be passed with a speed other than vFin, and the movement will continue inertially with speed tending progressively toward vFin.

NOTE: The function can also be called with the axis already in motion.

 

  

Keyboard Navigation

F7 for caret browsing
Hold ALT and press letter

This Info: ALT+q
Page Header: ALT+h
Topic Header: ALT+t
Topic Body: ALT+b
Contents: ALT+c
Search: ALT+s
Exit Menu/Up: ESC