3 #include "drake/solvers/branch_and_bound.h"
5 #include "drake/solvers/osqp_solver.h"
10 drake::solvers::MathematicalProgram prog;
16 ROS_INFO(
"adding decision variables");
19 ROS_INFO(
"setting initial and goal position");
22 ROS_INFO(
"setting relative position limits");
25 ROS_INFO(
"setting geometry limits");
26 geometry_limits(prog, n_points, length_legs, bbox_len, decision_variables);
28 ROS_INFO(
"setting theta limits");
31 ROS_INFO(
"one stone per foot");
34 ROS_INFO(
"foot in stepping stone");
37 ROS_INFO(
"minimize step length");
40 ROS_INFO(
"minimize theta change");
44 drake::solvers::MixedIntegerBranchAndBound bb(prog, drake::solvers::OsqpSolver::id());
53 drake::solvers::SolutionResult result = bb.Solve();
54 ROS_INFO(
"done solving");
55 if (result != drake::solvers::kSolutionFound)
57 ROS_ERROR(
"Infeasible optimization problem.");
78 decision_variables_opt.
theta = bb.GetSolution(decision_variables.
theta);
80 decision_variables_opt.
bin_sin = bb.GetSolution(decision_variables.
bin_sin);
82 decision_variables_opt.
bin_cos = bb.GetSolution(decision_variables.
bin_cos);
84 decision_variables_opt.
lin_sin = bb.GetSolution(decision_variables.
lin_sin);
86 decision_variables_opt.
lin_cos = bb.GetSolution(decision_variables.
lin_cos);
88 decision_variables_opt.
cost = bb.GetOptimalCost();
90 return decision_variables_opt;
const Eigen::Vector3d & getCenter() const
const SteppingStone & getStoneByName(std::string name) const
void foot_in_stepping_stone(drake::solvers::MathematicalProgram &prog, Terrain &terrain, int n_steps, DecVars &decision_variables)
void relative_position_limits(drake::solvers::MathematicalProgram &prog, int n_steps, double step_span, DecVars &decision_variables)
void set_initial_and_goal_position(drake::solvers::MathematicalProgram &prog, Terrain &terrain, DecVars &decision_variables)
DecVars add_decision_variables(drake::solvers::MathematicalProgram &prog, Terrain &terrain, int n_steps)
void minimize_step_length(drake::solvers::MathematicalProgram &prog, int n_steps, DecVars &decision_variables)
void one_stone_per_foot(drake::solvers::MathematicalProgram &prog, int n_steps, DecVars &decision_variables)
void theta_limits(drake::solvers::MathematicalProgram &prog, int n_steps, int n_legs, DecVars &decision_variables)
void geometry_limits(drake::solvers::MathematicalProgram &prog, int n_steps, int n_legs, double length_legs, Leg step_sequence[], Terrain &terrain, double bbox_len, DecVars &decision_variables)
void minimize_theta_change(drake::solvers::MathematicalProgram &prog, int n_points, DecVars &decision_variables)
Eigen::MatrixXd position_front_right
Eigen::MatrixXd stone_front_left
Eigen::MatrixXd position_front_left
Eigen::MatrixXd position_rear_left
Eigen::MatrixXd stone_rear_right
Eigen::MatrixXd stone_rear_left
Eigen::MatrixXd position_rear_right
Eigen::MatrixXd stone_front_right
MatrixXDecisionVariable stone_front_left
MatrixXDecisionVariable bin_cos
MatrixXDecisionVariable theta
MatrixXDecisionVariable stone_front_right
MatrixXDecisionVariable position_front_left
MatrixXDecisionVariable position_front_right
MatrixXDecisionVariable position_rear_right
MatrixXDecisionVariable lin_cos
MatrixXDecisionVariable stone_rear_right
MatrixXDecisionVariable bin_sin
MatrixXDecisionVariable lin_sin
MatrixXDecisionVariable stone_rear_left
MatrixXDecisionVariable position_rear_left
DecVars_res waypoint_planner(Terrain &terrain, int n_points, double length_legs, double bbox_len, double wp_dist)