|
DMP_BBO library
|
Implementation of Contextual Dynamical Movement Primitives. More...
#include <DmpContextual.hpp>


Public Member Functions | |
| DmpContextual (int n_dims_dmp, std::vector< FunctionApproximator * > function_approximators, DmpType dmp_type) | |
| Initialization constructor for Contextual DMPs of known dimensionality, but with unknown initial and attractor states. More... | |
| void | set_task_parameters (const Eigen::MatrixXd &task_parameters) |
| Set the current task parameters. More... | |
| void | set_policy_parameter_function_goal (FunctionApproximator *function_approximator) |
| Set a function approximator to predict the goal from the task parameters. More... | |
| void | set_policy_parameter_function_duration (FunctionApproximator *function_approximator) |
| Set a function approximator to predict the duration from the task parameters. More... | |
| virtual void | computeFunctionApproximatorOutput (const Eigen::Ref< const Eigen::MatrixXd > &phase_state, Eigen::MatrixXd &fa_output) const =0 |
| Compute the outputs of the function approximators. More... | |
| virtual void | train (const std::vector< Trajectory > &trajectories, const std::vector< Eigen::MatrixXd > &task_parameters, std::string save_directory, bool overwrite)=0 |
| Train a contextual Dmp with a set of trajectories (and save results to file) This function is useful for debugging, i.e. More... | |
| void | train (const std::vector< Trajectory > &trajectories, const std::vector< Eigen::MatrixXd > &task_parameters, std::string save_directory) |
| Train a contextual DMP with multiple trajectories. More... | |
| void | train (const std::vector< Trajectory > &trajectories, const std::vector< Eigen::MatrixXd > &task_parameters) |
| Train a contextual DMP with multiple trajectories. More... | |
| void | train (const std::vector< Trajectory > &trajectories, std::string save_directory, bool overwrite) |
| Train a contextual DMP with multiple trajectories. More... | |
| void | train (const std::vector< Trajectory > &trajectories, std::string save_directory) |
| Train a contextual DMP with multiple trajectories. More... | |
| void | train (const std::vector< Trajectory > &trajectories) |
| Train a contextual DMP with multiple trajectories. More... | |
Public Member Functions inherited from Dmp | |
| Dmp (double tau, Eigen::VectorXd y_init, Eigen::VectorXd y_attr, std::vector< FunctionApproximator * > function_approximators, double alpha_spring_damper, DynamicalSystem *goal_system, DynamicalSystem *phase_system, DynamicalSystem *gating_system, ForcingTermScaling scaling=NO_SCALING) | |
| Initialization constructor. More... | |
| Dmp (int n_dims_dmp, std::vector< FunctionApproximator * > function_approximators, double alpha_spring_damper, DynamicalSystem *goal_system, DynamicalSystem *phase_system, DynamicalSystem *gating_system, ForcingTermScaling scaling=NO_SCALING) | |
| Initialization constructor for Dmps of known dimensionality, but with unknown initial and attractor states. More... | |
| Dmp (double tau, Eigen::VectorXd y_init, Eigen::VectorXd y_attr, std::vector< FunctionApproximator * > function_approximators, DmpType dmp_type=KULVICIUS_2012_JOINING, ForcingTermScaling scaling=NO_SCALING) | |
| Constructor that initializes the DMP with default dynamical systems. More... | |
| Dmp (int n_dims_dmp, std::vector< FunctionApproximator * > function_approximators, DmpType dmp_type=KULVICIUS_2012_JOINING, ForcingTermScaling scaling=NO_SCALING) | |
| Initialization constructor for Dmps of known dimensionality, but with unknown initial and attractor states. More... | |
| Dmp (double tau, Eigen::VectorXd y_init, Eigen::VectorXd y_attr, double alpha_spring_damper, DynamicalSystem *goal_system) | |
| Initialization constructor for Dmps without a forcing term. More... | |
| ~Dmp (void) | |
| Destructor. More... | |
| Dmp * | clone (void) const |
| Return a deep copy of this object. More... | |
| virtual void | integrateStart (Eigen::Ref< Eigen::VectorXd > x, Eigen::Ref< Eigen::VectorXd > xd) const |
| Start integrating the system. More... | |
| void | differentialEquation (const Eigen::Ref< const Eigen::VectorXd > &x, Eigen::Ref< Eigen::VectorXd > xd) const |
| The differential equation which defines the system. More... | |
| void | analyticalSolution (const Eigen::VectorXd &ts, Eigen::MatrixXd &xs, Eigen::MatrixXd &xds, Eigen::MatrixXd &forcing_terms, Eigen::MatrixXd &fa_output) const |
| Return analytical solution of the system at certain times (and return forcing terms) More... | |
| void | analyticalSolution (const Eigen::VectorXd &ts, Eigen::MatrixXd &xs, Eigen::MatrixXd &xds, Eigen::MatrixXd &forcing_terms) const |
| Return analytical solution of the system at certain times (and return forcing terms) More... | |
| void | analyticalSolution (const Eigen::VectorXd &ts, Eigen::MatrixXd &xs, Eigen::MatrixXd &xds) const |
| Return analytical solution of the system at certain times. More... | |
| virtual void | analyticalSolution (const Eigen::VectorXd &ts, Trajectory &trajectory) const |
| Return analytical solution of the system at certain times. More... | |
| void | analyticalSolution (const Eigen::VectorXd &ts, Trajectory &trajectory, Eigen::MatrixXd &forcing_terms) const |
| Return analytical solution of the system at certain times. More... | |
| virtual void | statesAsTrajectory (const Eigen::MatrixXd &x_in, const Eigen::MatrixXd &xd_in, Eigen::MatrixXd &y_out, Eigen::MatrixXd &yd_out, Eigen::MatrixXd &ydd_out) const |
| Get the output of a DMP dynamical system as a trajectory. More... | |
| virtual void | statesAsTrajectory (const Eigen::VectorXd &ts, const Eigen::MatrixXd &x_in, const Eigen::MatrixXd &xd_in, Trajectory &trajectory) const |
| Get the output of a DMP dynamical system as a trajectory. More... | |
| virtual void | train (const Trajectory &trajectory) |
| Train a DMP with a trajectory. More... | |
| virtual void | train (const Trajectory &trajectory, std::string save_directory, bool overwrite=false) |
| Train a DMP with a trajectory, and write results to file. More... | |
| virtual void | set_tau (double tau) |
| Accessor function for the time constant. More... | |
| virtual void | set_initial_state (const Eigen::VectorXd &y_init) |
| Accessor function for the initial state of the system. More... | |
| virtual void | set_attractor_state (const Eigen::VectorXd &y_attr) |
| Accessor function for the attractor state of the system. More... | |
| void | set_damping_coefficient (double damping_coefficient) |
| Accessor function for damping coefficient of spring-damper system. More... | |
| void | set_spring_constant (double spring_constant) |
| Accessor function for spring constant of spring-damper system. More... | |
| std::string | toString (void) const |
| Returns a string representation of the object. More... | |
| void | getSelectableParameters (std::set< std::string > &selectable_values_labels) const |
| Return all the names of the parameter types that can be selected. More... | |
| void | setSelectedParameters (const std::set< std::string > &selected_values_labels) |
| Determine which subset of parameters is represented in the vector returned by Parameterizable::getParameterVectorSelected. More... | |
| int | getParameterVectorAllSize (void) const |
| Get the size of the parameter values vector when it contains all available parameter values. More... | |
| void | getParameterVectorAll (Eigen::VectorXd &values) const |
| Return a vector that returns all available parameter values. More... | |
| void | setParameterVectorAll (const Eigen::VectorXd &values) |
| Set all available parameter values with one vector. More... | |
| void | getParameterVectorMask (const std::set< std::string > selected_values_labels, Eigen::VectorXi &selected_mask) const |
| Get a mask for selecting parameters. More... | |
| void | computeFunctionApproximatorInputsAndTargets (const Trajectory &trajectory, Eigen::VectorXd &fa_inputs_phase, Eigen::MatrixXd &fa_targets) const |
| Given a trajectory, compute the inputs and targets for the function approximators. More... | |
| void | set_perturbation_analytical_solution (double perturbation_standard_deviation) |
| Add a perturbation to the forcing term when computing the analytical solution. More... | |
| double | get_perturbation_analytical_solution () const |
| Get the perturbation to the forcing term when computing the analytical solution. More... | |
Public Member Functions inherited from DynamicalSystem | |
| DynamicalSystem (int order, double tau, Eigen::VectorXd initial_state, Eigen::VectorXd attractor_state, std::string name) | |
| Initialization constructor. More... | |
| virtual | ~DynamicalSystem (void) |
| Destructor. | |
| void | integrateStart (const Eigen::VectorXd &x_init, Eigen::Ref< Eigen::VectorXd > x, Eigen::Ref< Eigen::VectorXd > xd) |
| Start integrating the system with a new initial state. More... | |
| virtual void | integrateStep (double dt, const Eigen::Ref< const Eigen::VectorXd > x, Eigen::Ref< Eigen::VectorXd > x_updated, Eigen::Ref< Eigen::VectorXd > xd_updated) const |
| Integrate the system one time step. More... | |
| void | set_integration_method (IntegrationMethod integration_method) |
| Choose the integration method. More... | |
| int | dim (void) const |
| Get the dimensionality of the dynamical system, i.e. More... | |
| int | dim_orig (void) const |
| Get the dimensionality of the dynamical system, i.e. More... | |
| double | tau (void) const |
| Accessor function for the time constant. More... | |
| Eigen::VectorXd | initial_state (void) const |
| Accessor function for the initial state of the dynamical system. More... | |
| void | initial_state (Eigen::VectorXd &initial_state) const |
| Accessor function for the initial state of the dynamical system. More... | |
| Eigen::VectorXd | attractor_state (void) const |
| Accessor function for the attractor state of the dynamical system. More... | |
| void | attractor_state (Eigen::VectorXd &attractor_state) const |
| Accessor function for the attractor state of the dynamical system. More... | |
| virtual void | set_attractor_state (const Eigen::Ref< const Eigen::VectorXd > &attractor_state) |
| Mutator function for the attractor state of the dynamical system. More... | |
| std::string | name (void) const |
| Accessor function for the name of the dynamical system. More... | |
| virtual void | set_name (std::string name) |
| Mutator function for the name of the dynamical system. More... | |
Public Member Functions inherited from Parameterizable | |
| virtual | ~Parameterizable (void) |
| Destructor. | |
| virtual int | getParameterVectorSelectedSize (void) const |
| Get the size of the vector of selected parameters, as returned by getParameterVectorSelected(. More... | |
| virtual void | getParameterVectorSelected (Eigen::VectorXd &values, bool normalized=false) const |
| Get the values of the selected parameters in one vector. More... | |
| virtual void | getParameterVectorSelectedNormalized (Eigen::VectorXd &values) const |
| Get the normalized values of the selected parameters in one vector. More... | |
| void | getParameterVectorSelectedMinMax (Eigen::VectorXd &min, Eigen::VectorXd &max) const |
| Get the minimum and maximum of the selected parameters in one vector. More... | |
| void | getParameterVectorAllMinMax (Eigen::VectorXd &min, Eigen::VectorXd &max) const |
| Get the minimum and maximum values of the current parameter vector. More... | |
| void | getParameterVectorSelectedRanges (Eigen::VectorXd &ranges) const |
| Get the ranges of the selected parameters, i.e. More... | |
| virtual void | setParameterVectorSelected (const Eigen::VectorXd &values, bool normalized=false) |
| Set all the values of the selected parameters with one vector. More... | |
| virtual void | setParameterVectorSelectedNormalized (const Eigen::VectorXd &values) |
| Set all the values of the selected parameters with one vector of normalized values. More... | |
| void | setSelectedParametersOne (std::string selected) |
| Set the parameters that are currently selected. More... | |
| void | setParameterVectorModifier (std::string modifier, bool new_value) |
| Turn certain modifiers on or off. More... | |
| void | setVectorLengthsPerDimension (const Eigen::VectorXi &lengths_per_dimension) |
| The vector (VectorXd) with parameter values can be split into different parts (as vector<VectorXd>; this function specifices the length of each sub-vector. More... | |
| Eigen::VectorXi | getVectorLengthsPerDimension (void) const |
| Get the specified length of each vector in each dimension. More... | |
| void | getParameterVectorSelected (std::vector< Eigen::VectorXd > &values, bool normalized=false) const |
| Get the values of the selected parameters in one vector. More... | |
| void | setParameterVectorSelected (const std::vector< Eigen::VectorXd > &values, bool normalized=false) |
| Set all the values of the selected parameters with a vector of vectors. More... | |
Protected Member Functions | |
| void | trainLocal (const std::vector< Trajectory > &trajectories, const std::vector< Eigen::MatrixXd > &task_parameters, std::string save_directory, bool overwrite) |
| Train a contextual DMP. More... | |
| void | checkTrainTrajectories (const std::vector< Trajectory > &trajectories) |
| Check if several trajectories have the same duration and initial/final states. More... | |
Protected Member Functions inherited from Dmp | |
| FunctionApproximator * | function_approximator (int i_dim) const |
| Get a pointer to the function approximator for a certain dimension. More... | |
Protected Member Functions inherited from DynamicalSystem | |
| DynamicalSystem (void) | |
| Default constructor. More... | |
| void | set_dim (int dim) |
| Set the dimensionality of the dynamical system, i.e. More... | |
Protected Attributes | |
| Eigen::MatrixXd | task_parameters_ |
| The current task parameters. | |
| std::vector< FunctionApproximator * > | policy_parameter_function_goal_ |
| FunctionApproximators that relate task parameters the goal of the DMP. | |
| FunctionApproximator * | policy_parameter_function_duration_ |
| FunctionApproximator that relates task parameters the duration of the DMP. | |
Friends | |
| class | boost::serialization::access |
| Give boost serialization access to private members. More... | |
Additional Inherited Members | |
Public Types inherited from Dmp | |
| enum | DmpType { IJSPEERT_2002_MOVEMENT, KULVICIUS_2012_JOINING, COUNTDOWN_2013 } |
| Different types of DMPs that can be initialized. More... | |
| enum | ForcingTermScaling { NO_SCALING, G_MINUS_Y0_SCALING, AMPLITUDE_SCALING } |
| Different ways to scale the forcing term. More... | |
Public Types inherited from DynamicalSystem | |
| enum | IntegrationMethod { EULER, RUNGE_KUTTA } |
| The possible integration methods that can be used. More... | |
Implementation of Contextual Dynamical Movement Primitives.
Contextual Dmp extends a 'standard' Dmp by adapting to task parameters.
This is how a 'standard' Dmp would be integrated
A contextual Dmp is integrated as follows.
Or, if the task parameters change over time.
Definition at line 79 of file DmpContextual.hpp.
| DmpContextual | ( | int | n_dims_dmp, |
| std::vector< FunctionApproximator * > | function_approximators, | ||
| DmpType | dmp_type | ||
| ) |
Initialization constructor for Contextual DMPs of known dimensionality, but with unknown initial and attractor states.
Initializes the DMP with default dynamical systems.
| n_dims_dmp | Dimensionality of the DMP |
| function_approximators | Function approximators for the forcing term |
| dmp_type | The type of DMP, see Dmp::DmpType |
Definition at line 39 of file DmpContextual.cpp.
| void set_task_parameters | ( | const Eigen::MatrixXd & | task_parameters | ) |
Set the current task parameters.
| [in] | task_parameters | Current task parameters |
Definition at line 140 of file DmpContextual.cpp.

| void set_policy_parameter_function_goal | ( | FunctionApproximator * | function_approximator | ) |
Set a function approximator to predict the goal from the task parameters.
| [in] | function_approximator | The function approximator. |
Definition at line 46 of file DmpContextual.cpp.

| void set_policy_parameter_function_duration | ( | FunctionApproximator * | function_approximator | ) |
Set a function approximator to predict the duration from the task parameters.
| [in] | function_approximator | The function approximator. |
Definition at line 56 of file DmpContextual.cpp.

|
pure virtual |
Compute the outputs of the function approximators.
| [in] | phase_state | The phase states for which the outputs are computed. |
| [out] | fa_output | The outputs of the function approximators. |
Reimplemented from Dmp.
Implemented in DmpContextualTwoStep, and DmpContextualOneStep.
|
protected |
Train a contextual DMP.
All other train functions in this class directly or indirectly call this function. This function trains the function approximators for the policy parameter function for the goal and tau parameters. It then calls the train function in the subclasses (e.g. DmpContextualOneStep::train() or DmpContextualTwoStep::train() to train the forcing term.
| [in] | trajectories | The set of trajectories |
| [in] | task_parameters | The task parameters for each of the trajectories. |
| [in] | save_directory | Directory to which to save intermediate results. |
| [in] | overwrite | Overwrite existing files in the directory above |
Definition at line 82 of file DmpContextual.cpp.

|
pure virtual |
Train a contextual Dmp with a set of trajectories (and save results to file) This function is useful for debugging, i.e.
if you want to save intermediate results to a directory
| [in] | trajectories | The set of trajectories |
| [in] | task_parameters | The task parameters for each of the trajectories. |
| [in] | save_directory | Directory to which to save intermediate results. |
| [in] | overwrite | Overwrite existing files in the directory above Overloads Dmp::train |
Implemented in DmpContextualTwoStep, and DmpContextualOneStep.
| void train | ( | const std::vector< Trajectory > & | trajectories, |
| const std::vector< Eigen::MatrixXd > & | task_parameters, | ||
| std::string | save_directory | ||
| ) |
Train a contextual DMP with multiple trajectories.
| [in] | trajectories | A set of demonstrated trajectories |
| [in] | task_parameters | The task_parameters for each trajectory. It is a std::vector, where each task parameter element corresponds to one Trajectory. Each element is a matrix of size n_time_steps x n_task_paramaters |
| [in] | save_directory | Directory to which to save intermediate results. Does not overwrite existing files. |
Definition at line 68 of file DmpContextual.cpp.

| void train | ( | const std::vector< Trajectory > & | trajectories, |
| const std::vector< Eigen::MatrixXd > & | task_parameters | ||
| ) |
Train a contextual DMP with multiple trajectories.
| [in] | trajectories | A set of demonstrated trajectories |
| [in] | task_parameters | The task_parameters for each trajectory. It is a std::vector, where each task parameter element corresponds to one Trajectory. Each element is a matrix of size n_time_steps x n_task_paramaters |
Definition at line 74 of file DmpContextual.cpp.

| void train | ( | const std::vector< Trajectory > & | trajectories, |
| std::string | save_directory, | ||
| bool | overwrite | ||
| ) |
Train a contextual DMP with multiple trajectories.
| [in] | trajectories | A set of demonstrated trajectories, the task parameters are stored as miscellaneous variables in the trajectory, see also Trajectory::misc() |
| [in] | save_directory | Directory to which to save intermediate results |
| [in] | overwrite | Overwrite existing files in the directory above |
Definition at line 170 of file DmpContextual.cpp.

| void train | ( | const std::vector< Trajectory > & | trajectories, |
| std::string | save_directory | ||
| ) |
Train a contextual DMP with multiple trajectories.
| [in] | trajectories | A set of demonstrated trajectories, the task parameters are stored as miscellaneous variables in the trajectory, see also Trajectory::misc() |
| [in] | save_directory | Directory to which to save intermediate results. Does not overwrite existing files. |
Definition at line 183 of file DmpContextual.cpp.

| void train | ( | const std::vector< Trajectory > & | trajectories | ) |
Train a contextual DMP with multiple trajectories.
| [in] | trajectories | A set of demonstrated trajectories, the task parameters are stored as miscellaneous variables in the trajectory, see also Trajectory::misc() |
Definition at line 189 of file DmpContextual.cpp.

|
protected |
Check if several trajectories have the same duration and initial/final states.
| [in] | trajectories | A set of trajectories |
Definition at line 197 of file DmpContextual.cpp.
|
friend |
Give boost serialization access to private members.
Definition at line 190 of file DmpContextual.hpp.
1.8.11