| Line |
Branch |
Exec |
Source |
| 1 |
|
|
// |
| 2 |
|
|
// Copyright (c) 2017 CNRS |
| 3 |
|
|
// Author: Joseph Mirabel |
| 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_PINOCCHIO_FRAME_HH |
| 32 |
|
|
#define HPP_PINOCCHIO_FRAME_HH |
| 33 |
|
|
|
| 34 |
|
|
#include <cstddef> |
| 35 |
|
|
#include <hpp/pinocchio/config.hh> |
| 36 |
|
|
#include <hpp/pinocchio/deprecated.hh> |
| 37 |
|
|
#include <hpp/pinocchio/fwd.hh> |
| 38 |
|
|
|
| 39 |
|
|
namespace hpp { |
| 40 |
|
|
namespace pinocchio { |
| 41 |
|
|
/// Robot frame |
| 42 |
|
|
class HPP_PINOCCHIO_DLLAPI Frame { |
| 43 |
|
|
public: |
| 44 |
|
|
/// \name Construction and copy and destruction |
| 45 |
|
|
/// \{ |
| 46 |
|
|
|
| 47 |
|
|
/// Constructor |
| 48 |
|
|
/// \param device pointer on the device the frame is belonging to. |
| 49 |
|
|
/// \param indexInFrameList index of the frame, i.e. frame = |
| 50 |
|
|
/// device.model.frames[index] |
| 51 |
|
|
Frame(DeviceWkPtr_t device, FrameIndex indexInFrameList); |
| 52 |
|
|
|
| 53 |
|
10 |
~Frame() {} |
| 54 |
|
|
/// \} |
| 55 |
|
|
// ----------------------------------------------------------------------- |
| 56 |
|
|
/// \name Name |
| 57 |
|
|
/// \{ |
| 58 |
|
|
|
| 59 |
|
|
/// Get name |
| 60 |
|
|
const std::string& name() const; |
| 61 |
|
|
|
| 62 |
|
|
/// \} |
| 63 |
|
|
// ----------------------------------------------------------------------- |
| 64 |
|
|
/// \name Position |
| 65 |
|
|
/// \{ |
| 66 |
|
|
|
| 67 |
|
|
/// Frame transformation |
| 68 |
|
|
Transform3s currentTransformation() const; |
| 69 |
|
|
|
| 70 |
|
|
/// Frame transformation |
| 71 |
|
|
Transform3s currentTransformation(const DeviceData& data) const; |
| 72 |
|
|
|
| 73 |
|
|
/// Get const reference to Jacobian |
| 74 |
|
|
/// |
| 75 |
|
|
/// The jacobian (6d) is expressed in the local frame. |
| 76 |
|
|
/// the linear part corresponds to the velocity of the center of the frame. |
| 77 |
|
|
JointJacobian_t jacobian() const { return jacobian(data()); } |
| 78 |
|
|
|
| 79 |
|
|
JointJacobian_t jacobian(const DeviceData& data) const; |
| 80 |
|
|
|
| 81 |
|
|
///\} |
| 82 |
|
|
// ----------------------------------------------------------------------- |
| 83 |
|
|
/// \name Kinematic chain |
| 84 |
|
|
/// \{ |
| 85 |
|
|
|
| 86 |
|
|
/// Returns true if the frame type is ::pinocchio::FIXED_JOINT |
| 87 |
|
|
bool isFixed() const; |
| 88 |
|
|
|
| 89 |
|
|
/// Returns the joint associated to this frame |
| 90 |
|
|
JointPtr_t joint() const; |
| 91 |
|
|
|
| 92 |
|
|
/// Get the parent frame (if any). |
| 93 |
|
|
/// \warning the parent joint of the universe is the universe itself. |
| 94 |
|
|
Frame parentFrame() const; |
| 95 |
|
|
|
| 96 |
|
|
/// Returns true if this frame is the universe frame. |
| 97 |
|
|
bool isRootFrame() const; |
| 98 |
|
|
|
| 99 |
|
2 |
const std::vector<FrameIndex>& children() { |
| 100 |
|
2 |
setChildList(); |
| 101 |
|
2 |
return children_; |
| 102 |
|
|
} |
| 103 |
|
|
|
| 104 |
|
|
/// Get (constant) placement of frame in parent joint |
| 105 |
|
|
const Transform3s& positionInParentJoint() const; |
| 106 |
|
|
|
| 107 |
|
|
/// Get (constant) placement of frame in parent frame |
| 108 |
|
|
Transform3s positionInParentFrame() const; |
| 109 |
|
|
|
| 110 |
|
|
/// Set position of frame in parent frame |
| 111 |
|
|
void positionInParentFrame(const Transform3s& p); |
| 112 |
|
|
///\} |
| 113 |
|
|
|
| 114 |
|
|
public: |
| 115 |
|
|
// ----------------------------------------------------------------------- |
| 116 |
|
|
|
| 117 |
|
|
/// Access robot owning the object |
| 118 |
|
✗ |
DeviceConstPtr_t robot() const { |
| 119 |
|
✗ |
selfAssert(); |
| 120 |
|
✗ |
return devicePtr_.lock(); |
| 121 |
|
|
} |
| 122 |
|
|
/// Access robot owning the object |
| 123 |
|
|
DevicePtr_t robot() { |
| 124 |
|
|
selfAssert(); |
| 125 |
|
|
return devicePtr_.lock(); |
| 126 |
|
|
} |
| 127 |
|
|
|
| 128 |
|
|
/// Display frame |
| 129 |
|
|
virtual std::ostream& display(std::ostream& os) const; |
| 130 |
|
|
|
| 131 |
|
|
/// \name Pinocchio API |
| 132 |
|
|
/// \{ |
| 133 |
|
|
|
| 134 |
|
20 |
const FrameIndex& index() const { return frameIndex_; } |
| 135 |
|
|
|
| 136 |
|
|
const ::pinocchio::Frame& pinocchio() const; |
| 137 |
|
|
|
| 138 |
|
|
/// \} |
| 139 |
|
|
|
| 140 |
|
|
private: |
| 141 |
|
|
DeviceWkPtr_t devicePtr_; |
| 142 |
|
|
FrameIndex frameIndex_; |
| 143 |
|
|
std::vector<FrameIndex> children_; |
| 144 |
|
|
|
| 145 |
|
|
::pinocchio::Frame& pinocchio(); |
| 146 |
|
|
|
| 147 |
|
|
/// Store list of childrens. |
| 148 |
|
|
void setChildList(); |
| 149 |
|
|
Model& model(); |
| 150 |
|
|
const Model& model() const; |
| 151 |
|
|
DeviceData& data() const; |
| 152 |
|
|
|
| 153 |
|
|
/// Assert that the members of the struct are valid (no null pointer, etc). |
| 154 |
|
|
void selfAssert() const; |
| 155 |
|
|
}; // class Frame |
| 156 |
|
|
|
| 157 |
|
|
inline std::ostream& operator<<(std::ostream& os, const Frame& frame) { |
| 158 |
|
|
return frame.display(os); |
| 159 |
|
|
} |
| 160 |
|
|
|
| 161 |
|
|
} // namespace pinocchio |
| 162 |
|
|
} // namespace hpp |
| 163 |
|
|
|
| 164 |
|
|
#endif // HPP_PINOCCHIO_FRAME_HH |
| 165 |
|
|
|