| Line | 
      Branch | 
      Exec | 
      Source | 
    
    
      | 1 | 
      
       | 
       | 
      // | 
    
    
      | 2 | 
      
       | 
       | 
      // Copyright (c) 2017 CNRS | 
    
    
      | 3 | 
      
       | 
       | 
      // | 
    
    
      | 4 | 
      
       | 
       | 
      // This file is part of tsid | 
    
    
      | 5 | 
      
       | 
       | 
      // tsid is free software: you can redistribute it | 
    
    
      | 6 | 
      
       | 
       | 
      // and/or modify it under the terms of the GNU Lesser General Public | 
    
    
      | 7 | 
      
       | 
       | 
      // License as published by the Free Software Foundation, either version | 
    
    
      | 8 | 
      
       | 
       | 
      // 3 of the License, or (at your option) any later version. | 
    
    
      | 9 | 
      
       | 
       | 
      // tsid is distributed in the hope that it will be | 
    
    
      | 10 | 
      
       | 
       | 
      // useful, but WITHOUT ANY WARRANTY; without even the implied warranty | 
    
    
      | 11 | 
      
       | 
       | 
      // of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 
    
    
      | 12 | 
      
       | 
       | 
      // General Lesser Public License for more details. You should have | 
    
    
      | 13 | 
      
       | 
       | 
      // received a copy of the GNU Lesser General Public License along with | 
    
    
      | 14 | 
      
       | 
       | 
      // tsid If not, see | 
    
    
      | 15 | 
      
       | 
       | 
      // <http://www.gnu.org/licenses/>. | 
    
    
      | 16 | 
      
       | 
       | 
      // | 
    
    
      | 17 | 
      
       | 
       | 
       | 
    
    
      | 18 | 
      
       | 
       | 
      #ifndef __invdyn_task_com_equality_hpp__ | 
    
    
      | 19 | 
      
       | 
       | 
      #define __invdyn_task_com_equality_hpp__ | 
    
    
      | 20 | 
      
       | 
       | 
       | 
    
    
      | 21 | 
      
       | 
       | 
      #include "tsid/math/fwd.hpp" | 
    
    
      | 22 | 
      
       | 
       | 
      #include "tsid/tasks/task-motion.hpp" | 
    
    
      | 23 | 
      
       | 
       | 
      #include "tsid/trajectories/trajectory-base.hpp" | 
    
    
      | 24 | 
      
       | 
       | 
      #include "tsid/math/constraint-equality.hpp" | 
    
    
      | 25 | 
      
       | 
       | 
       | 
    
    
      | 26 | 
      
       | 
       | 
      namespace tsid { | 
    
    
      | 27 | 
      
       | 
       | 
      namespace tasks { | 
    
    
      | 28 | 
      
       | 
       | 
       | 
    
    
      | 29 | 
      
       | 
       | 
      class TaskComEquality : public TaskMotion { | 
    
    
      | 30 | 
      
       | 
       | 
       public: | 
    
    
      | 31 | 
      
       | 
       | 
        EIGEN_MAKE_ALIGNED_OPERATOR_NEW | 
    
    
      | 32 | 
      
       | 
       | 
       | 
    
    
      | 33 | 
      
       | 
       | 
        typedef math::Index Index; | 
    
    
      | 34 | 
      
       | 
       | 
        typedef trajectories::TrajectorySample TrajectorySample; | 
    
    
      | 35 | 
      
       | 
       | 
        typedef math::Vector Vector; | 
    
    
      | 36 | 
      
       | 
       | 
        typedef math::Vector3 Vector3; | 
    
    
      | 37 | 
      
       | 
       | 
        typedef math::ConstraintEquality ConstraintEquality; | 
    
    
      | 38 | 
      
       | 
       | 
       | 
    
    
      | 39 | 
      
       | 
       | 
        TaskComEquality(const std::string& name, RobotWrapper& robot); | 
    
    
      | 40 | 
      
       | 
       | 
       | 
    
    
      | 41 | 
      
       | 
      6 | 
        virtual ~TaskComEquality() {} | 
    
    
      | 42 | 
      
       | 
       | 
       | 
    
    
      | 43 | 
      
       | 
       | 
        int dim() const; | 
    
    
      | 44 | 
      
       | 
       | 
       | 
    
    
      | 45 | 
      
       | 
       | 
        const ConstraintBase& compute(const double t, ConstRefVector q, | 
    
    
      | 46 | 
      
       | 
       | 
                                      ConstRefVector v, Data& data); | 
    
    
      | 47 | 
      
       | 
       | 
       | 
    
    
      | 48 | 
      
       | 
       | 
        const ConstraintBase& getConstraint() const; | 
    
    
      | 49 | 
      
       | 
       | 
       | 
    
    
      | 50 | 
      
       | 
       | 
        void setReference(const TrajectorySample& ref); | 
    
    
      | 51 | 
      
       | 
       | 
        const TrajectorySample& getReference() const; | 
    
    
      | 52 | 
      
       | 
       | 
       | 
    
    
      | 53 | 
      
       | 
       | 
        const Vector& getDesiredAcceleration() const; | 
    
    
      | 54 | 
      
       | 
       | 
        Vector getAcceleration(ConstRefVector dv) const; | 
    
    
      | 55 | 
      
       | 
       | 
        virtual void setMask(math::ConstRefVector mask); | 
    
    
      | 56 | 
      
       | 
       | 
       | 
    
    
      | 57 | 
      
       | 
       | 
        const Vector& position_error() const; | 
    
    
      | 58 | 
      
       | 
       | 
        const Vector& velocity_error() const; | 
    
    
      | 59 | 
      
       | 
       | 
        const Vector& position() const; | 
    
    
      | 60 | 
      
       | 
       | 
        const Vector& velocity() const; | 
    
    
      | 61 | 
      
       | 
       | 
        const Vector& position_ref() const; | 
    
    
      | 62 | 
      
       | 
       | 
        const Vector& velocity_ref() const; | 
    
    
      | 63 | 
      
       | 
       | 
       | 
    
    
      | 64 | 
      
       | 
       | 
        const Vector3& Kp(); | 
    
    
      | 65 | 
      
       | 
       | 
        const Vector3& Kd(); | 
    
    
      | 66 | 
      
       | 
       | 
        void Kp(ConstRefVector Kp); | 
    
    
      | 67 | 
      
       | 
       | 
        void Kd(ConstRefVector Kp); | 
    
    
      | 68 | 
      
       | 
       | 
       | 
    
    
      | 69 | 
      
       | 
       | 
       protected: | 
    
    
      | 70 | 
      
       | 
       | 
        Vector3 m_Kp; | 
    
    
      | 71 | 
      
       | 
       | 
        Vector3 m_Kd; | 
    
    
      | 72 | 
      
       | 
       | 
        Vector3 m_p_error, m_v_error; | 
    
    
      | 73 | 
      
       | 
       | 
        Vector m_p_error_masked_vec, m_v_error_masked_vec; | 
    
    
      | 74 | 
      
       | 
       | 
        Vector3 m_a_des; | 
    
    
      | 75 | 
      
       | 
       | 
        Vector m_a_des_vec, m_a_des_masked; | 
    
    
      | 76 | 
      
       | 
       | 
        Vector3 m_drift; | 
    
    
      | 77 | 
      
       | 
       | 
        Vector m_drift_masked; | 
    
    
      | 78 | 
      
       | 
       | 
        Vector m_p_com, m_v_com; | 
    
    
      | 79 | 
      
       | 
       | 
        Vector m_p_error_vec, m_v_error_vec; | 
    
    
      | 80 | 
      
       | 
       | 
        TrajectorySample m_ref; | 
    
    
      | 81 | 
      
       | 
       | 
        ConstraintEquality m_constraint; | 
    
    
      | 82 | 
      
       | 
       | 
      }; | 
    
    
      | 83 | 
      
       | 
       | 
       | 
    
    
      | 84 | 
      
       | 
       | 
      }  // namespace tasks | 
    
    
      | 85 | 
      
       | 
       | 
      }  // namespace tsid | 
    
    
      | 86 | 
      
       | 
       | 
       | 
    
    
      | 87 | 
      
       | 
       | 
      #endif  // ifndef __invdyn_task_com_equality_hpp__ | 
    
    
      | 88 | 
      
       | 
       | 
       |