| Line |
Branch |
Exec |
Source |
| 1 |
|
|
// |
| 2 |
|
|
// Copyright (c) 2017 CNRS, NYU, MPI Tübingen |
| 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_se3_equality_hpp__ |
| 19 |
|
|
#define __invdyn_task_se3_equality_hpp__ |
| 20 |
|
|
|
| 21 |
|
|
#include "tsid/tasks/task-motion.hpp" |
| 22 |
|
|
#include "tsid/trajectories/trajectory-base.hpp" |
| 23 |
|
|
#include "tsid/math/constraint-equality.hpp" |
| 24 |
|
|
|
| 25 |
|
|
#include <pinocchio/multibody/model.hpp> |
| 26 |
|
|
#include <pinocchio/multibody/data.hpp> |
| 27 |
|
|
|
| 28 |
|
|
namespace tsid { |
| 29 |
|
|
namespace tasks { |
| 30 |
|
|
|
| 31 |
|
|
class TaskSE3Equality : public TaskMotion { |
| 32 |
|
|
public: |
| 33 |
|
|
EIGEN_MAKE_ALIGNED_OPERATOR_NEW |
| 34 |
|
|
|
| 35 |
|
|
typedef math::Index Index; |
| 36 |
|
|
typedef trajectories::TrajectorySample TrajectorySample; |
| 37 |
|
|
typedef math::Vector Vector; |
| 38 |
|
|
typedef math::ConstraintEquality ConstraintEquality; |
| 39 |
|
|
typedef pinocchio::Data Data; |
| 40 |
|
|
typedef pinocchio::Data::Matrix6x Matrix6x; |
| 41 |
|
|
typedef pinocchio::Motion Motion; |
| 42 |
|
|
typedef pinocchio::SE3 SE3; |
| 43 |
|
|
|
| 44 |
|
|
TaskSE3Equality(const std::string& name, RobotWrapper& robot, |
| 45 |
|
|
const std::string& frameName); |
| 46 |
|
|
|
| 47 |
|
12 |
virtual ~TaskSE3Equality() {} |
| 48 |
|
|
|
| 49 |
|
|
int dim() const; |
| 50 |
|
|
|
| 51 |
|
|
const ConstraintBase& compute(const double t, ConstRefVector q, |
| 52 |
|
|
ConstRefVector v, Data& data); |
| 53 |
|
|
|
| 54 |
|
|
const ConstraintBase& getConstraint() const; |
| 55 |
|
|
|
| 56 |
|
|
void setReference(TrajectorySample& ref); |
| 57 |
|
|
void setReference(const SE3& ref); |
| 58 |
|
|
const TrajectorySample& getReference() const; |
| 59 |
|
|
|
| 60 |
|
|
/** Return the desired task acceleration (after applying the specified mask). |
| 61 |
|
|
* The value is expressed in local frame is the local_frame flag is true, |
| 62 |
|
|
* otherwise it is expressed in a local world-oriented frame. |
| 63 |
|
|
*/ |
| 64 |
|
|
const Vector& getDesiredAcceleration() const; |
| 65 |
|
|
|
| 66 |
|
|
/** Return the task acceleration (after applying the specified mask). |
| 67 |
|
|
* The value is expressed in local frame is the local_frame flag is true, |
| 68 |
|
|
* otherwise it is expressed in a local world-oriented frame. |
| 69 |
|
|
*/ |
| 70 |
|
|
Vector getAcceleration(ConstRefVector dv) const; |
| 71 |
|
|
|
| 72 |
|
|
virtual void setMask(math::ConstRefVector mask); |
| 73 |
|
|
|
| 74 |
|
|
/** Return the position tracking error (after applying the specified mask). |
| 75 |
|
|
* The error is expressed in local frame is the local_frame flag is true, |
| 76 |
|
|
* otherwise it is expressed in a local world-oriented frame. |
| 77 |
|
|
*/ |
| 78 |
|
|
const Vector& position_error() const; |
| 79 |
|
|
|
| 80 |
|
|
/** Return the velocity tracking error (after applying the specified mask). |
| 81 |
|
|
* The error is expressed in local frame is the local_frame flag is true, |
| 82 |
|
|
* otherwise it is expressed in a local world-oriented frame. |
| 83 |
|
|
*/ |
| 84 |
|
|
const Vector& velocity_error() const; |
| 85 |
|
|
|
| 86 |
|
|
const Vector& position() const; |
| 87 |
|
|
const Vector& velocity() const; |
| 88 |
|
|
const Vector& position_ref() const; |
| 89 |
|
|
const Vector& velocity_ref() const; |
| 90 |
|
|
|
| 91 |
|
|
const Vector& Kp() const; |
| 92 |
|
|
const Vector& Kd() const; |
| 93 |
|
|
void Kp(ConstRefVector Kp); |
| 94 |
|
|
void Kd(ConstRefVector Kp); |
| 95 |
|
|
|
| 96 |
|
|
Index frame_id() const; |
| 97 |
|
|
|
| 98 |
|
|
/** |
| 99 |
|
|
* @brief Specifies if the jacobian and desired acceloration should be |
| 100 |
|
|
* expressed in the local frame or the local world-oriented frame. |
| 101 |
|
|
* |
| 102 |
|
|
* @param local_frame If true, represent jacobian and acceloration in the |
| 103 |
|
|
* local frame. If false, represent them in the local world-oriented frame. |
| 104 |
|
|
*/ |
| 105 |
|
|
void useLocalFrame(bool local_frame); |
| 106 |
|
|
|
| 107 |
|
|
protected: |
| 108 |
|
|
std::string m_frame_name; |
| 109 |
|
|
Index m_frame_id; |
| 110 |
|
|
Motion m_p_error, m_v_error; |
| 111 |
|
|
Vector m_p_error_vec, m_v_error_vec; |
| 112 |
|
|
Vector m_p_error_masked_vec, m_v_error_masked_vec; |
| 113 |
|
|
Vector m_p, m_v; |
| 114 |
|
|
Vector m_p_ref, m_v_ref_vec; |
| 115 |
|
|
Motion m_v_ref, m_a_ref; |
| 116 |
|
|
SE3 m_M_ref, m_wMl; |
| 117 |
|
|
Vector m_Kp; |
| 118 |
|
|
Vector m_Kd; |
| 119 |
|
|
Vector m_a_des, m_a_des_masked; |
| 120 |
|
|
Motion m_drift; |
| 121 |
|
|
Vector m_drift_masked; |
| 122 |
|
|
Matrix6x m_J; |
| 123 |
|
|
Matrix6x m_J_rotated; |
| 124 |
|
|
ConstraintEquality m_constraint; |
| 125 |
|
|
TrajectorySample m_ref; |
| 126 |
|
|
bool m_local_frame; |
| 127 |
|
|
}; |
| 128 |
|
|
|
| 129 |
|
|
} // namespace tasks |
| 130 |
|
|
} // namespace tsid |
| 131 |
|
|
|
| 132 |
|
|
#endif // ifndef __invdyn_task_se3_equality_hpp__ |
| 133 |
|
|
|