Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030 #include <towr/variables/spline_holder.h>
00031 #include <towr/variables/phase_spline.h>
00032
00033 namespace towr{
00034
00035 SplineHolder::SplineHolder (NodesVariables::Ptr base_lin_nodes,
00036 NodesVariables::Ptr base_ang_nodes,
00037 const std::vector<double>& base_poly_durations,
00038 std::vector<NodesVariablesPhaseBased::Ptr> ee_motion_nodes,
00039 std::vector<NodesVariablesPhaseBased::Ptr> ee_force_nodes,
00040 std::vector<PhaseDurations::Ptr> phase_durations,
00041 bool durations_change)
00042 {
00043 base_linear_ = std::make_shared<NodeSpline>(base_lin_nodes.get(), base_poly_durations);
00044 base_angular_ = std::make_shared<NodeSpline>(base_ang_nodes.get(), base_poly_durations);
00045 phase_durations_ = phase_durations;
00046
00047 for (uint ee=0; ee<ee_motion_nodes.size(); ++ee) {
00048 if (durations_change) {
00049
00050 ee_motion_.push_back(std::make_shared<PhaseSpline>(ee_motion_nodes.at(ee), phase_durations.at(ee).get()));
00051 ee_force_.push_back(std::make_shared<PhaseSpline>(ee_force_nodes.at(ee), phase_durations.at(ee).get()));
00052 } else {
00053
00054 auto ee_motion_poly_durations = ee_motion_nodes.at(ee)->ConvertPhaseToPolyDurations(phase_durations.at(ee)->GetPhaseDurations());
00055 auto ee_force_poly_durations = ee_force_nodes.at(ee)->ConvertPhaseToPolyDurations(phase_durations.at(ee)->GetPhaseDurations());
00056
00057 ee_motion_.push_back(std::make_shared<NodeSpline>(ee_motion_nodes.at(ee).get(), ee_motion_poly_durations));
00058 ee_force_.push_back (std::make_shared<NodeSpline>(ee_force_nodes.at(ee).get(), ee_force_poly_durations));
00059 }
00060 }
00061 }
00062
00063 }