movement_primitives.dmp.DualCartesianDMP

class movement_primitives.dmp.DualCartesianDMP(execution_time=1.0, dt=0.01, n_weights_per_dim=10, int_dt=0.001, p_gain=0.0, smooth_scaling=False)

Bases: WeightParametersMixin, DMPBase

Dual cartesian dynamical movement primitive.

Each of the two Cartesian DMPs handles orientation and position separately. The orientation is represented by a quaternion. See CartesianDMP for details about the equation of the transformation system.

While the dimension of the state space is 14, the dimension of the velocity, acceleration, and forcing term is 12.

Parameters:
execution_timefloat, optional (default: 1)

Execution time of the DMP.

dtfloat, optional (default: 0.01)

Time difference between DMP steps.

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].

smooth_scalingbool, optional (default: False)

Avoids jumps during the beginning of DMP execution when the goal is changed and the trajectory is scaled by interpolating between the old and new scaling of the trajectory.

References

[1]

Ude, A., Nemec, B., Petric, T., Murimoto, J. (2014). Orientation in Cartesian space dynamic movement primitives. In IEEE International Conference on Robotics and Automation (ICRA) (pp. 2997-3004). DOI: 10.1109/ICRA.2014.6907291, https://acat-project.eu/modules/BibtexModule/uploads/PDF/udenemecpetric2014.pdf

[2]

Pastor, P., Hoffmann, H., Asfour, T., Schaal, S. (2009). Learning and Generalization of Motor Skills by Learning from Demonstration. In 2009 IEEE International Conference on Robotics and Automation, (pp. 763-768). DOI: 10.1109/ROBOT.2009.5152385, https://h2t.iar.kit.edu/pdf/Pastor2009.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, step_function])

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__(execution_time=1.0, dt=0.01, n_weights_per_dim=10, int_dt=0.001, p_gain=0.0, smooth_scaling=False)

Methods

__init__([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, step_function])

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, allow_final_velocity=False)

Imitate demonstration.

Parameters:
Tarray, shape (n_steps,)

Time for each step.

Yarray, shape (n_steps, 14)

State at each step.

regularization_coefficientfloat, optional (default: 0)

Regularization coefficient for regression.

allow_final_velocitybool, optional (default: False)

Allow a final velocity.

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, step_function='cython')

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.

step_functionstr, optional (default: ‘cython’ if available)

DMP integration function. Possible options: ‘python’, ‘cython’.

Returns:
Tarray, shape (n_steps,)

Time for each step.

Yarray, shape (n_steps, 14)

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, step_function=<cyfunction dmp_step_dual_cartesian>)

DMP step.

Parameters:
last_yarray, shape (14,)

Last state.

last_ydarray, shape (12,)

Last time derivative of state (velocity).

coupling_termobject, optional (default: None)

Coupling term that will be added to velocity.

step_functioncallable, optional (default: cython code if available)

DMP integration function.

Returns:
yarray, shape (14,)

Next state.

ydarray, shape (12,)

Next time derivative of state (velocity).