Crocoddyl
Loading...
Searching...
No Matches
friction-cone.hpp
1
2// BSD 3-Clause License
3//
4// Copyright (C) 2019-2026, University of Edinburgh, University of Oxford,
5// Heriot-Watt University
6// Copyright note valid unless otherwise stated in individual files.
7// All rights reserved.
9
10#ifndef CROCODDYL_MULTIBODY_FRICTION_CONE_HPP_
11#define CROCODDYL_MULTIBODY_FRICTION_CONE_HPP_
12
13#include "crocoddyl/core/utils/conversions.hpp"
14#include "crocoddyl/core/utils/deprecate.hpp"
15#include "crocoddyl/multibody/fwd.hpp"
16
17namespace crocoddyl {
18
28template <typename _Scalar>
29class FrictionConeTpl {
30 public:
31 EIGEN_MAKE_ALIGNED_OPERATOR_NEW
32
33 typedef _Scalar Scalar;
34 typedef MathBaseTpl<Scalar> MathBase;
35 typedef typename MathBase::Vector3s Vector3s;
36 typedef typename MathBase::Matrix3s Matrix3s;
37 typedef typename MathBase::VectorXs VectorXs;
38 typedef typename MathBase::MatrixXs MatrixXs;
39 typedef typename MathBase::MatrixX3s MatrixX3s;
40 typedef typename MathBase::Quaternions Quaternions;
41
42 template <typename>
43 friend class FrictionConeTpl;
44
58 const Matrix3s& R, const Scalar mu, std::size_t nf = 4,
59 const bool inner_appr = true, const Scalar min_nforce = Scalar(0.),
60 const Scalar max_nforce = std::numeric_limits<Scalar>::infinity());
61
67 FrictionConeTpl(const FrictionConeTpl<Scalar>& cone);
68
72 explicit FrictionConeTpl();
73 ~FrictionConeTpl();
74
84 void update();
85 DEPRECATED("Use update()",
86 void update(const Vector3s& normal, const Scalar mu,
87 const bool inner_appr = true,
88 const Scalar min_nforce = Scalar(0.),
89 const Scalar max_nforce =
90 std::numeric_limits<Scalar>::infinity()));
91
101 template <typename NewScalar>
102 FrictionConeTpl<NewScalar> cast() const;
103
107 const MatrixX3s& get_A() const;
108
112 const VectorXs& get_ub() const;
113
117 const VectorXs& get_lb() const;
118
122 std::size_t get_nf() const;
123
127 const Matrix3s& get_R() const;
128
129 DEPRECATED("Use get_R.", Vector3s get_nsurf();)
130
134 const Scalar get_mu() const;
135
140 bool get_inner_appr() const;
141
145 const Scalar get_min_nforce() const;
146
150 const Scalar get_max_nforce() const;
151
159 void set_R(const Matrix3s& R);
160
161 DEPRECATED("Use set_R.", void set_nsurf(const Vector3s& nsurf);)
162
169 void set_mu(const Scalar mu);
170
178 void set_inner_appr(const bool inner_appr);
179
186 void set_min_nforce(const Scalar min_nforce);
187
194 void set_max_nforce(const Scalar max_nforce);
195
196 FrictionConeTpl<Scalar>& operator=(const FrictionConeTpl<Scalar>& other);
197
198 template <class Scalar>
199 friend std::ostream& operator<<(std::ostream& os,
200 const FrictionConeTpl<Scalar>& X);
201
202 private:
203 std::size_t nf_;
204 MatrixX3s A_;
205 VectorXs ub_;
206 VectorXs lb_;
207 Matrix3s R_;
208 Scalar mu_;
209 bool inner_appr_;
211 Scalar min_nforce_;
212 Scalar max_nforce_;
213};
214
215} // namespace crocoddyl
216/* --- Details -------------------------------------------------------------- */
217/* --- Details -------------------------------------------------------------- */
218/* --- Details -------------------------------------------------------------- */
219#include "crocoddyl/multibody/friction-cone.hxx"
220
221CROCODDYL_DECLARE_EXTERN_TEMPLATE_CLASS(crocoddyl::FrictionConeTpl)
222
223#endif // CROCODDYL_MULTIBODY_FRICTION_CONE_HPP_
This class encapsulates a friction cone.
void set_max_nforce(const Scalar max_nforce)
Modify the maximum normal force.
FrictionConeTpl< NewScalar > cast() const
Cast the friction cone to a different scalar type.
const VectorXs & get_ub() const
Return the upper bound of the friction cone.
bool get_inner_appr() const
Return the label that describes the type of friction cone approximation (inner/outer).
const Matrix3s & get_R() const
Return the surface normal vector.
const Scalar get_max_nforce() const
Return the maximum normal force.
void set_inner_appr(const bool inner_appr)
Modify the label that describes the type of friction cone approximation (inner/outer).
const Scalar get_mu() const
Return the friction coefficient.
void set_min_nforce(const Scalar min_nforce)
Modify the maximum normal force.
std::size_t get_nf() const
Return the number of facets.
FrictionConeTpl()
Initialize the friction cone.
void set_R(const Matrix3s &R)
Modify the rotation matrix that defines the cone orientation w.r.t. the inertial frame.
const VectorXs & get_lb() const
Return the lower bound of the friction cone.
const MatrixX3s & get_A() const
Return the matrix of friction cone.
const Scalar get_min_nforce() const
Return the minimum normal force.
void set_mu(const Scalar mu)
Modify friction coefficient.
void update()
Update the matrix and bound of friction cone inequalities in the world frame.
FrictionConeTpl(const FrictionConeTpl< Scalar > &cone)
Initialize the wrench cone.
FrictionConeTpl(const Matrix3s &R, 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 >::infinity())
Initialize the wrench cone.