hpp-constraints: include/hpp/constraints/relative-com.hh Source File

hpp-constraints 9.0.2 Definition of basic geometric constraints for motion planning

Loading...
Searching...
No Matches
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
34#include <hpp/constraints/config.hh>
35#include <hpp/constraints/differentiable-function.hh>
36#include <hpp/constraints/fwd.hh>
37
38 namespace hpp {
39 namespace constraints {
40
43
67 class HPP_CONSTRAINTS_DLLAPI RelativeCom : public DifferentiableFunction {
68 public:
69 EIGEN_MAKE_ALIGNED_OPERATOR_NEW
71 static RelativeComPtr_t create(
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 }
77 static RelativeComPtr_t create(
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));
81 static RelativeComPtr_t create(
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));
85 static RelativeComPtr_t create(
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_;
122 CenterOfMassComputationPtr_t comc_;
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
hpp::constraints::DifferentiableFunction
Definition differentiable-function.hh:63
hpp::constraints::RelativeCom
Definition relative-com.hh:67
hpp::constraints::RelativeCom::create
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
hpp::constraints::RelativeCom::create
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))
hpp::constraints::RelativeCom::print
virtual std::ostream & print(std::ostream &o) const
Display object in a stream.
hpp::constraints::RelativeCom::create
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))
hpp::constraints::RelativeCom::isEqual
bool isEqual(const DifferentiableFunction &other) const
Definition relative-com.hh:107
hpp::constraints::RelativeCom::impl_jacobian
virtual void impl_jacobian(matrixOut_t jacobian, ConfigurationIn_t arg) const
hpp::constraints::RelativeCom::impl_compute
virtual void impl_compute(LiegroupElementRef result, ConfigurationIn_t argument) const
hpp::constraints::RelativeCom::RelativeCom
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)
hpp::constraints::RelativeCom::create
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))
hpp::constraints::RelativeCom::~RelativeCom
virtual ~RelativeCom()
Definition relative-com.hh:90
hpp::pinocchio::LiegroupElementBase
config.hh
HPP_CONSTRAINTS_DLLAPI
#define HPP_CONSTRAINTS_DLLAPI
Definition config.hh:88
differentiable-function.hh
fwd.hh
hpp::constraints::vector3_t
pinocchio::vector3_t vector3_t
Definition fwd.hh:53
hpp::constraints::DevicePtr_t
pinocchio::DevicePtr_t DevicePtr_t
Definition fwd.hh:111
hpp::constraints::ComJacobian_t
pinocchio::ComJacobian_t ComJacobian_t
Definition fwd.hh:63
hpp::constraints::ConfigurationIn_t
pinocchio::ConfigurationIn_t ConfigurationIn_t
Definition fwd.hh:108
hpp::constraints::matrixOut_t
Eigen::Ref< matrix_t > matrixOut_t
Definition fwd.hh:59
hpp::constraints::CenterOfMassComputationPtr_t
pinocchio::CenterOfMassComputationPtr_t CenterOfMassComputationPtr_t
Definition fwd.hh:114
hpp::constraints::RelativeComPtr_t
shared_ptr< RelativeCom > RelativeComPtr_t
Definition fwd.hh:122
hpp::constraints::JointPtr_t
pinocchio::JointPtr_t JointPtr_t
Definition fwd.hh:50
hpp
HPP_SERIALIZABLE
#define HPP_SERIALIZABLE()