| Directory: | ./ |
|---|---|
| File: | include/hpp/pinocchio/humanoid-robot.hh |
| Date: | 2025-05-04 12:09:19 |
| Exec | Total | Coverage | |
|---|---|---|---|
| Lines: | 7 | 7 | 100.0% |
| Branches: | 2 | 4 | 50.0% |
| Line | Branch | Exec | Source |
|---|---|---|---|
| 1 | // | ||
| 2 | // Copyright (c) 2016 CNRS | ||
| 3 | // Author: Joseph Mirabel from 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_PINOCCHIO_HUMANOID_ROBOT_HH | ||
| 32 | #define HPP_PINOCCHIO_HUMANOID_ROBOT_HH | ||
| 33 | |||
| 34 | #include <hpp/pinocchio/config.hh> | ||
| 35 | #include <hpp/pinocchio/device.hh> | ||
| 36 | #include <hpp/pinocchio/fwd.hh> | ||
| 37 | #include <iostream> | ||
| 38 | #include <vector> | ||
| 39 | |||
| 40 | namespace hpp { | ||
| 41 | namespace pinocchio { | ||
| 42 | /// \brief Humanoid robot | ||
| 43 | |||
| 44 | class HPP_PINOCCHIO_DLLAPI HumanoidRobot : public Device { | ||
| 45 | public: | ||
| 46 | /// \name Construction, copy and destruction | ||
| 47 | /// @{ | ||
| 48 | virtual ~HumanoidRobot(); | ||
| 49 | |||
| 50 | /// \brief Clone as a HumanoidRobot | ||
| 51 | virtual DevicePtr_t clone() const; | ||
| 52 | |||
| 53 | 2 | HumanoidRobotPtr_t self() const { return weakPtr_.lock(); } | |
| 54 | |||
| 55 | /// | ||
| 56 | /// @} | ||
| 57 | /// | ||
| 58 | |||
| 59 | /// \brief Creation of a new device | ||
| 60 | /// \return a shared pointer to the new device | ||
| 61 | /// \param name Name of the device (is passed to CkkpDeviceComponent) | ||
| 62 | static HumanoidRobotPtr_t create(const std::string& name); | ||
| 63 | |||
| 64 | /// \brief Get Joint corresponding to the waist. | ||
| 65 | JointPtr_t waist() const; | ||
| 66 | |||
| 67 | /// Set waist joint | ||
| 68 | void waist(const JointPtr_t& joint); | ||
| 69 | |||
| 70 | /// \brief Get Joint corresponding to the chest. | ||
| 71 | JointPtr_t chest() const; | ||
| 72 | |||
| 73 | /// Set chest joint | ||
| 74 | void chest(const JointPtr_t& joint); | ||
| 75 | |||
| 76 | /// \brief Get Joint corresponding to the left wrist. | ||
| 77 | JointPtr_t leftWrist() const; | ||
| 78 | |||
| 79 | /// Set left wrist | ||
| 80 | void leftWrist(const JointPtr_t& joint); | ||
| 81 | |||
| 82 | /// \brief Get Joint corresponding to the right wrist. | ||
| 83 | JointPtr_t rightWrist() const; | ||
| 84 | |||
| 85 | /// Set right wrist | ||
| 86 | void rightWrist(const JointPtr_t& joint); | ||
| 87 | |||
| 88 | /// \brief Get Joint corresponding to the left ankle. | ||
| 89 | JointPtr_t leftAnkle() const; | ||
| 90 | |||
| 91 | /// Set letf ankle | ||
| 92 | void leftAnkle(const JointPtr_t& joint); | ||
| 93 | |||
| 94 | /// \brief Get Joint corresponding to the right ankle. | ||
| 95 | JointPtr_t rightAnkle() const; | ||
| 96 | |||
| 97 | /// Set right ankle | ||
| 98 | void rightAnkle(const JointPtr_t& joint); | ||
| 99 | |||
| 100 | /// \brief Get gaze joint | ||
| 101 | JointPtr_t gazeJoint() const; | ||
| 102 | |||
| 103 | /// Set gaze joint | ||
| 104 | void gazeJoint(const JointPtr_t& joint); | ||
| 105 | |||
| 106 | /// Set gaze parameters | ||
| 107 | 2 | void gaze(const vector3_t& origin, const vector3_t& dir) { | |
| 108 | 2 | gazeOrigin_ = origin; | |
| 109 | 2 | gazeDirection_ = dir; | |
| 110 | 2 | } | |
| 111 | |||
| 112 | protected: | ||
| 113 | /// \brief Constructor | ||
| 114 | HumanoidRobot(const std::string& name); | ||
| 115 | |||
| 116 | HumanoidRobot(const HumanoidRobot& other); | ||
| 117 | |||
| 118 | /// | ||
| 119 | /// \brief Initialization. | ||
| 120 | /// | ||
| 121 | void init(const HumanoidRobotWkPtr_t& weakPtr); | ||
| 122 | |||
| 123 | void initCopy(const HumanoidRobotWkPtr_t& weakPtr, | ||
| 124 | const HumanoidRobot& other); | ||
| 125 | |||
| 126 | /// For serialization only | ||
| 127 |
2/4✓ Branch 10 taken 1 times.
✗ Branch 11 not taken.
✓ Branch 13 taken 1 times.
✗ Branch 14 not taken.
|
1 | HumanoidRobot() {} |
| 128 | |||
| 129 | private: | ||
| 130 | HumanoidRobotWkPtr_t weakPtr_; | ||
| 131 | JointPtr_t waist_; | ||
| 132 | JointPtr_t chest_; | ||
| 133 | JointPtr_t leftWrist_; | ||
| 134 | JointPtr_t rightWrist_; | ||
| 135 | JointPtr_t leftAnkle_; | ||
| 136 | JointPtr_t rightAnkle_; | ||
| 137 | JointPtr_t gazeJoint_; | ||
| 138 | vector3_t gazeOrigin_; | ||
| 139 | vector3_t gazeDirection_; | ||
| 140 | |||
| 141 | HPP_SERIALIZABLE(); | ||
| 142 | }; // class HumanoidRobot | ||
| 143 | } // namespace pinocchio | ||
| 144 | } // namespace hpp | ||
| 145 | |||
| 146 | 8 | BOOST_CLASS_EXPORT_KEY(hpp::pinocchio::HumanoidRobot) | |
| 147 | |||
| 148 | #endif // HPP_PINOCCHIO_HUMANOID_ROBOT_HH | ||
| 149 |