Show how s-curve speed type can be obtained.
- Description
- Performance considerations
- Example
- Prerequisites
- Quickstart
- How this project was built
- References
For symbolic calculus AngouriMath library was used.
For preliminary analysis sympy with this test was used.
-
lets name
- t (time)
- x (distance)
- d (total duration accel/decel)
- s (final speed)
-
suppose
[0,d/2]
the time for acceleration while[d/2,d]
the time for deceleration to produce a target final speeds
starting from speed=0 and pos=0 -
from base acceleration function 1-cos(t)
-
expanding the period domain from
[0,2pi]
to[0,d/2]
through this subst -
stretching the accel function so that its integral, the speed, achieve targetspeed
-
acceleration results as this
👉 hit F5 if math not rendered
- positive max accel value is at midpoint ( t=1/4d because accel positive in
[0,d/2]
) thus above can be simplified into
- integration of accel gives speed
- integration of speed gives pos ( normalized removing integration constant computed for t=0 )
- targetspeed required from known final position
p
to reach in required time durationd
-
from base deceleration function cos(t)-1
-
sets
th
as
- deceleration results as this
- despeed results as this ( given from deAccel integral subtracting integration constant and adding speed achieved by accel at
d/2
)
- depos results as this ( given from deSpeed integral subtracting integration constant and adding pos achieved by accel at
d/2
)
For a realtime purpose a bezier approach should be used like the one implemented in the Marlin.
This example can be executed through
dotnet run --project examples/scurve-xlsx
and it will produce follow output.xlsx by applying above formulas and doing some test calc about max allowable torque based on motion and supposed load.
git clone https://github.com/devel0/netcore-util
cd netcore-util
git checkout bd8626104f4b5a9cb9de5db624cebbcd77a8b384
cd ..
git clone https://github.com/devel0/netcore-sci
cd netcore-sci
git checkout 151451d5cd40e8ccebf93718379e8d72dbadce86
cd ..
git clone https://github.com/devel0/scurve-speed-eval
cd scurve-speed-eval
dotnet build
dotnet run --project gui
dotnet new console -n scurve-speed-eval
cd scurve-speed-eval
dotnet sln add scurve-speed-eval.csproj
dotnet sln add .
dotnet add reference ../netcore-util/netcore-util
dotnet add reference ../netcore-sci/netcore-sci
dotnet add package AngouriMath --version 1.3.0
dotnet add package Avalonia.Desktop --version 0.10.0-preview6
dotnet add package OxyPlot.Avalonia --version 2.1.0-20200725.1
dotnet add package UnitsNet --version 4.76.0
dotnet run