Crocoddyl
cop-support.hpp
1 // BSD 3-Clause License
3 //
4 // Copyright (C) 2021-2025, 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_COP_SUPPORT_HPP_
11 #define CROCODDYL_MULTIBODY_COP_SUPPORT_HPP_
12 
13 #include "crocoddyl/multibody/fwd.hpp"
14 #include "crocoddyl/multibody/wrench-cone.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::Vector2s Vector2s;
34  typedef typename MathBase::Vector3s Vector3s;
35  typedef typename MathBase::Vector4s Vector4s;
36  typedef typename MathBase::Matrix3s Matrix3s;
37  typedef typename MathBase::Matrix46s Matrix46s;
38  typedef typename MathBase::Quaternions Quaternions;
39 
47  CoPSupportTpl(const Matrix3s& R, const Vector2s& box);
48 
55 
62 
66  explicit CoPSupportTpl();
67  ~CoPSupportTpl();
68 
79  void update();
80 
90  template <typename NewScalar>
92 
96  const Matrix46s& get_A() const;
97 
101  const Vector4s& get_ub() const;
102 
106  const Vector4s& get_lb() const;
107 
111  const Vector2s& get_box() const;
112 
117  const Matrix3s& get_R() const;
118 
126  void set_R(const Matrix3s& R);
127 
134  void set_box(const Vector2s& box);
135 
136  CoPSupportTpl<Scalar>& operator=(const CoPSupportTpl<Scalar>& other);
137 
138  template <class Scalar>
139  friend std::ostream& operator<<(std::ostream& os,
140  const CoPSupportTpl<Scalar>& X);
141 
142  private:
143  Matrix46s A_;
144  Vector4s ub_;
145  Vector4s lb_;
146  Matrix3s R_;
147  Vector2s box_;
148 };
149 
150 } // namespace crocoddyl
151 
152 #include "crocoddyl/multibody/cop-support.hxx"
153 
154 CROCODDYL_DECLARE_EXTERN_TEMPLATE_CLASS(crocoddyl::CoPSupportTpl)
155 
156 #endif // CROCODDYL_MULTIBODY_COP_SUPPORT_HPP_
This class encapsulates a center of pressure support of a 6d contact.
Definition: cop-support.hpp:27
const Vector4s & get_ub() const
Return the upper bound of the center of pressure support.
void set_box(const Vector2s &box)
Modify dimension of the center of pressure support (length, width)
CoPSupportTpl(const CoPSupportTpl< Scalar > &support)
Initialize the center of pressure support.
CoPSupportTpl(const Matrix3s &R, const Vector2s &box)
Initialize the center of pressure support.
const Vector4s & get_lb() const
Return the lower bound of the center of pressure support.
void set_R(const Matrix3s &R)
Modify the rotation matrix that defines the support orientation w.r.t. the inertial frame.
CoPSupportTpl()
Initialize the center of pressure support.
CoPSupportTpl(const WrenchConeTpl< Scalar > &support)
Initialize the center of pressure support.
const Vector2s & get_box() const
Return dimension of the center of pressure support (length, width)
const Matrix46s & get_A() const
Return the matrix of center of pressure support.
const Matrix3s & get_R() const
Return the rotation matrix that defines the support orientation w.r.t. the inertial frame.
CoPSupportTpl< NewScalar > cast() const
Cast the wrench cone to a different scalar type.
void update()
Update the matrix of center of pressure inequalities in the world frame.