## Introduction

## What is the notion of Motion Profile Generation?

*Figure 1 – Generic FOC control architecture for 3-phase Motors*

This cascade control topology works in a way that most exterior controller provides the reference for the interior controllers, for instance the Speed controller provides the Torque reference for the Torque controller and the Position controller provides the Speed reference for the Speed controller, thus the chain of these three controllers will allow you to control eventually the position of a 3-phase motor.

Of course, if one just needs to control the speed of a 3-phase motor, they can discard the Position controller and provide the reference directly to the speed controller and the same applies when only the Torque controller is required, where both Position and Speed controllers are discarded and the torque reference is directly fed to the Torque controller.

Now in all of these configurations the notion of “reference” refers to what the user provides to the controller and it defines the final set-point for the controller as a goal to achieve, so basically the reference or the set-points are momentary changes in the controller input known as step inputs that are provided by the user, but there is no control on them as they can be any acceptable value, thus the controller has to follow the user input and this can create many challenges like oscillatory responses, controller saturation or very aggressive reaction of the controller and subsequently harsh motion of the Motor due to significant changes of the reference, to avoid all these we can behave the reference by either slowing it down or forcing it to have a nicer shape than just a simple Step input, this is where the role of Smooth Position or Speed Profile generation becomes bold.

By smoothening the reference or the set-points we will allow the controller to follow a smooth trajectory and this will affect the whole system, of course there are limitations like the dynamic responses or how fast you want the controller to achieve the set-points but in most applications the quality of the Motion has higher priority than the quickness of it, thus the smooth motion profiles are preferred compared to rough step inputs.

To understand this phenomena better, we have provided two examples of applying a direct step input to the speed controller of a PMSM versus a smooth st-curve generated velocity profile to achieve the same set-point of 1000 RPM as below:

*Figure 2- Speed feedback of a PMSM in reaction to a 1000RPM step set-point*

*Figure 3- Speed feedback of a PMSM in reaction to a 1000RPM set-point generated by SOLO’s Embedded Time-based St-curve Generator*

It is worth mentioning that in both situations the speed controller is an identical PI controller with exact same gains, and the only variation is the difference between the references to the controller.

The same effect can be observed with Position Controlling applications, for instance below you can see two different scenarios of controlling the position of a Brushless motor done using direct step input as well as the results using Time-Optimal St-curve profile generation with the exact same gains for PI controllers of Speed and Position loops.

It’s evident that in the case of step response the motion is jerky in the beginning due to over-shoots and oscillations caused by the speed controller, however in case of Time-optimal St-curve the motion is very smooth, providing a soft acceleration and take-off and then smoothly landing on the set-point, resulting in an extremely low jerk motion, as can be seen in Figure 5, beside the Position profile, the velocity profile is very smooth too.

*Figure 4- Position and Speed feedback shapes on step response of a PMSM in reaction to a +80,000 pulses as position set-point*

*Figure5 – Position and Speed feedback of a PMSM in reaction to a +80,000 pulses set-point using SOLO’s Time-optimal Embedded position profile generator *

## Architecture of SOLO’s Embedded Motion Profile Generator:

*Figure 6: St-curve Position Profile Generator Architecture for 3-phase Motors *

*Figure 7: St-curve Position Profile Generator Architecture for DC brushed Motors *

*Figure 8: St-curve Velocity Profile Generator Architecture for 3-phase Motors *

*Figure 9: St-curve Velocity Profile Generator Architecture for 3-phase Motors *

## Conventional PVT methods versus Embedded Profile Generation Engine of SOLO

### Conventional PVT methods

The conventional motion profile generation and controlling for servo-drives is known as “PVT” which stands for Position, Velocity and Time, in this method there are the following components work together as can be seen in Figure 10 below :

**1. The User:**

The user provides the final desired target position with some other constraints like timings or max values for inputs like velocity, acceleration, jerk and so on, and finally, as a result of all of these inputs, the host can compute for the whole system final target position, for instance, the final position for the end-effector of a robot.

**2. The Host:**

The Host, is usually a real-time system that has to compute and create the whole motion profile, this part of the system has to guarantee time determinism and it must work in a very stable fashion so that it can provide all the necessary points to the Servo Drive in a timely fashion without any interruption or considerable delay!

The Host has to locally compute the whole profile from the current position of the actuator to where it has to end up and has to fit a nice curve in between based on the algorithm that it uses ( St-curve, S-curve, Trapezoidal, …), we call this part PVT Encoding.

Once the Host computes and fits the curve, it has to send some of the computed points to the Servo drive with a reduced sampling rate, as can be seen in Figure 11, the main reason for this is the fact that sending all the computed points will occupy a huge portion of the data line and it consumes a lot of resources at the Host side or in many cases if the sampling rate is too high, it’s not feasible to send all these points in a timely fashion deterministically, so the Host has to reduce the samples for the Servo drive.

*Figure 10 – Architecture of a conventional PVT method from the user to the servo drive *

Through data lines like CANbus, EtherCAT, RS232, et..

The biggest challenge with such methods is making sure all the points from the Host to the Servo drive are sent at the right time and the Operating system on the Host can handle in real-time all the asynchronous messages between the servo drive and the host which will require intensive programming at both side with many challenges to handle.

*Figure 11 – Computed Host curve versus the points sent to the Servo-drive *

**3. Servo Drive:**

The servo drive receives all the points one by one from the Host computer in real-time and interpolates between them through a third or fourth order equation, as for the fact that the servo drives’ internal control loop usually runs up to 10 times faster than the PVT feeding rate from the Host side, so the servo drive has to interpolated at least 10 times between each two points sent from the Host till receiving the new points again.

The interpolation no matter how accurate, still won’t be the same as the real points computed at the Host side and this might leave some errors and discrepancies between what has been computed on the Host and what has been achieved on the real motor.

### Embedded Profile Generation Engine of SOLO

The embedded profile Generation Engine in SOLO, is like a PVT Encoder that is placed locally inside the Main Control Unit (DSP), in other words, the whole profile fitting, generation, and execution is done locally inside SOLO’s Firmware with the same execution rate of the controllers ( Speed and Position) and this will have the following results:

– It Requires only the Target position from the user with no interpolation done between the points ( all points generated locally at run-time)

– Much less occupation of the Data lines ( one target point instead of hundreds)

– No special programming skills required at the user side! ( automatic profile generation)

*Figure 12 – SOLO Motion Profile Generation Engine diagram *

## Embedded St-curve Position Profile Generation

The jerk is actually the main point of focus as the eventual behavior of the jerk will define the quality of the motion in terms of having higher or lower vibrations and potential undesirable motions.

*Figure13- St-Curve Position Profile combined out of 7 separate segments *

The whole St-curve profile is divided into 7 different segments where the final trajectory is fitted as a smooth profile between point A to B within these 7 segments.

Each segment has a duration that is shown above with sign “tx”that are having the following meaning:

t1: duration of the segment with increasing and decreasing acceleration (parabolic jerk)

t2: duration of the segment with the constant acceleration

t3: duration of the segment with zero acceleration (constant velocity) phase

t4: duration of the segment with decreasing and increasing deceleration (parabolic jerk)

t5: duration of the segment with the constant deceleration

In SOLO’s Embedded engine the segments 1 and 3 are having identical duration, the same applies to segments 5 and 7.

## Time-based versus Time-optimal Position Profile St-Curve

SOLO offers two different methods for computing the St-curve profile for a given motion as below:

**Time-based St-curve:**

In Time-based St-curves, the user has to input the strict timings for each segment of the motion as an input to SOLO, these timings later will be used to create the St-curve profile locally.

**Time-Optimal St-curve:**

Once using Time optimal St-curve, the user has to provide motion constraints like maximum velocities, maximum accelerations and maximum jerks for the whole trajectory and the timings of each segment is internally computed based on these constraints at run-time in the firmware of SOLO.

The Time-based St-curve has an intuitive notion as it works directly with timings, however the Time-optimal St-curve has some considerations that we will discuss in detail in the next section.

### Time-Optimal Position Profile St-curve Constraints Validations

Maximum allowable jerk, acceleration, and velocity can be directly controlled, i.e. a time-optimal motion profile can be computed by providing maximum values of acceleration jerk J, deceleration jerk I, acceleration A, deceleration D, and velocity V. In this way, segments’ duration is not explicitly provided, but they are computed at runtime in SOLO’s firmware.

Given that t1, t2, t3, t4, and t5 must be greater than or equal to zero, the following inequality constraints must be satisfied:

**1 Velocity constraint**

*Equation 1 *

If desired maximum velocity does not satisfy this constraint, the maximum allowable velocity can be computed as:

*Equation 2 *

**2. Acceleration constraint**

*Equation 3*

If desired maximum acceleration does not satisfy this constraint, the maximum allowable acceleration can be computed as:

*Equation 4*

If desired maximum velocity does not satisfy this constraint, the maximum allowable velocity can be computed as:

**3.Deceleration constraint**

*Equation 5 *

If desired maximum deceleration does not satisfy this constraint, the maximum allowable deceleration can be computed as:

*Equation 6*

### St-curve Position Profile Tuning

In fact, there is often a ‘magic’ value for a given mechanism for the St-curve phase ratio, while too little transition time can inject too much vibrational energy, surprisingly, too much transition time can have a similar effect. There is often a specific value for jerk which ‘sticks the landing’ and significantly or entirely reduces settling oscillation at the end of the trajectory. Finding that value is the goal of the St-curve tuning process. Practically speaking, unless the weight of the load never changes or the weight of the load is exactly known, you will probably tune the St-curve shape for a point-to-point transfer of an average load. But even an average-optimized value can make a big difference in effective point-to-point transfer times. Two different examples of tuning the Position Profile St-curves are presented in Figures 14 and 15 below.

*Figure 14: “Smooth” St-curve motion profile; t1=1s, t2=0.1s, t3=0.5s, t4=1s, t5=0.1s *

*Figure 15: “Fast” St-curve motion profile; t1=0.1s, t2=1s, t3=0.5s, t4=0.1s,t5=1s *

## Embedded St-curve Velocity Profile Generation

By observing Figure 13 of the St-curve position profile, we can see that the velocity profile reaches a constant value at the end of the third segment. Accordingly, a speed reference profile is created as a subset of the corresponding position profile as can be seen in Figure 16 below.

*Figure16- St-Curve Velocity Profile combined out of 3 separated segments *

The segments duration of the velocity profile in St-curve are:

t1: duration of the segment with increasing and decreasing acceleration (parabolic jerk)

t2: duration of the segment with the constant acceleration

### Time-based versus Time-optimal Velocity Profile St-Curve

SOLO offers two different methods for computing the St-curve profile for a given motion as below:

**Time-based St-curve:**

In Time-based St-curves, the user has to input the strict timings for each segment of the motion as an input to SOLO, these timings later will be used to create the St-curve profile locally.

**Time-Optimal St-curve:**

Once using Time optimal St-curve, the user has to provide motion constraints like maximum accelerations and maximum jerks along the velocity trajectory and the timings of each segment is internally computed based on these constraints at run-time between each two target points.

The Time-based St-curve has an intuitive notion as it works directly with timings, however, the Time-optimal St-curve has some considerations that we will discuss in detail in the next section.

### Time-Optimal Velocity Profile St-curve Constraints Validations

Given that t1 and t2 must be greater than or equal to zero, the acceleration inequality constraint must be satisfied:

*Equation 7 *

*Equation 8 *

### St-Curve Velocity Profile Tuning

On the one hand, if we spend nearly all our time transitioning (segment 1 and 3) and very little time at maximum acceleration (segment 2), the motion will be extremely smooth, but the total time of the move will increase. This is because, during segment 1, the St-curve profile travels only a short distance, therefore, the greater amount of time spent here will increase the overall transfer time.

On the other hand, if we spend only a small fraction of time in segments 1 and 3, then the time of the total move will be minimized, however, the profile will not be as smooth and may cause unwanted vibration in the load. However, there is a caveat because even relatively brief segments 1 and 3 can dramatically reduce load-induced oscillations.

Practically speaking, unless the weight of the load never changes or the weight of the load is exactly known, you will probably tune the St-curve shape for a point-to-point transfer of an average load, two different examples of tuning the velocity St-curves are presented in Figures 17 and 18 below.

*Figure 17: “Smooth” velocity St-curve motion profile; t1,t3=1s, t2=0.1s *

*Figure 18: “Fast” velocity St-curve motion profile; t1,t3=0.1s, t2=1s *

## 0 Comments