Crocoddyl
Loading...
Searching...
No Matches
wrench-cone.hpp
1
2// BSD 3-Clause License
3//
4// Copyright (C) 2020-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_WRENCH_CONE_HPP_
11#define CROCODDYL_MULTIBODY_WRENCH_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
32template <typename _Scalar>
33class WrenchConeTpl {
34 public:
35 EIGEN_MAKE_ALIGNED_OPERATOR_NEW
36
37 typedef _Scalar Scalar;
38 typedef MathBaseTpl<Scalar> MathBase;
39 typedef typename MathBase::Vector2s Vector2s;
40 typedef typename MathBase::Vector3s Vector3s;
41 typedef typename MathBase::Matrix3s Matrix3s;
42 typedef typename MathBase::Matrix6s Matrix6s;
43 typedef typename MathBase::VectorXs VectorXs;
44 typedef typename MathBase::MatrixXs MatrixXs;
45 typedef typename MathBase::MatrixX3s MatrixX3s;
46 typedef typename MathBase::MatrixX6s MatrixX6s;
47 typedef typename MathBase::Quaternions Quaternions;
48
49 template <typename>
50 friend class WrenchConeTpl;
51
66 const Matrix3s& R, const Scalar mu, const Vector2s& box,
67 const std::size_t nf = 4, const bool inner_appr = true,
68 const Scalar min_nforce = Scalar(0.),
69 const Scalar max_nforce = std::numeric_limits<Scalar>::infinity());
70 DEPRECATED("Use constructor that includes inner_appr",
71 WrenchConeTpl(const Matrix3s& R, const Scalar mu,
72 const Vector2s& box, std::size_t nf,
73 const Scalar min_nforce,
74 const Scalar max_nforce =
75 std::numeric_limits<Scalar>::infinity());)
76
82 WrenchConeTpl(const WrenchConeTpl<Scalar>& cone);
83
87 explicit WrenchConeTpl();
88 ~WrenchConeTpl();
89
99 void update();
100 DEPRECATED("Use update().",
101 void update(const Matrix3s& R, const Scalar mu,
102 const Vector2s& box,
103 const Scalar min_nforce = Scalar(0.),
104 const Scalar max_nforce =
105 std::numeric_limits<Scalar>::infinity()));
106
115 template <typename NewScalar>
116 WrenchConeTpl<NewScalar> cast() const;
117
121 const MatrixX6s& get_A() const;
122
126 const VectorXs& get_lb() const;
127
131 const VectorXs& get_ub() const;
132
136 std::size_t get_nf() const;
137
142 const Matrix3s& get_R() const;
143
147 const Vector2s& get_box() const;
148
152 const Scalar get_mu() const;
153
158 bool get_inner_appr() const;
159
163 const Scalar get_min_nforce() const;
164
168 const Scalar get_max_nforce() const;
169
177 void set_R(const Matrix3s& R);
178
185 void set_box(const Vector2s& box);
186
193 void set_mu(const Scalar mu);
194
202 void set_inner_appr(const bool inner_appr);
203
210 void set_min_nforce(const Scalar min_nforce);
211
218 void set_max_nforce(const Scalar max_nforce);
219
220 WrenchConeTpl<Scalar>& operator=(const WrenchConeTpl<Scalar>& other);
221
222 template <class Scalar>
223 friend std::ostream& operator<<(std::ostream& os,
224 const WrenchConeTpl<Scalar>& X);
225
226 private:
227 std::size_t nf_;
228 MatrixX6s A_;
229 VectorXs ub_;
230 VectorXs lb_;
231 Matrix3s R_;
232 Vector2s box_;
233 Scalar mu_;
234 bool inner_appr_;
236 Scalar min_nforce_;
237 Scalar max_nforce_;
238};
239
240} // namespace crocoddyl
241
242#include "crocoddyl/multibody/wrench-cone.hxx"
243
244CROCODDYL_DECLARE_EXTERN_TEMPLATE_CLASS(crocoddyl::WrenchConeTpl)
245
246#endif // CROCODDYL_MULTIBODY_WRENCH_CONE_HPP_
This class encapsulates a wrench cone.
void set_max_nforce(const Scalar max_nforce)
Modify the maximum normal force.
const VectorXs & get_ub() const
Return the upper bound of inequalities.
bool get_inner_appr() const
Return the label that describes the type of friction cone approximation (inner/outer).
const Vector2s & get_box() const
Return dimension of the foot surface dim = (length, width).
WrenchConeTpl(const Matrix3s &R, const Scalar mu, const Vector2s &box, const 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.
const Matrix3s & get_R() const
Return the rotation matrix that defines the cone orientation w.r.t. the inertial frame.
void set_box(const Vector2s &box)
Modify dimension of the foot surface dim = (length, width).
const Scalar get_max_nforce() const
Return the maximum normal force.
WrenchConeTpl()
Initialize the wrench cone.
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 friction coefficient.
void set_min_nforce(const Scalar min_nforce)
Modify the minium normal force.
std::size_t get_nf() const
Return the number of facets.
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 inequalities.
WrenchConeTpl< NewScalar > cast() const
Cast the wrench cone to a different scalar type.
const Scalar get_min_nforce() const
Return the minimum normal force.
void set_mu(const Scalar mu)
Modify friction coefficient.
const MatrixX6s & get_A() const
Return the matrix of wrench cone.
void update()
Update the matrix of wrench cone inequalities in the world frame.
DEPRECATED("Use constructor that includes inner_appr", WrenchConeTpl(const Matrix3s &R, const Scalar mu, const Vector2s &box, std::size_t nf, const Scalar min_nforce, const Scalar max_nforce=std::numeric_limits< Scalar >::infinity());) WrenchConeTpl(const WrenchConeTpl< Scalar > &cone)
Initialize the wrench cone.