NASA Astrobee Robot Software  0.19.1
Flight software for the Astrobee robots operating inside the International Space Station.
gurobi_solver.h
Go to the documentation of this file.
1 /* Copyright (c) 2017, United States Government, as represented by the
2  * Administrator of the National Aeronautics and Space Administration.
3  *
4  * All rights reserved.
5  *
6  * The Astrobee platform is licensed under the Apache License, Version 2.0
7  * (the "License"); you may not use this file except in compliance with the
8  * License. You may obtain a copy of the License at
9  *
10  * http://www.apache.org/licenses/LICENSE-2.0
11  *
12  * Unless required by applicable law or agreed to in writing, software
13  * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
14  * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
15  * License for the specific language governing permissions and limitations
16  * under the License.
17  */
18 
19 #ifndef TRAJ_OPT_PRO_GUROBI_SOLVER_H_
20 #define TRAJ_OPT_PRO_GUROBI_SOLVER_H_
21 
23 
24 #include <vector>
25 
26 class GRBEnv;
27 
28 namespace traj_opt {
29 
31  public:
32  GurobiSolver();
33  bool solveTrajectory(
34  const std::vector<Waypoint> &waypnts, const std::vector<MatD> &A,
35  const std::vector<VecD> &b, const std::vector<decimal_t> &ds,
36  decimal_t epsilon = 0,
37  boost::shared_ptr<Vec3Vec> points = boost::shared_ptr<Vec3Vec>(),
38  decimal_t upsilon = 0);
39  boost::shared_ptr<Trajectory> getTrajectory();
40  void addPathCost(const std::vector<MatD> &A, const std::vector<VecD> &b,
41  double epsilon);
42  bool solveConvexifyed(const std::vector<Waypoint> &waypnts, const MatD &Aobs,
43  const VecD &bobs, const MatD &Aenv, const VecD &benv,
44  const std::vector<decimal_t> &ds);
45  void seedDs(boost::shared_ptr<Vec3Vec> points, std::vector<decimal_t> *dsp);
46  void sikangSeed(boost::shared_ptr<Vec3Vec> points,
47  std::vector<decimal_t> *dsp, decimal_t v0,
48  decimal_t ratio = 1.0);
49  bool use_lp_{false};
50  void setPolyParams(int degree, PolyType type, int order);
51  void setConParam(ConstraintMode mode, int num) {
52  con_mode_ = mode;
53  num_sample_ = num;
54  }
55  decimal_t getCost() { return cost_; }
56 
57  bool checkMax(decimal_t r);
58 
59  private:
60  boost::shared_ptr<LegendreTrajectory> ltraj_;
61  decimal_t cost_;
62  // gurobi stuff
63  boost::shared_ptr<GRBEnv> grb_env_;
64  bool initializeGurobi();
65 
66  void addLineCost(boost::shared_ptr<Vec3Vec> points, double upsilon);
67  int degree_, order_;
68  PolyType polytype_;
69  ConstraintMode con_mode_;
70  int num_sample_;
71 };
72 } // namespace traj_opt
73 #endif // TRAJ_OPT_PRO_GUROBI_SOLVER_H_
mode
uint8_t mode
Definition: signal_lights.h:74
traj_opt::PolyType
PolyType
Definition: traj_data.h:27
traj_opt::MatD
Eigen::Matrix< decimal_t, Eigen::Dynamic, Eigen::Dynamic > MatD
Definition: types.h:51
traj_opt::GurobiSolver::seedDs
void seedDs(boost::shared_ptr< Vec3Vec > points, std::vector< decimal_t > *dsp)
traj_opt::GurobiSolver::sikangSeed
void sikangSeed(boost::shared_ptr< Vec3Vec > points, std::vector< decimal_t > *dsp, decimal_t v0, decimal_t ratio=1.0)
traj_opt::GurobiSolver::getCost
decimal_t getCost()
Definition: gurobi_solver.h:55
traj_opt::GurobiSolver::addPathCost
void addPathCost(const std::vector< MatD > &A, const std::vector< VecD > &b, double epsilon)
traj_opt::ConstraintMode
ConstraintMode
Definition: gurobi_trajectory.h:119
traj_opt::decimal_t
double decimal_t
Definition: types.h:35
traj_opt::GurobiSolver::checkMax
bool checkMax(decimal_t r)
traj_opt::GurobiSolver::GurobiSolver
GurobiSolver()
traj_opt
Definition: msg_traj.h:27
gurobi_trajectory.h
traj_opt::GurobiSolver::setConParam
void setConParam(ConstraintMode mode, int num)
Definition: gurobi_solver.h:51
traj_opt::TrajectorySolver
Definition: trajectory_solver.h:46
traj_opt::GurobiSolver::solveTrajectory
bool solveTrajectory(const std::vector< Waypoint > &waypnts, const std::vector< MatD > &A, const std::vector< VecD > &b, const std::vector< decimal_t > &ds, decimal_t epsilon=0, boost::shared_ptr< Vec3Vec > points=boost::shared_ptr< Vec3Vec >(), decimal_t upsilon=0)
traj_opt::GurobiSolver
Definition: gurobi_solver.h:30
traj_opt::GurobiSolver::use_lp_
bool use_lp_
Definition: gurobi_solver.h:49
traj_opt::GurobiSolver::solveConvexifyed
bool solveConvexifyed(const std::vector< Waypoint > &waypnts, const MatD &Aobs, const VecD &bobs, const MatD &Aenv, const VecD &benv, const std::vector< decimal_t > &ds)
traj_opt::VecD
Eigen::Matrix< decimal_t, Eigen::Dynamic, 1 > VecD
Definition: types.h:49
traj_opt::GurobiSolver::setPolyParams
void setPolyParams(int degree, PolyType type, int order)
traj_opt::GurobiSolver::getTrajectory
boost::shared_ptr< Trajectory > getTrajectory()