hpp-constraints  6.0.0
Definition of basic geometric constraints for motion planning
relative-com.hh
Go to the documentation of this file.
1 //
2 // Copyright (c) 2014 CNRS
3 // Authors: Florent Lamiraux
4 //
5 //
6 
7 // Redistribution and use in source and binary forms, with or without
8 // modification, are permitted provided that the following conditions are
9 // met:
10 //
11 // 1. Redistributions of source code must retain the above copyright
12 // notice, this list of conditions and the following disclaimer.
13 //
14 // 2. Redistributions in binary form must reproduce the above copyright
15 // notice, this list of conditions and the following disclaimer in the
16 // documentation and/or other materials provided with the distribution.
17 //
18 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
20 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
21 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
22 // HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
23 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
24 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
29 // DAMAGE.
30 
31 #ifndef HPP_CONSTRAINTS_RELATIVE_COM_HH
32 #define HPP_CONSTRAINTS_RELATIVE_COM_HH
33 
36 #include <hpp/constraints/fwd.hh>
37 
38 namespace hpp {
39 namespace constraints {
40 
43 
68  public:
69  EIGEN_MAKE_ALIGNED_OPERATOR_NEW
72  const DevicePtr_t& robot, const JointPtr_t& joint,
73  const vector3_t reference,
74  std::vector<bool> mask = std::vector<bool>(3, true)) {
75  return create("RelativeCom", robot, joint, reference, mask);
76  }
78  const std::string& name, const DevicePtr_t& robot,
79  const JointPtr_t& joint, const vector3_t reference,
80  std::vector<bool> mask = std::vector<bool>(3, true));
82  const DevicePtr_t& robot, const CenterOfMassComputationPtr_t& comc,
83  const JointPtr_t& joint, const vector3_t reference,
84  std::vector<bool> mask = std::vector<bool>(3, true));
86  const std::string& name, const DevicePtr_t& robot,
87  const CenterOfMassComputationPtr_t& comc, const JointPtr_t& joint,
88  const vector3_t reference,
89  std::vector<bool> mask = std::vector<bool>(3, true));
90  virtual ~RelativeCom() {}
91  RelativeCom(const DevicePtr_t& robot,
92  const CenterOfMassComputationPtr_t& comc, const JointPtr_t& joint,
93  const vector3_t reference, std::vector<bool> mask,
94  const std::string& name);
95 
96  virtual std::ostream& print(std::ostream& o) const;
97 
98  protected:
103  virtual void impl_compute(LiegroupElementRef result,
104  ConfigurationIn_t argument) const;
105  virtual void impl_jacobian(matrixOut_t jacobian, ConfigurationIn_t arg) const;
106 
107  bool isEqual(const DifferentiableFunction& other) const {
108  const RelativeCom& castother = dynamic_cast<const RelativeCom&>(other);
109  if (!DifferentiableFunction::isEqual(other)) return false;
110 
111  if (robot_ != castother.robot_) return false;
112  if (comc_ != castother.comc_) return false;
113  if (joint_ != castother.joint_) return false;
114  if (mask_ != castother.mask_) return false;
115  if (nominalCase_ != castother.nominalCase_) return false;
116 
117  return true;
118  }
119 
120  private:
121  DevicePtr_t robot_;
123  JointPtr_t joint_;
124  vector3_t reference_;
125  std::vector<bool> mask_;
126  bool nominalCase_;
127  mutable ComJacobian_t jacobian_;
128 
129  RelativeCom() {}
130  HPP_SERIALIZABLE();
131 }; // class RelativeCom
133 } // namespace constraints
134 } // namespace hpp
135 #endif // HPP_CONSTRAINTS_RELATIVE_COM_HH
Definition: differentiable-function.hh:63
virtual bool isEqual(const DifferentiableFunction &other) const
Definition: differentiable-function.hh:206
Definition: relative-com.hh:67
static EIGEN_MAKE_ALIGNED_OPERATOR_NEW RelativeComPtr_t create(const DevicePtr_t &robot, const JointPtr_t &joint, const vector3_t reference, std::vector< bool > mask=std::vector< bool >(3, true))
Return a shared pointer to a new instance.
Definition: relative-com.hh:71
static RelativeComPtr_t create(const std::string &name, const DevicePtr_t &robot, const JointPtr_t &joint, const vector3_t reference, std::vector< bool > mask=std::vector< bool >(3, true))
static RelativeComPtr_t create(const std::string &name, const DevicePtr_t &robot, const CenterOfMassComputationPtr_t &comc, const JointPtr_t &joint, const vector3_t reference, std::vector< bool > mask=std::vector< bool >(3, true))
bool isEqual(const DifferentiableFunction &other) const
Definition: relative-com.hh:107
virtual void impl_jacobian(matrixOut_t jacobian, ConfigurationIn_t arg) const
virtual void impl_compute(LiegroupElementRef result, ConfigurationIn_t argument) const
virtual std::ostream & print(std::ostream &o) const
Display object in a stream.
RelativeCom(const DevicePtr_t &robot, const CenterOfMassComputationPtr_t &comc, const JointPtr_t &joint, const vector3_t reference, std::vector< bool > mask, const std::string &name)
static RelativeComPtr_t create(const DevicePtr_t &robot, const CenterOfMassComputationPtr_t &comc, const JointPtr_t &joint, const vector3_t reference, std::vector< bool > mask=std::vector< bool >(3, true))
virtual ~RelativeCom()
Definition: relative-com.hh:90
#define HPP_CONSTRAINTS_DLLAPI
Definition: config.hh:88
pinocchio::vector3_t vector3_t
Definition: fwd.hh:52
pinocchio::DevicePtr_t DevicePtr_t
Definition: fwd.hh:109
pinocchio::ComJacobian_t ComJacobian_t
Definition: fwd.hh:62
pinocchio::ConfigurationIn_t ConfigurationIn_t
Definition: fwd.hh:106
Eigen::Ref< matrix_t > matrixOut_t
Definition: fwd.hh:58
pinocchio::CenterOfMassComputationPtr_t CenterOfMassComputationPtr_t
Definition: fwd.hh:112
shared_ptr< RelativeCom > RelativeComPtr_t
Definition: fwd.hh:120
pinocchio::LiegroupElementRef LiegroupElementRef
Definition: fwd.hh:66
pinocchio::JointPtr_t JointPtr_t
Definition: fwd.hh:49
Definition: active-set-differentiable-function.hh:36