6 #ifndef INCLUDE_CT_RBD_SLQ_FLOATINGBASESLQ_H_ 7 #define INCLUDE_CT_RBD_SLQ_FLOATINGBASESLQ_H_ 9 #include <ct/core/systems/linear/SystemLinearizer.h> 11 #include <ct/optcon/ilqg/iLQGMP.hpp> 23 template <
class RBDDynamics>
27 EIGEN_MAKE_ALIGNED_OPERATOR_NEW
36 typedef ct::optcon::iLQGMP<FBSystem::STATE_DIM, FBSystem::CONTROL_DIM>
iLQG;
37 typedef ct::optcon::iLQGMP<FBSystem::STATE_DIM, FBSystem::CONTROL_DIM>
iLQGMP;
40 typedef ct::rbd::TermTaskspace<FBSystem::Kinematics, true, FBSystem::STATE_DIM, FBSystem::CONTROL_DIM>
47 const std::string& costFunctionFile,
48 std::shared_ptr<LinearizedSystem> linearizedSystem =
nullptr,
50 : system_(system), linearizedSystem_(linearizedSystem), useMP_(useMP), iteration_(0)
53 if (linearizedSystem_ ==
nullptr)
54 linearizedSystem_ = std::shared_ptr<LinearizedSystem>(
new SystemLinearizer(system));
56 setupCostFunction(costFunctionFile);
58 ilqg_ = std::shared_ptr<iLQG>(
new iLQG(system_, linearizedSystem_, costFunction_));
59 ilqgMp_ = std::shared_ptr<iLQGMP>(
new iLQGMP(system_, linearizedSystem_, costFunction_));
68 foundBetter = ilqgMp_->runIteration(ilqg_settings_, line_search_settings_);
69 stateTrajectory = ilqgMp_->retrieveLastRollout();
73 foundBetter = ilqg_->runIteration(ilqg_settings_, line_search_settings_);
74 stateTrajectory = ilqg_->retrieveLastRollout();
83 void setupCostFunction(
const std::string& filename)
85 costFunction_ = std::shared_ptr<CostFunction>(
new CostFunction(filename,
true));
87 for (
size_t i = 0;
i < N_EE;
i++)
89 eePosTerms_.push_back(
new TaskSpaceTerm(filename,
"eePos" + std::to_string(
i),
true));
90 costFunction_->addIntermediateTerm(eePosTerms_.back());
94 std::shared_ptr<FBSystem> system_;
95 std::shared_ptr<LinearizedSystem> linearizedSystem_;
97 std::shared_ptr<iLQG> ilqg_;
98 std::shared_ptr<iLQG> ilqgMp_;
100 std::shared_ptr<CostFunction> costFunction_;
101 std::vector<std::shared_ptr<TaskSpaceTerm>> eePosTerms_;
103 ilqg_settings_t ilqg_settings_;
104 line_search_settings_t line_search_settings_;
ct::optcon::iLQGMP< FBSystem::STATE_DIM, FBSystem::CONTROL_DIM > iLQGMP
Definition: FloatingBaseSLQ.h:37
ct::rbd::TermTaskspace< FBSystem::Kinematics, true, FBSystem::STATE_DIM, FBSystem::CONTROL_DIM > TaskSpaceTerm
Definition: FloatingBaseSLQ.h:41
SLQ for floating base systems without an explicit contact model. The contact constraint is enforced v...
Definition: FloatingBaseSLQ.h:24
static EIGEN_MAKE_ALIGNED_OPERATOR_NEW const bool quatIntegration
Definition: FloatingBaseSLQ.h:29
iLQG::StateTrajectory StateTrajectory
Definition: FloatingBaseSLQ.h:43
ct::optcon::iLQGMP< FBSystem::STATE_DIM, FBSystem::CONTROL_DIM > iLQG
Definition: FloatingBaseSLQ.h:36
A floating base rigid body system that uses forward dynamics. The input vector is assumed to consist ...
Definition: FloatingBaseFDSystem.h:21
ct::core::SystemLinearizer< FBSystem::STATE_DIM, FBSystem::CONTROL_DIM > SystemLinearizer
Definition: FloatingBaseSLQ.h:34
ct::optcon::CostFunctionAnalytical< FBSystem::STATE_DIM, FBSystem::CONTROL_DIM > CostFunction
Definition: FloatingBaseSLQ.h:39
ct::core::LinearSystem< FBSystem::STATE_DIM, FBSystem::CONTROL_DIM > LinearizedSystem
Definition: FloatingBaseSLQ.h:33
FloatingBaseFDSystem< RBDDynamics, false, true > FBSystem
Definition: FloatingBaseSLQ.h:32
FloatingBaseSLQ(std::shared_ptr< FBSystem > system, const std::string &costFunctionFile, std::shared_ptr< LinearizedSystem > linearizedSystem=nullptr, bool useMP=true)
Definition: FloatingBaseSLQ.h:46
ilqg_settings_t iLQGSettings()
Definition: FloatingBaseSLQ.h:81
bool runIteration(StateTrajectory &stateTrajectory)
Definition: FloatingBaseSLQ.h:62
static const bool eeForcesAreControlInputs
Definition: FloatingBaseSLQ.h:30