# MC_MoveAbsolute(0) 4 th Order Real-Time Trajectory Generation Function Algorithm and Implementation
## 1 Introduction  
Servo drive systems are exploited widely in industries due to their efficiency, high-performance in motion control, and fast response times to dynamic reference signals [1; 2]. In order to comply with the technological requirements, modern automatic machines have to guarantee decent dynamics for position and velocity control of motors, these servo drives solutions are utilized in Computer Numerically Controlled (CNC) machining, robotics, factory automation, and many other areas.  
The most common control scheme implemented in servo drives to control position and velocity is the cascade control algorithm [3]. Its task is to regulate current, velocity, and position of the motor in separate closed control loops, in order to minimize overshoot and reduce the influence of external disturbances.  
Nowadays, an increasing number of commercial control system manufacturers provide open architecture systems [4], meeting the need to constantly improve the servo drives functionality. This approach allows for design, testing, and integration of new control algorithms and techniques such as control laws, multi-sensor integration, or Artificial Intelligence (AI).  
Simultaneously, evolution of the servo drive system programming languages is progressing. Currently, most of the commercial systems allow the user to implement custom code in the nativecontrol structure. These modifications can be written in popular programming languages such as C, C++, or Structured Text (ST).  
Automatic code generation [5] is one of the ideas which facilitates implementing the code in various industrial control platforms. It is based on text languages (C, ST) and allows to compile and transfer developed code or algorithms between devices of different classes and manufacturers with minimal effort on the programmer's part.  
In the following work, generation of motion profiles (especially position) for servo drives is considered. This is a crucial aspect of applications that demand a high motion fidelity, e.g., CNC feed drives and multi-axis manipulators. In this case, constraining the acceleration profile obtained by the second order trajectory generator leads to oscillations whenever the movement direction changes (i.e., zero crossing of set velocity). This is the main reason for using third and higher order trajectory generators, for defining constraints on jerk or snap [6].  
This paper is organized as follows: Section 1 serves as a brief introduction to control of digital servo drives; Section 2 is devoted to PLCopen Motion Control, particularly to one of its motion functions--MC_MoveAbsolute(). Section 3 presents a step by step algorithm to find a motion profile with boundaries defined up to the fourth derivative of position, and the trajectory generator of the fourth order is described. This topic is expanded upon in Section 4, where a real-time calculation of the beforementioned profile is discussed. Finally, Section 5 puts these solutions in context of the Programmable Logic/Automation Controller (PLC/PAC) devices that are IEC 61131-3 compliant, while Section 6 summarizes the paper.