14 #include <Eigen/Eigen> 16 #include <solver/interface/Solver.hpp> 29 typedef Eigen::Matrix< double, 4, 3> ConeMat;
30 void getCone(
double fcoeff, FrictionCone::ConeMat& cone_mat)
32 if (fcoeff <= 0.001) { fcoeff = 0.001; }
33 Eigen::Vector3d fconevec = Eigen::Vector3d(0.5*sqrt(2.0), 0.5*sqrt(2.0), -fcoeff); fconevec.normalize();
34 Eigen::Matrix3d fconemat = Eigen::Matrix3d::Identity();
35 double angle = 2*M_PI/4;
36 fconemat(0,0) = cos(angle); fconemat(0,1) = -sin(angle);
37 fconemat(1,0) = sin(angle); fconemat(1,1) = cos(angle);
38 for (
int i=0; i<4; i++) {
39 cone_mat.row(i) = fconevec;
40 fconevec = fconemat * fconevec;
49 EIGEN_MAKE_ALIGNED_OPERATOR_NEW
83 const double&
solveTime()
const {
return solve_time_; }
88 inline const PlannerSetting& getSetting()
const {
return *planner_setting_; }
91 const ContactType contactType(
int time_id,
int eff_id)
const;
92 const Eigen::Matrix3d contactRotation(
int time_id,
int eff_id)
const;
93 const double contactLocation(
int time_id,
int eff_id,
int axis_id)
const;
99 void initializeOptimizationVariables();
108 void addVariableToModel(
const solver::OptimizationVariable& opt_var, solver::Model& model, std::vector<solver::Var>& vars);
116 void internalOptimize(
const KinematicsSequence& kin_sequence,
bool is_first_time =
false);
117 void updateTrackingObjective();
126 void saveSolution(solver::OptimizationVariable& opt_var);
127 void storeSolution();
142 solver::DCPQuadExpr quad_objective_, quad_cons_;
161 FrictionCone::ConeMat cone_matrix_;
194 solver::OptimizationVariable
dt_, com_, lmom_, amom_, lmomd_, amomd_;
195 std::array<solver::OptimizationVariable, Problem::n_endeffs_> frc_world_, trq_local_, cop_local_, ub_var_, lb_var_;
199 solver::OptimizationVariable::OptMatrix mat_lb_, mat_ub_, mat_guess_, com_guess_, lmom_guess_, amom_guess_;
Helper class to define a linear approximation of a friction cone.
Definition: DynamicsOptimizer.hpp:27
char variable_type_
Definition: DynamicsOptimizer.hpp:179
ContactPlanInterface * contact_plan_
helper class to store information about the contact plan, such as surfaces, position and orientation ...
Definition: DynamicsOptimizer.hpp:173
solver::OptimizationVariable::OptVector solution_
Definition: DynamicsOptimizer.hpp:198
ContactType
Definition of contact type: FlatContact: forces subject to friction cone constrains of flat surface F...
Definition: ContactState.hpp:26
solver::ExitCode exitcode_
Definition: DynamicsOptimizer.hpp:145
DynamicsState ini_state_
initial configuration of the robot, including center of mass position, linear and angular momenta...
Definition: DynamicsOptimizer.hpp:157
This class is a container for all variables required to define a dynamic state: center of mass positi...
Definition: DynamicsState.hpp:29
double solve_time_
Definition: DynamicsOptimizer.hpp:188
PlannerSetting & getSetting()
Definition: DynamicsOptimizer.hpp:87
bool has_converged_
Definition: DynamicsOptimizer.hpp:182
Definition: DynamicsOptimizer.hpp:46
DynamicsSequence & dynamicsSequence()
this function gives access to the optimized motion plan
Definition: DynamicsOptimizer.hpp:79
DynamicsSequence dyn_sequence_
dynamics sequence of dynamic states.
Definition: DynamicsOptimizer.hpp:167
Definition: PlannerSetting.hpp:22
FrictionCone friction_cone_
Definition: DynamicsOptimizer.hpp:160
solver::Model model_
class that stores all information about the problem, interfaces between high level definition of the ...
Definition: DynamicsOptimizer.hpp:138
This class is a container for a sequence of dynamic states, for all time steps in the optimization...
Definition: DynamicsState.hpp:123
Helper class to measure time required to run an optimization procedure.
Definition: Clock.hpp:18
const double & solveTime() const
Definition: DynamicsOptimizer.hpp:83
std::vector< solver::Var > vars_
c++ vector containing all problem variables defined by the user.
Definition: DynamicsOptimizer.hpp:151
This class is a container for a sequence of kinematic states.
Definition: KinematicsState.hpp:211
solver::OptimizationVariable dt_
Definition: DynamicsOptimizer.hpp:194
Clock timer_
Definition: DynamicsOptimizer.hpp:176
Eigen::Vector3d com_pos_goal_
Definition: DynamicsOptimizer.hpp:191
DynamicsOptimizer()
Definition: DynamicsOptimizer.hpp:53
solver::LinExpr lin_cons_
Definition: DynamicsOptimizer.hpp:141
int size_
Definition: DynamicsOptimizer.hpp:185
PlannerSetting * planner_setting_
Definition: DynamicsOptimizer.hpp:132