24 #ifndef _DMP_CONTEXTUAL_H_ 25 #define _DMP_CONTEXTUAL_H_ 33 class FunctionApproximator;
90 DmpContextual(
int n_dims_dmp, std::vector<FunctionApproximator*> function_approximators,
DmpType dmp_type);
109 const Eigen::Ref<const Eigen::MatrixXd>& phase_state, Eigen::MatrixXd& fa_output)
const = 0;
122 void trainLocal(
const std::vector<Trajectory>& trajectories,
const std::vector<Eigen::MatrixXd>& task_parameters, std::string save_directory,
bool overwrite);
134 virtual void train(
const std::vector<Trajectory>& trajectories,
const std::vector<Eigen::MatrixXd>& task_parameters, std::string save_directory,
bool overwrite) = 0;
141 void train(
const std::vector<Trajectory>& trajectories,
const std::vector<Eigen::MatrixXd>& task_parameters, std::string save_directory);
147 void train(
const std::vector<Trajectory>& trajectories,
const std::vector<Eigen::MatrixXd>& task_parameters);
154 void train(
const std::vector<Trajectory>& trajectories, std::string save_directory,
bool overwrite);
160 void train(
const std::vector<Trajectory>& trajectories, std::string save_directory);
165 void train(
const std::vector<Trajectory>& trajectories);
201 template<
class Archive>
202 void serialize(Archive & ar,
const unsigned int version)
205 ar & BOOST_SERIALIZATION_BASE_OBJECT_NVP(
Dmp);
215 #include <boost/serialization/export.hpp> BOOST_SERIALIZATION_ASSUME_ABSTRACT(DmpBbo::DmpContextual)
Don't add version information to archives.
Implementation of Dynamical Movement Primitives.
std::vector< FunctionApproximator * > policy_parameter_function_goal_
FunctionApproximators that relate task parameters the goal of the DMP.
BOOST_CLASS_IMPLEMENTATION(DmpBbo::DmpContextual, boost::serialization::object_serializable)
Don't add version information to archives.
FunctionApproximator * policy_parameter_function_duration_
FunctionApproximator that relates task parameters the duration of the DMP.
void set_policy_parameter_function_goal(FunctionApproximator *function_approximator)
Set a function approximator to predict the goal from the task parameters.
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 ...
Base class for all function approximators.
void trainLocal(const std::vector< Trajectory > &trajectories, const std::vector< Eigen::MatrixXd > &task_parameters, std::string save_directory, bool overwrite)
Train a contextual DMP.
Implementation of Contextual Dynamical Movement Primitives.
DmpType
Different types of DMPs that can be initialized.
friend class boost::serialization::access
Give boost serialization access to private members.
void set_policy_parameter_function_duration(FunctionApproximator *function_approximator)
Set a function approximator to predict the duration from the task parameters.
FunctionApproximator * function_approximator(int i_dim) const
Get a pointer to the function approximator for a certain dimension.
Eigen::MatrixXd task_parameters_
The current task parameters.
virtual void computeFunctionApproximatorOutput(const Eigen::Ref< const Eigen::MatrixXd > &phase_state, Eigen::MatrixXd &fa_output) const =0
Compute the outputs of the function approximators.
void checkTrainTrajectories(const std::vector< Trajectory > &trajectories)
Check if several trajectories have the same duration and initial/final states.
void set_task_parameters(const Eigen::MatrixXd &task_parameters)
Set the current task parameters.