Commit 453a9724 authored by Thomas Bruns's avatar Thomas Bruns
Browse files

added t_i as return for XV_MultiSine

parent 037ca90b
......@@ -709,20 +709,33 @@ def PR_MultiSine(
# MultiSine for "quick calibration" based on displacement and velocity without
# explicit time-information (used for Linearmotor-control)
def XV_MultiSine(freq, phase, x0, tau, N=1000, deg=True):
returns two arrays of positions and velocities of length N which describe
a multi-sine motion with the frequencies given in f and displacement amplitudes
given in x0.
freq numpy array of frequencies\n
phase numpy array of initial phases\n
x0 numpy array of displacement amplitudes\n
tau double giving the duration of the motion
N integer length of result array, len(x) and len(v)\n
deg boolean True:phase values in degree, False:phase values in rad
Calculation of a multisine trajectory in terms of position and velocity based
on given frequency, amplitude and phase
freq : numpy.array float
Vector of frequencies of the sine components
phase : numpy array float
Vector of initial phases of the sine components
x0 : TYPE
Vector of amplitudes of the sine components
tau : float
duration for the whole motion
N : int, optional
number of samples. The default is 1000.
deg : boolean, optional
If True phases are in degree, if False in rad. The default is True/Deg.
multi_x : numpy.array float
Calculated position vector
multi_v : numpy.array
Calculated velocity vector
assert (
len(freq) == len(x0) == len(phase)
), "XV_MultiSine: Unequal length of frequency and amplitude arrays!"
......@@ -737,6 +750,6 @@ def XV_MultiSine(freq, phase, x0, tau, N=1000, deg=True):
for f, x, p in zip(freq, x0, phase):
om = 2 * np.pi * f
multi_x = multi_x + x * np.sin(om * ti + p)
multi_v = multi_v + x / om * np.cos(om * ti + p)
multi_v = multi_v + x * om * np.cos(om * ti + p)
return multi_x, multi_v
return ti, multi_x, multi_v
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment