KVILImpedanceController.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 * @package ...
17 * @author Jianfeng Gao ( jianfeng dot gao at kit dot edu )
18 * @date 2021
19 * @copyright http://www.gnu.org/licenses/gpl-2.0.txt
20 * GNU General Public License
21 */
22
23#pragma once
24
28#include <armarx/control/njoint_mp_controller/task_space/ControllerInterface.h>
29
31{
32 using namespace armarx::control::njoint_controller::task_space;
33 using namespace armarx::control::common;
34
36 {
37 std::string type;
38 Eigen::Vector3f pcaMean;
39 Eigen::Matrix3f pcaComponents;
40 Eigen::Matrix3f localFrameRotMat;
41 Eigen::Vector3f localFrameOrigin;
42 Eigen::VectorXf vmpStart;
43
44 int priority = 0;
45 Eigen::MatrixXf density_mu;
46 Eigen::VectorXf density_weights;
47 float density_std_dev = 0.0f;
48 float spatial_scale = 0.0;
49
50 float pm_scale = 1.0;
51 Eigen::Vector3f pm_init_proj_point;
52 float pm_init_proj_value = 0.0;
53 Eigen::Vector3f pm_init_tangent_vec;
54 };
55
56 using ConstraintPtr = std::shared_ptr<Constraint1>;
57 using ConstraintList = std::vector<Constraint1>;
58
60 {
61 // mp::MP::MPListConfig mpConfig;
62 std::vector<mp::MP::MPConfig> mpList;
63 std::vector<Constraint1> constraintList;
64 };
65
66 /**
67 * @defgroup Library-NJointKVILImpedanceMPController NJointKVILImpedanceMPController
68 * @ingroup Library-RobotUnit-NJointControllers
69 * A description of the library NJointKVILImpedanceMPController.
70 *
71 * @class NJointKVILImpedanceMPController
72 * @ingroup Library-NJointKVILImpedanceMPController
73 * @brief Brief description of class NJointKVILImpedanceMPController.
74 *
75 * Detailed description of class NJointKVILImpedanceMPController.
76 */
79 virtual public mp::MPPool,
80 virtual public NJointKVILImpedanceMPControllerInterface
81 {
82 public:
83 using AronDTO = arondto::KVILImpedanceMPConfig;
85
87 const NJointControllerConfigPtr& config,
89
90 std::string getClassName(const Ice::Current&) const override;
91 void updateConfig(const ::armarx::aron::data::dto::DictPtr& dto,
92 const Ice::Current& iceCurrent = Ice::emptyCurrent) override;
94 getConfig(const Ice::Current& iceCurrent = Ice::emptyCurrent) override;
95 void rtPreActivateController() override;
96 void additionalTask() override;
97
99
100 void setCurveProjection(const Eigen::Vector3f& curve_proj_point_,
101 float proj_value_,
102 const Eigen::Vector3f& curve_vec_,
103 const Ice::Current&) override;
104 Eigen::Vector3f getCurveKeypointPosition(const Ice::Current&) override;
105
106 private:
107 std::map<std::string, ConstraintPtr> constraints;
108 int n_constraints = 0;
109
110 struct NonlinearManifoldInfoStruct
111 {
112 Eigen::Vector3f pm_proj_point;
113 float pm_proj_point_to_mean_distance = 100.0f;
114 Eigen::Vector3f pm_tangent_vec;
115 };
116
117 struct p2CStruct
118 {
119 Eigen::Vector3f curve_kpt_position;
120 };
121
123 TripleBuffer<p2CStruct> kpt_status_buffer;
124
125 protected:
129
130 private:
131 // std::atomic<bool> isMPReady{false};
132 };
133} // namespace armarx::control::njoint_mp_controller::task_space
constexpr T c
A simple triple buffer for lockfree comunication between a single writer and a single reader.
NJointKeypointsImpedanceController(const RobotUnitPtr &robotUnit, const NJointControllerConfigPtr &config, const VirtualRobot::RobotPtr &)
NJointKVILImpedanceMPController(const RobotUnitPtr &robotUnit, const NJointControllerConfigPtr &config, const VirtualRobot::RobotPtr &)
void setCurveProjection(const Eigen::Vector3f &curve_proj_point_, float proj_value_, const Eigen::Vector3f &curve_vec_, const Ice::Current &) override
::armarx::aron::data::dto::DictPtr getConfig(const Ice::Current &iceCurrent=Ice::emptyCurrent) override
void updateConfig(const ::armarx::aron::data::dto::DictPtr &dto, const Ice::Current &iceCurrent=Ice::emptyCurrent) override
void rtPreActivateController() override
This function is called before the controller is activated.
std::shared_ptr< class Robot > RobotPtr
Definition Bus.h:19
::IceInternal::Handle< Dict > DictPtr
IceUtil::Handle< class RobotUnit > RobotUnitPtr
Definition FTSensor.h:34
you can set the following values from outside of the rt controller via Ice interfaces