Fork me on GitHub

bolero.representation.DMPSequence

class bolero.representation.DMPSequence(n_dmps=1, execution_times=None, dt=0.01, n_features=None, subgoals=None, learn_goal_velocities=False, initial_weights=None)[source]

Sequence of DMPs.

Each DMP is initialized at the last phase of its predecessor to ensure smooth transitions.

Parameters:
n_dmps : int, optional (default: 1)

Number of DMPs in this sequence

execution_times : array-like, shape (n_dmps,), optional (default: ones)

Execution times of the DMPs

n_features : array-like, shape (n_dmps,), optional (default: 50s)

Number of RBF features for each dimension of each DMP.

dt : float, optional (default: 0.01)

Time between successive steps in seconds.

subgoals : array-like, shape (n_dmps + 1, n_task_dims)

Subgoals of the DMPs including the final goal and the initial state.

learn_goal_velocities : bool, optional (default: False)

Defines whether the parameter vector will include the velocities at the goals of the DMPs.

initial_weights : list

List of initial weight vectors for the DMPs. Each entry initial_weights[i] has the shape n_features[i] * n_task_dims

__init__(n_dmps=1, execution_times=None, dt=0.01, n_features=None, subgoals=None, learn_goal_velocities=False, initial_weights=None)[source]
can_step()[source]

Returns true if step() can be called again, false otherwise.

get_args()

Get parameters for this estimator.

Returns:
params : mapping of string to any

Parameter names mapped to their values.

get_n_params()[source]

Get number of parameters.

get_outputs(outputs)[source]

Get desired next system state.

Parameters:
outputs : array-like, shape (n_task_dims * 3)

Position, velocitie and rotation of each dimension

get_params()[source]

Utility function: get currently optimizable parameters.

get_subgoal(idx)[source]

Get subgoal.

Parameters:
idx: int

index of the subgoal: 0 is the start of the DMP sequence, -1 would be the goal of the sequence

Returns:
subgoal: array-like, shape (n_task_dims,)

subgoal at index ‘idx’

get_subgoal_velocity(idx)[source]

Get subgoal.

Parameters:
idx: int

index of the subgoal: 0 is the start of the DMP sequence, -1 would be the goal of the sequence

Returns:
subgoal: array-like, shape (n_task_dims,)

velocity at subgoal with index ‘idx’

init(n_inputs, n_outputs)[source]

Initialize the behavior.

Parameters:
n_inputs : int

number of inputs

n_outputs : int

number of outputs

reset()[source]

Reset DMP.

set_inputs(inputs)[source]

Set current system state.

Parameters:
inputs : array-like, shape (n_task_dims * 3)

Position, velocitie and rotation of each dimension

set_meta_parameters(keys, meta_parameters)[source]

Set DMP meta parameters.

Required meta-parameters

x0 : array
initial position
g : array
goal
Parameters:
keys : list of string

names of meta-parameters

meta_parameters : list of float

values of meta-parameters

set_params(params)[source]

Utility function: set currently optimizable parameters.

set_subgoal(idx, subgoal)[source]

Set subgoal manually.

Parameters:
idx: int

index of the subgoal: 0 is the start of the DMP sequence, -1 would be the goal of the sequence

subgoal: array-like, shape (n_task_dims,)

subgoal at index ‘idx’

set_subgoal_velocity(idx, subgoal_vel)[source]

Set subgoal velocity manually.

Parameters:
idx: int

index of the subgoal: 0 is the start of the DMP sequence, -1 would be the goal of the sequence

subgoal_vel: array-like, shape (n_task_dims,)

velocity at subgoal with index ‘idx’

step()[source]

Compute next step.

trajectory()[source]

Generate trajectory represented by the sequence of DMPs in open loop.

The function can be used for debugging purposes.

Returns:
X : array, shape (n_steps, n_task_dims)

Positions

Xd : array, shape (n_steps, n_task_dims)

Velocities

Xdd : array, shape (n_steps, n_task_dims)

Accelerations