TaskspaceVelocityController.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 2024
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/VirtualRobot.h>
25
28
29#include <armarx/control/common/control_law/aron/TaskspaceVelocityControllerConfig.aron.generated.h>
32#include <armarx/control/common/ft/aron/FTConfig.aron.generated.h>
33
35{
36
38 {
39 public:
40 using FTConfig = common::ft::arondto::FTConfig;
41 using Config = common::control_law::arondto::TaskspaceVelocityControllerConfig;
42 using ConfigDict = common::control_law::arondto::TaskspaceVelocityControllerConfigDict;
43
44 /// internal status of the controller, containing intermediate variables, mutable targets
45 // struct RtStatus : public RobotStatus
46 // {
47 // /// targets
48 // // Eigen::VectorXf desiredJointTorques;
49 // Eigen::VectorXf desiredJointVelocity;
50 // // Eigen::VectorXf nullspaceTorque;
51 // Eigen::VectorXf nullspaceVelocity;
52 //
53 // /// force torque
54 // Eigen::Vector6f currentForceTorque;
55 // Eigen::Vector6f safeFTGuardOffset;
56 //
57 // /// task space variables
58 // // Eigen::Vector6f forceImpedance;
59 // Eigen::Vector6f cartesianVelTarget;
60 //
61 // /// current status
62 // // Eigen::VectorXf qpos;
63 // // Eigen::VectorXf qvel;
64 // Eigen::VectorXf qvelFiltered;
65 // Eigen::Matrix4f currentPose;
66 // Eigen::Vector6f currentTwist;
67 // Eigen::Matrix4f desiredPose;
68 // Eigen::Matrix4f desiredPoseUnsafe;
69 //
70 // /// intermediate results
71 // Eigen::Matrix3f poseDiffMatImp;
72 // Eigen::Vector6f poseErrorImp;
73 // Eigen::AngleAxisf oriDiffAngleAxis;
74 //
75 // /// others
76 // Eigen::MatrixXf jacobi;
77 // // Eigen::MatrixXf jtpinv;
78 // Eigen::MatrixXf jpinv;
79 // bool rtSafe;
80 // bool rtTargetSafe = true;
81 // bool forceTorqueSafe = true;
82 //
83 // // size_t nDoFTorque;
84 // // size_t nDoFVelocity;
85 //
86 // void reset(const unsigned int nDoF);
87 // void rtPreActivate(const Eigen::Matrix4f& currentPose);
88 // };
89
90 // unsigned int numOfJoints; // for nonRT use case
91 // size_t nDoFTorque;
92 // size_t nDoFVelocity;
93
94 private:
95 // Eigen::MatrixXf I;
96
97 VirtualRobot::DifferentialIKPtr ik;
98
99 // const float lambda = 2.0f;
100
101 public:
102 VirtualRobot::RobotNodePtr tcp;
103 VirtualRobot::RobotNodePtr rtTCP;
105
106 // std::vector<size_t> jointIDTorqueMode;
107 // std::vector<size_t> jointIDVelocityMode;
108
109 // bool isControlModeValid(const std::vector<std::string>& nameList,
110 // const std::map<std::string, std::string>& jointControlModeMap);
111 // void updateFT(const FTConfig& c, RtStatus& rtStatus);
112 void initialize(const VirtualRobot::RobotNodeSetPtr& rns,
113 const VirtualRobot::RobotNodeSetPtr& rtRns);
114 void preactivateInit(const VirtualRobot::RobotNodeSetPtr& rns);
115
116 void run(Config& c, TSCtrlRtStatus& robotStatus);
117 void firstRun();
118 };
119} // namespace armarx::control::common::control_law
constexpr T c
void initialize(const VirtualRobot::RobotNodeSetPtr &rns, const VirtualRobot::RobotNodeSetPtr &rtRns)
common::control_law::arondto::TaskspaceVelocityControllerConfig Config
common::control_law::arondto::TaskspaceVelocityControllerConfigDict ConfigDict