How to calculate each period of time for S-curve
When solving problems about S-curves (also known as quintic polynomial trajectories), we need to consider how to plan the trajectory based on the given maximum speed, acceleration, jerk, and total moving distance, and calculate the time for each segment. S-curves are often used in applications that require smooth acceleration and deceleration, such as robots and CNC machine tools.
01. Define the mathematical expression of the S-curve
The S-curve can usually be expressed by a quintic polynomial to represent the relationship between position s and time t:
s(t) = a 0 + a 1 t + a 2 t 2 + a 3 t 3 + a 4 t 4 + a 5 t 5
Among them, the coefficient a 0 , a 1 , a 2 , a 3 , a 4 , a 5 It needs to be determined based on boundary conditions.
02. Determine boundary conditions
1. Initial position s(0)=0
2. Final position s(T)=S, where S is the total moving distance and T is the total time.
3.Initial Speed s ′ (0)=0
4.Final speed s′(T)=0
5.Maximum speed s′(tmax max )=V max
6.Initial acceleration s′′(0)=0
7.Final acceleration s′′(T)=0
8.Maximum acceleration s′′(t acc )=A max
9.Maximum jerk(Jerk)s′′′(t jerk )=J max
03. Solve the coefficients
By solving these equations (including the derivative equations), we can find the coefficients of the quintic polynomial. (Solve the linear equations)
04. Divide the time periods
The S-curve is usually divided into seven time periods:
1. Acceleration period
2. Uniform acceleration period
3. Deceleration period
4. Uniform speed period (if the maximum speed lasts for a period of time)
5. Acceleration and deceleration period
6. Uniform deceleration period
7. Deceleration and deceleration period
The length of each time period and the corresponding acceleration and speed change need to be accurately calculated based on the maximum speed, maximum acceleration, maximum jerk and total distance.
05. Calculate each time period
When calculating the formula for each time period in the S-curve, it should be noted that these times are not directly obtained through simple formulas, but need to be solved comprehensively based on the characteristics of the S-curve, given parameters (such as maximum speed, maximum acceleration, maximum jerk, total moving distance) and boundary conditions.
The following are some approximate calculation methods or ideas for estimating each time period:
Acceleration segment: Starting from rest, the acceleration increases linearly to the maximum acceleration, time t 1 Can be calculated by J max and A max .
Assume that the acceleration increases linearly from 0 to the maximum acceleration A max , the jerk is J max .
Time t
1
=
To approximate calculation
In practice, due to the complexity of the S-curve, this time may need to be accurately calculated by numerical methods or by solving a system of equations.
Uniform acceleration segment (if any):
If the velocity reaches the maximum velocity V before reaching the maximum acceleration max , then there is no uniform acceleration segment.
If it exists, time t 2 Can be calculated by maximum velocity, maximum acceleration and initial velocity
Deceleration and acceleration stage:
Similar to the acceleration segment, but the acceleration decreases linearly from A max to 0.
Time t 3 The calculation method is similar to t 1 , but in the opposite direction.
Constant speed segment (if any):
If the total moving distance, maximum speed and acceleration allow, there is a constant speed segment.
Time t 4 It can be calculated by dividing the remaining distance by the maximum speed.
Acceleration and deceleration, uniform deceleration, and deceleration and acceleration stages:
These phases are similar to the acceleration, uniform acceleration, and deceleration phases, but in opposite directions.
The calculation method for time is similar, but it is necessary to pay attention to the direction of the change in velocity and acceleration.
However, due to the complexity of the S-curve, it is usually not attempted to directly calculate each period of time through a simple formula. Instead, numerical methods (such as numerical integration, iterative solution, etc.) or specialized trajectory planning software are used to solve it.
In practical applications, an initial trajectory planning is usually set up based on given parameters and boundary conditions, and then its effect is verified through simulation or experiment, and adjusted as needed. If each period of time needs to be precisely controlled, it may be necessary to use iterative solution or optimization algorithm to find the best trajectory that meets all conditions.
06. Verification and Adjustment
Finally, we need to verify the total time of the entire trajectory T=t 1 +t 2 +t 3 + ... Check whether the requirements are met and whether the total moving distance is equal to S. If not, you may need to adjust the parameters (such as maximum speed, acceleration, etc.) and recalculate.
It should be noted that since this is a complex calculation process, numerical methods or specialized software tools are usually required to assist the calculation. In addition, some details in the above steps (such as the precise calculation of each period of time) may require more in-depth mathematical analysis and programming implementation.



















