TaskspaceImpedanceController.h
Go to the documentation of this file.
1 /**
2  * This file is part of ArmarX.
3  *
4  * ArmarX is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License version 2 as
6  * published by the Free Software Foundation.
7  *
8  * ArmarX is distributed in the hope that it will be useful, but
9  * WITHOUT ANY WARRANTY; without even the implied warranty of
10  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11  * GNU General Public License for more details.
12  *
13  * You should have received a copy of the GNU General Public License
14  * along with this program. If not, see <http://www.gnu.org/licenses/>.
15  *
16  * @author Jianfeng Gao ( jianfeng dot gao at kit dot edu )
17  * @date 2021
18  * @copyright http://www.gnu.org/licenses/gpl-2.0.txt
19  * GNU General Public License
20  */
21 
22 #pragma once
23 
24 #include <VirtualRobot/IK/DifferentialIK.h>
25 #include <VirtualRobot/Robot.h>
26 
28 
31 
32 #include <armarx/control/common/control_law/aron/TaskspaceImpedanceControllerConfig.aron.generated.h>
35 #include <armarx/control/common/ft/aron/FTConfig.aron.generated.h>
36 
38 {
39 
41  {
42  public:
43  using FTConfig = common::ft::arondto::FTConfig;
44  using Config = common::control_law::arondto::TaskspaceImpedanceControllerConfig;
45  using ConfigDict = common::control_law::arondto::TaskspaceImpedanceControllerConfigDict;
46 
47  /// internal status of the controller, containing intermediate variables, mutable targets
48  struct RtStatus : public RobotStatus
49  {
50  /// targets
51  Eigen::VectorXf desiredJointTorques;
52  Eigen::VectorXf nullspaceTorque;
53 
54  /// force torque
56 
57  /// task space variables
59 
60  /// current status
61  Eigen::VectorXf qvelFiltered;
65 
66  /// intermediate results
69  Eigen::AngleAxisf oriDiffAngleAxis;
70 
71  /// others
72  Eigen::MatrixXf jacobi;
73  Eigen::MatrixXf jtpinv;
74  bool rtSafe;
75  bool rtTargetSafe = true;
76 
77  void reset(const unsigned int nDoF);
79  };
80 
81  unsigned int numOfJoints; // for nonRT use case
82  private:
83  std::atomic_bool enablePreactivateInit{false};
84 
85  Eigen::MatrixXf I;
86 
87  VirtualRobot::DifferentialIKPtr ik;
88 
89  const float lambda = 2.0f;
90 
91  public:
92  VirtualRobot::RobotNodePtr tcp;
93  VirtualRobot::RobotNodePtr rtTCP;
95 
96  // void updateFT(const FTConfig& c, RtStatus& rtStatus);
97  void initialize(const VirtualRobot::RobotNodeSetPtr& rns,
98  const VirtualRobot::RobotNodeSetPtr& rtRns);
99  void preactivateInit(const VirtualRobot::RobotNodeSetPtr& rns);
100 
101  void run(Config& c, RtStatus& robotStatus);
102  void firstRun();
103  };
104 } // namespace armarx::control::common::control_law
armarx::control::common::control_law::TaskspaceImpedanceController::RtStatus::jacobi
Eigen::MatrixXf jacobi
others
Definition: TaskspaceImpedanceController.h:72
armarx::control::common::control_law::TaskspaceImpedanceController::ftsensor
common::ft::FTSensor ftsensor
Definition: TaskspaceImpedanceController.h:94
armarx::control::common::control_law::TaskspaceImpedanceController::RtStatus::forceImpedance
Eigen::Vector6f forceImpedance
task space variables
Definition: TaskspaceImpedanceController.h:58
common.h
armarx::control::common::control_law::TaskspaceImpedanceController::RtStatus::desiredPose
Eigen::Matrix4f desiredPose
Definition: TaskspaceImpedanceController.h:64
armarx::control::common::control_law::TaskspaceImpedanceController::RtStatus::oriDiffAngleAxis
Eigen::AngleAxisf oriDiffAngleAxis
Definition: TaskspaceImpedanceController.h:69
armarx::control::common::control_law::TaskspaceImpedanceController::RtStatus::desiredJointTorques
Eigen::VectorXf desiredJointTorques
targets
Definition: TaskspaceImpedanceController.h:51
FTSensor.h
armarx::control::common::control_law::TaskspaceImpedanceController::numOfJoints
unsigned int numOfJoints
Definition: TaskspaceImpedanceController.h:81
c
constexpr T c
Definition: UnscentedKalmanFilterTest.cpp:43
armarx::control::common::control_law::TaskspaceImpedanceController::RtStatus::reset
void reset(const unsigned int nDoF)
Definition: TaskspaceImpedanceController.cpp:161
armarx::control::common::control_law::TaskspaceImpedanceController::ConfigDict
common::control_law::arondto::TaskspaceImpedanceControllerConfigDict ConfigDict
Definition: TaskspaceImpedanceController.h:45
armarx::control::common::control_law::TaskspaceImpedanceController::preactivateInit
void preactivateInit(const VirtualRobot::RobotNodeSetPtr &rns)
Definition: TaskspaceImpedanceController.cpp:31
armarx::control::common::control_law::TaskspaceImpedanceController::FTConfig
common::ft::arondto::FTConfig FTConfig
Definition: TaskspaceImpedanceController.h:43
armarx::control::common::control_law::TaskspaceImpedanceController::RtStatus::jtpinv
Eigen::MatrixXf jtpinv
Definition: TaskspaceImpedanceController.h:73
armarx::control::common::control_law::TaskspaceImpedanceController::RtStatus::currentForceTorque
Eigen::Vector6f currentForceTorque
force torque
Definition: TaskspaceImpedanceController.h:55
armarx::control::common::control_law::TaskspaceImpedanceController::initialize
void initialize(const VirtualRobot::RobotNodeSetPtr &rns, const VirtualRobot::RobotNodeSetPtr &rtRns)
Definition: TaskspaceImpedanceController.cpp:16
armarx::control::common::control_law::TaskspaceImpedanceController::RtStatus::qvelFiltered
Eigen::VectorXf qvelFiltered
current status
Definition: TaskspaceImpedanceController.h:61
armarx::control::common::control_law::TaskspaceImpedanceController::run
void run(Config &c, RtStatus &robotStatus)
Definition: TaskspaceImpedanceController.cpp:66
armarx::control::common::control_law::TaskspaceImpedanceController::RtStatus::currentTwist
Eigen::Vector6f currentTwist
Definition: TaskspaceImpedanceController.h:63
armarx::control::common::control_law::RobotStatus
Definition: common.h:29
armarx::control::common::control_law::TaskspaceImpedanceController::RtStatus::rtPreActivate
void rtPreActivate(const Eigen::Matrix4f &currentPose)
Definition: TaskspaceImpedanceController.cpp:203
armarx::control::common::control_law
This file is part of ArmarX.
Definition: aron_conversions.cpp:68
ControlTarget1DoFActuator.h
armarx::control::common::control_law::TaskspaceImpedanceController::rtTCP
VirtualRobot::RobotNodePtr rtTCP
Definition: TaskspaceImpedanceController.h:93
armarx::control::common::control_law::TaskspaceImpedanceController::RtStatus::rtSafe
bool rtSafe
Definition: TaskspaceImpedanceController.h:74
TripleBuffer.h
GfxTL::Matrix3f
MatrixXX< 3, 3, float > Matrix3f
Definition: MatrixXX.h:600
GfxTL::Matrix4f
MatrixXX< 4, 4, float > Matrix4f
Definition: MatrixXX.h:601
armarx::control::common::control_law::TaskspaceImpedanceController::RtStatus::poseDiffMatImp
Eigen::Matrix3f poseDiffMatImp
intermediate results
Definition: TaskspaceImpedanceController.h:67
armarx::control::common::control_law::TaskspaceImpedanceController
Definition: TaskspaceImpedanceController.h:40
armarx::control::common::control_law::TaskspaceImpedanceController::RtStatus::currentPose
Eigen::Matrix4f currentPose
Definition: TaskspaceImpedanceController.h:62
armarx::control::common::control_law::TaskspaceImpedanceController::RtStatus::rtTargetSafe
bool rtTargetSafe
Definition: TaskspaceImpedanceController.h:75
armarx::control::common::control_law::TaskspaceImpedanceController::RtStatus::nullspaceTorque
Eigen::VectorXf nullspaceTorque
Definition: TaskspaceImpedanceController.h:52
armarx::control::common::control_law::TaskspaceImpedanceController::Config
common::control_law::arondto::TaskspaceImpedanceControllerConfig Config
Definition: TaskspaceImpedanceController.h:44
armarx::control::common::control_law::TaskspaceImpedanceController::tcp
VirtualRobot::RobotNodePtr tcp
Definition: TaskspaceImpedanceController.h:92
Eigen::Matrix< float, 6, 1 >
armarx::control::common::control_law::TaskspaceImpedanceController::RtStatus::poseErrorImp
Eigen::Vector6f poseErrorImp
Definition: TaskspaceImpedanceController.h:68
armarx::control::common::control_law::TaskspaceImpedanceController::firstRun
void firstRun()
Definition: TaskspaceImpedanceController.cpp:36
armarx::control::common::control_law::TaskspaceImpedanceController::RtStatus
internal status of the controller, containing intermediate variables, mutable targets
Definition: TaskspaceImpedanceController.h:48
armarx::control::common::ft::FTSensor
Definition: FTSensor.h:45
SensorValue1DoFActuator.h