crocoddyl  1.7.0
Contact RObot COntrol by Differential DYnamic programming Library (Crocoddyl)
friction-cone.hpp
1 // BSD 3-Clause License
3 //
4 // Copyright (C) 2019-2021, University of Edinburgh, University of Oxford
5 // Copyright note valid unless otherwise stated in individual files.
6 // All rights reserved.
8 
9 #ifndef CROCODDYL_MULTIBODY_FRICTION_CONE_HPP_
10 #define CROCODDYL_MULTIBODY_FRICTION_CONE_HPP_
11 
12 #include "crocoddyl/multibody/fwd.hpp"
13 #include "crocoddyl/core/mathbase.hpp"
14 #include "crocoddyl/core/utils/deprecate.hpp"
15 
16 namespace crocoddyl {
17 
26 template <typename _Scalar>
28  public:
29  EIGEN_MAKE_ALIGNED_OPERATOR_NEW
30 
31  typedef _Scalar Scalar;
33  typedef typename MathBase::Vector3s Vector3s;
34  typedef typename MathBase::Matrix3s Matrix3s;
35  typedef typename MathBase::VectorXs VectorXs;
36  typedef typename MathBase::MatrixXs MatrixXs;
37  typedef typename MathBase::MatrixX3s MatrixX3s;
38  typedef typename MathBase::Quaternions Quaternions;
39 
43  explicit FrictionConeTpl();
44 
55  FrictionConeTpl(const Matrix3s& R, const Scalar mu, std::size_t nf = 4, const bool inner_appr = true,
56  const Scalar min_nforce = Scalar(0.), const Scalar max_nforce = std::numeric_limits<Scalar>::max());
57  DEPRECATED("Use constructor based on rotation matrix.",
58  FrictionConeTpl(const Vector3s& normal, const Scalar mu, std::size_t nf = 4, const bool inner_appr = true,
59  const Scalar min_nforce = Scalar(0.),
60  const Scalar max_nforce = std::numeric_limits<Scalar>::max());)
61 
68  ~FrictionConeTpl();
69 
78  void update();
79  DEPRECATED("Use update()", void update(const Vector3s& normal, const Scalar mu, const bool inner_appr = true,
80  const Scalar min_nforce = Scalar(0.),
81  const Scalar max_nforce = std::numeric_limits<Scalar>::max()));
82 
86  const MatrixX3s& get_A() const;
87 
91  const VectorXs& get_ub() const;
92 
96  const VectorXs& get_lb() const;
97 
101  std::size_t get_nf() const;
102 
106  const Matrix3s& get_R() const;
107 
108  DEPRECATED("Use get_R.", Vector3s get_nsurf();)
109 
113  const Scalar get_mu() const;
114 
118  bool get_inner_appr() const;
119 
123  const Scalar get_min_nforce() const;
124 
128  const Scalar get_max_nforce() const;
129 
135  void set_R(const Matrix3s& R);
136 
137  DEPRECATED("Use set_R.", void set_nsurf(const Vector3s& nsurf);)
138 
144  void set_mu(const Scalar mu);
145 
151  void set_inner_appr(const bool inner_appr);
152 
158  void set_min_nforce(const Scalar min_nforce);
159 
165  void set_max_nforce(const Scalar max_nforce);
166 
167  FrictionConeTpl<Scalar>& operator=(const FrictionConeTpl<Scalar>& other);
168 
169  template <class Scalar>
170  friend std::ostream& operator<<(std::ostream& os, const FrictionConeTpl<Scalar>& X);
171 
172  private:
173  std::size_t nf_;
174  MatrixX3s A_;
175  VectorXs ub_;
176  VectorXs lb_;
177  Matrix3s R_;
178  Scalar mu_;
179  bool inner_appr_;
180  Scalar min_nforce_;
181  Scalar max_nforce_;
182 };
183 
184 } // namespace crocoddyl
185 /* --- Details -------------------------------------------------------------- */
186 /* --- Details -------------------------------------------------------------- */
187 /* --- Details -------------------------------------------------------------- */
188 #include "crocoddyl/multibody/friction-cone.hxx"
189 
190 #endif // CROCODDYL_MULTIBODY_FRICTION_CONE_HPP_
const Matrix3s & get_R() const
Return the surface normal vector.
bool get_inner_appr() const
Return the label that describes the type of friction cone approximation (inner/outer) ...
void set_mu(const Scalar mu)
Modify friction coefficient.
This class encapsulates a friction cone.
void update()
Update the matrix and bound of friction cone inequalities in the world frame.
void set_inner_appr(const bool inner_appr)
Modify the label that describes the type of friction cone approximation (inner/outer) ...
void set_min_nforce(const Scalar min_nforce)
Modify the maximum normal force.
void set_R(const Matrix3s &R)
Modify the rotation matrix that defines the cone orientation w.r.t. the inertial frame.
void set_max_nforce(const Scalar max_nforce)
Modify the maximum normal force.
const VectorXs & get_ub() const
Return the upper bound of the friction cone.
const Scalar get_max_nforce() const
Return the maximum normal force.
const MatrixX3s & get_A() const
Return the matrix of friction cone.
const Scalar get_min_nforce() const
Return the minimum normal force.
DEPRECATED("Use constructor based on rotation matrix.", FrictionConeTpl(const Vector3s &normal, const Scalar mu, std::size_t nf=4, const bool inner_appr=true, const Scalar min_nforce=Scalar(0.), const Scalar max_nforce=std::numeric_limits< Scalar >::max());) FrictionConeTpl(const FrictionConeTpl< Scalar > &cone)
Initialize the wrench cone.
const Scalar get_mu() const
Return the friction coefficient.
const VectorXs & get_lb() const
Return the lower bound of the friction cone.
std::size_t get_nf() const
Return the number of facets.
FrictionConeTpl()
Initialize the friction cone.