How can I achieve S curve profile

88 Views Asked by At

I want to plan robot's motion according to S curve profile.I am following the bellow mention article,which contain basics related to S curve motion profiles in robotic platforms.

https://www.pmdcorp.com/resources/type/articles/get/mathematics-of-motion-control-profiles-article

And for this purpose I am using one sigmoidal function,

https://en.wikipedia.org/wiki/Sigmoid_function

After using this equation I am getting S curve,but problem is that as mentioned in article (link-1) I also want constant phase (a straight line) in middle of this S curve.

Is there any other equation or any other method available to achieve this type of S curve profile.

1

There are 1 best solutions below

0
On

I don't really see a sigmoid function here... just some piecewise constants and piecewise linear functions .

Here is a Python example

from scipy import interpolate

def dt2t(a_dt):
  t = 0
  a_t = []
  a_t.append(t)
  for dt in a_dt:
    t = t + dt
    a_t.append(t)
  return a_t

def s_curve(t):
  #a_t = [0.0, 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0]
  #a_dt = [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0]
  a_dt = [1.0, 3.0, 1.0, 1.0, 1.0, 3.0, 1.0]
  a_t = dt2t(a_dt)
  a_a = [0.0, 1.0, 1.0, 0.0, 0.0, -1.0, -1.0, 0.0]
  f = interpolate.interp1d(a_t, a_a)
  if t < min(a_t) or t > max(a_t):
    return 0.0
  else:
    return f(t)

Plot acceleration

import numpy as np
import matplotlib.pyplot as plt
t = np.linspace(0 - 1, 11 + 1, 100)
dt = t[1] - t[0]
v_s_curve = np.vectorize(s_curve)
a = v_s_curve(t)
plt.plot(t, a)

acceleration

Jerk calculation using derivative of acceleration then plot of jerk

jerk = np.diff(a) / dt
plt.plot(t[1:], jerk)

jerk

Speed calculation using integration of acceleration then plot of speed

from scipy.integrate import cumtrapz
v = cumtrapz(a, t, initial=0)
plt.plot(t, v)

speed

Position calculation using integration of speed then plot of position

x = cumtrapz(v, t, initial=0)
plt.plot(t, x)

poistion