| Line |
Branch |
Exec |
Source |
| 1 |
|
|
// Copyright (c) 2018 CNRS |
| 2 |
|
|
// Authors: Joseph Mirabel |
| 3 |
|
|
// |
| 4 |
|
|
|
| 5 |
|
|
// Redistribution and use in source and binary forms, with or without |
| 6 |
|
|
// modification, are permitted provided that the following conditions are |
| 7 |
|
|
// met: |
| 8 |
|
|
// |
| 9 |
|
|
// 1. Redistributions of source code must retain the above copyright |
| 10 |
|
|
// notice, this list of conditions and the following disclaimer. |
| 11 |
|
|
// |
| 12 |
|
|
// 2. Redistributions in binary form must reproduce the above copyright |
| 13 |
|
|
// notice, this list of conditions and the following disclaimer in the |
| 14 |
|
|
// documentation and/or other materials provided with the distribution. |
| 15 |
|
|
// |
| 16 |
|
|
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
| 17 |
|
|
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
| 18 |
|
|
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
| 19 |
|
|
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
| 20 |
|
|
// HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
| 21 |
|
|
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
| 22 |
|
|
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
| 23 |
|
|
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
| 24 |
|
|
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 25 |
|
|
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 26 |
|
|
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH |
| 27 |
|
|
// DAMAGE. |
| 28 |
|
|
|
| 29 |
|
|
#ifndef HPP_CONSTRAINTS_MANIPULABILITY_HH |
| 30 |
|
|
#define HPP_CONSTRAINTS_MANIPULABILITY_HH |
| 31 |
|
|
|
| 32 |
|
|
#include <hpp/constraints/config.hh> |
| 33 |
|
|
#include <hpp/constraints/differentiable-function.hh> |
| 34 |
|
|
#include <hpp/constraints/fwd.hh> |
| 35 |
|
|
#include <hpp/constraints/matrix-view.hh> |
| 36 |
|
|
|
| 37 |
|
|
namespace hpp { |
| 38 |
|
|
namespace constraints { |
| 39 |
|
|
HPP_PREDEF_CLASS(Manipulability); |
| 40 |
|
|
typedef shared_ptr<Manipulability> ManipulabilityPtr_t; |
| 41 |
|
|
|
| 42 |
|
|
/// \addtogroup constraints |
| 43 |
|
|
/// \{ |
| 44 |
|
|
|
| 45 |
|
|
/// Differentiable function |
| 46 |
|
|
class HPP_CONSTRAINTS_DLLAPI Manipulability : public DifferentiableFunction { |
| 47 |
|
|
public: |
| 48 |
|
✗ |
virtual ~Manipulability() {} |
| 49 |
|
|
|
| 50 |
|
|
static ManipulabilityPtr_t create(DifferentiableFunctionPtr_t function, |
| 51 |
|
|
DevicePtr_t robot, std::string name) { |
| 52 |
|
|
return ManipulabilityPtr_t(new Manipulability(function, robot, name)); |
| 53 |
|
|
} |
| 54 |
|
|
|
| 55 |
|
|
protected: |
| 56 |
|
|
/// \brief Concrete class constructor should call this constructor. |
| 57 |
|
|
/// |
| 58 |
|
|
/// \param function the function which must be analysed |
| 59 |
|
|
/// \param name function's name |
| 60 |
|
|
Manipulability(DifferentiableFunctionPtr_t function, DevicePtr_t robot, |
| 61 |
|
|
std::string name); |
| 62 |
|
|
|
| 63 |
|
|
void impl_compute(LiegroupElementRef result, vectorIn_t argument) const; |
| 64 |
|
|
|
| 65 |
|
|
void impl_jacobian(matrixOut_t jacobian, vectorIn_t arg) const; |
| 66 |
|
|
|
| 67 |
|
✗ |
bool isEqual(const DifferentiableFunction& other) const { |
| 68 |
|
|
const Manipulability& castother = |
| 69 |
|
✗ |
dynamic_cast<const Manipulability&>(other); |
| 70 |
|
✗ |
if (!DifferentiableFunction::isEqual(other)) return false; |
| 71 |
|
|
|
| 72 |
|
✗ |
if (function_ != castother.function_) return false; |
| 73 |
|
✗ |
if (robot_ != castother.robot_) return false; |
| 74 |
|
✗ |
if (cols_.cols() != castother.cols_.cols()) return false; |
| 75 |
|
✗ |
if (J_ != castother.J_) return false; |
| 76 |
|
✗ |
if (J_JT_ != castother.J_JT_) return false; |
| 77 |
|
|
|
| 78 |
|
✗ |
return true; |
| 79 |
|
|
} |
| 80 |
|
|
|
| 81 |
|
|
private: |
| 82 |
|
|
DifferentiableFunctionPtr_t function_; |
| 83 |
|
|
DevicePtr_t robot_; |
| 84 |
|
|
|
| 85 |
|
|
Eigen::ColBlockIndices cols_; |
| 86 |
|
|
|
| 87 |
|
|
mutable matrix_t J_, J_JT_; |
| 88 |
|
|
}; // class Manipulability |
| 89 |
|
|
/// \} |
| 90 |
|
|
} // namespace constraints |
| 91 |
|
|
} // namespace hpp |
| 92 |
|
|
|
| 93 |
|
|
#endif // HPP_CONSTRAINTS_MANIPULABILITY_HH |
| 94 |
|
|
|