movement_primitives.dmp.DMPWithFinalVelocity

class movement_primitives.dmp.DMPWithFinalVelocity(n_dims, execution_time=1.0, dt=0.01, n_weights_per_dim=10, int_dt=0.001, p_gain=0.0)

Bases: WeightParametersMixin, DMPBase

Dynamical movement primitive (DMP) with final velocity.

Equation of transformation system (according to [1], Eq. 6):

\[\ddot{y} = (\alpha_y (\beta_y (g - y) + \tau\dot{g} - \tau \dot{y}) + f(z))/\tau^2\]
Parameters:
n_dimsint

State space dimensions.

execution_timefloat, optional (default: 1)

Execution time of the DMP: \(\tau\).

dtfloat, optional (default: 0.01)

Time difference between DMP steps: \(\Delta t\).

n_weights_per_dimint, optional (default: 10)

Number of weights of the function approximator per dimension.

int_dtfloat, optional (default: 0.001)

Time difference for Euler integration.

p_gainfloat, optional (default: 0)

Gain for proportional controller of DMP tracking error. The domain is [0, execution_time**2/dt].

References

[1]

Muelling, K., Kober, J., Kroemer, O., Peters, J. (2013). Learning to Select and Generalize Striking Movements in Robot Table Tennis. International Journal of Robotics Research 32 (3), 263-279. https://www.ias.informatik.tu-darmstadt.de/uploads/Publications/Muelling_IJRR_2013.pdf

Attributes:
execution_time_float

Execution time of the DMP.

dt_float

Time difference between DMP steps. This value can be changed to adapt the frequency.

Methods

configure([t, start_y, start_yd, start_ydd, ...])

Set meta parameters.

get_weights()

Get weight vector of DMP.

imitate(T, Y[, regularization_coefficient])

Imitate demonstration.

n_steps_open_loop(last_y, last_yd, n_steps)

Perform 'n_steps' steps.

open_loop([run_t, coupling_term])

Run DMP open loop.

reset()

Reset DMP to initial state and time.

set_weights(weights)

Set weight vector of DMP.

step(last_y, last_yd[, coupling_term])

DMP step.

get_execution_time_

set_execution_time_

__init__(n_dims, execution_time=1.0, dt=0.01, n_weights_per_dim=10, int_dt=0.001, p_gain=0.0)

Methods

__init__(n_dims[, execution_time, dt, ...])

configure([t, start_y, start_yd, start_ydd, ...])

Set meta parameters.

get_execution_time_()

get_weights()

Get weight vector of DMP.

imitate(T, Y[, regularization_coefficient])

Imitate demonstration.

n_steps_open_loop(last_y, last_yd, n_steps)

Perform 'n_steps' steps.

open_loop([run_t, coupling_term])

Run DMP open loop.

reset()

Reset DMP to initial state and time.

set_execution_time_(execution_time)

set_weights(weights)

Set weight vector of DMP.

step(last_y, last_yd[, coupling_term])

DMP step.

Attributes

execution_time_

n_weights

Total number of weights configuring the forcing term.

configure(t=None, start_y=None, start_yd=None, start_ydd=None, goal_y=None, goal_yd=None, goal_ydd=None)

Set meta parameters.

Parameters:
tfloat, optional

Time at current step.

start_yarray, shape (n_dims,)

Initial state.

start_ydarray, shape (n_vel_dims,)

Initial velocity.

start_yddarray, shape (n_vel_dims,)

Initial acceleration.

goal_yarray, shape (n_dims,)

Goal state.

goal_ydarray, shape (n_vel_dims,)

Goal velocity.

goal_yddarray, shape (n_vel_dims,)

Goal acceleration.

get_weights()

Get weight vector of DMP.

Returns:
weightsarray, shape (N * n_weights_per_dim,)

Current weights of the DMP. N depends on the type of DMP

imitate(T, Y, regularization_coefficient=0.0)

Imitate demonstration.

Parameters:
Tarray, shape (n_steps,)

Time for each step.

Yarray, shape (n_steps, n_dims)

State at each step.

regularization_coefficientfloat, optional (default: 0)

Regularization coefficient for regression.

n_steps_open_loop(last_y, last_yd, n_steps)

Perform ‘n_steps’ steps.

Parameters:
last_yarray, shape (n_dims,)

Last state.

last_ydarray, shape (n_dims,)

Last time derivative of state (e.g., velocity).

n_stepsint

Number of steps.

Returns:
yarray, shape (n_dims,)

Next state.

ydarray, shape (n_dims,)

Next time derivative of state (e.g., velocity).

property n_weights

Total number of weights configuring the forcing term.

open_loop(run_t=None, coupling_term=None)

Run DMP open loop.

Parameters:
run_tfloat, optional (default: execution_time)

Run time of DMP. Can be shorter or longer than execution_time.

coupling_termobject, optional (default: None)

Coupling term that will be added to velocity.

Returns:
Tarray, shape (n_steps,)

Time for each step.

Yarray, shape (n_steps, n_dims)

State at each step.

reset()

Reset DMP to initial state and time.

set_weights(weights)

Set weight vector of DMP.

Parameters:
weightsarray, shape (N * n_weights_per_dim,)

New weights of the DMP. N depends on the type of DMP

step(last_y, last_yd, coupling_term=None)

DMP step.

Parameters:
last_yarray, shape (n_dims,)

Last state.

last_ydarray, shape (n_dims,)

Last time derivative of state (e.g., velocity).

coupling_termobject, optional (default: None)

Coupling term that will be added to velocity.

Returns:
yarray, shape (n_dims,)

Next state.

ydarray, shape (n_dims,)

Next time derivative of state (e.g., velocity).