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 {
33  using namespace armarx::control::common;
34 
35  struct Constraint1
36  {
37  std::string type;
38  Eigen::Vector3f pcaMean;
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,
81  {
82  public:
83  using AronDTO = arondto::KVILImpedanceMPConfig;
85 
86  NJointKVILImpedanceMPController(const RobotUnitPtr& robotUnit,
87  const NJointControllerConfigPtr& config,
88  const VirtualRobot::RobotPtr&);
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 
98  void configureConstraints(const ConstraintList& c);
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
armarx::control::common::control_law::KeypointsImpedanceController::Config
you can set the following values from outside of the rt controller via Ice interfaces
Definition: KeypointsImpedanceController.h:41
armarx::control::njoint_mp_controller::task_space::Constraint1::pcaComponents
Eigen::Matrix3f pcaComponents
Definition: KVILImpedanceController.h:39
armarx::control::njoint_controller::task_space::NJointKeypointsImpedanceController::BO
law::KeypointsImpedanceController::Config BO
Definition: KeypointsImpedanceController.h:59
armarx::control::njoint_controller::task_space::NJointKeypointsImpedanceController
Brief description of class NJointKeypointsImpedanceController.
Definition: KeypointsImpedanceController.h:52
armarx::control::njoint_mp_controller::task_space::Constraint1::pm_init_proj_point
Eigen::Vector3f pm_init_proj_point
Definition: KVILImpedanceController.h:51
armarx::control::njoint_mp_controller::task_space::ConstraintList
std::vector< Constraint1 > ConstraintList
Definition: KVILImpedanceController.h:57
armarx::control::njoint_mp_controller::task_space::Constraint1::density_mu
Eigen::MatrixXf density_mu
Definition: KVILImpedanceController.h:45
armarx::control::njoint_mp_controller::task_space::NJointKVILImpedanceMPController::bufferAdditionalTaskToUser
TripleBuffer< BO > bufferAdditionalTaskToUser
Definition: KVILImpedanceController.h:127
armarx::control::njoint_controller::task_space
Definition: AdmittanceController.cpp:37
armarx::control::njoint_mp_controller::task_space::Constraint1::localFrameOrigin
Eigen::Vector3f localFrameOrigin
Definition: KVILImpedanceController.h:41
c
constexpr T c
Definition: UnscentedKalmanFilterTest.cpp:43
armarx::control::njoint_mp_controller::task_space::NJointKVILImpedanceMPController::bufferUserToRt
TripleBuffer< BO > bufferUserToRt
Definition: KVILImpedanceController.h:128
armarx::control::common
This file is part of ArmarX.
Definition: aron_conversions.cpp:29
armarx::control::njoint_mp_controller::task_space::Constraint1::vmpStart
Eigen::VectorXf vmpStart
Definition: KVILImpedanceController.h:42
armarx::control::njoint_mp_controller::task_space::Constraint1::pm_init_tangent_vec
Eigen::Vector3f pm_init_tangent_vec
Definition: KVILImpedanceController.h:53
armarx::control::njoint_mp_controller::task_space::Constraint1::pcaMean
Eigen::Vector3f pcaMean
Definition: KVILImpedanceController.h:38
KeypointsMP.h
armarx::control::njoint_controller::task_space::NJointKeypointsImpedanceController::AronDTO
law::arondto::KeypointControllerConfig AronDTO
Definition: KeypointsImpedanceController.h:58
armarx::control::njoint_mp_controller::task_space
This file is part of ArmarX.
Definition: AdmittanceController.cpp:26
armarx::control::njoint_mp_controller::task_space::KVILImpedanceMPConfig::mpList
std::vector< mp::MP::MPConfig > mpList
Definition: KVILImpedanceController.h:62
armarx::aron::data::DictPtr
std::shared_ptr< Dict > DictPtr
Definition: Dict.h:41
armarx::control::njoint_mp_controller::task_space::Constraint1::density_weights
Eigen::VectorXf density_weights
Definition: KVILImpedanceController.h:46
GfxTL::Matrix3f
MatrixXX< 3, 3, float > Matrix3f
Definition: MatrixXX.h:600
armarx::control::njoint_mp_controller::task_space::KVILImpedanceMPConfig
Definition: KVILImpedanceController.h:59
armarx::control::njoint_mp_controller::task_space::NJointKVILImpedanceMPController
Brief description of class NJointKVILImpedanceMPController.
Definition: KVILImpedanceController.h:77
armarx::control::common::mp::MPPool
Definition: MPPool.h:47
armarx::control::njoint_mp_controller::task_space::NJointKVILImpedanceMPController::bufferUserToAdditionalTask
TripleBuffer< BO > bufferUserToAdditionalTask
Definition: KVILImpedanceController.h:126
MPPool.h
armarx::control::njoint_mp_controller::task_space::Constraint1::localFrameRotMat
Eigen::Matrix3f localFrameRotMat
Definition: KVILImpedanceController.h:40
armarx::control::njoint_mp_controller::task_space::Constraint1::type
std::string type
Definition: KVILImpedanceController.h:37
armarx::control::NJointKVILImpedanceMPControllerInterface
Definition: ControllerInterface.ice:99
KeypointsImpedanceController.h
VirtualRobot::RobotPtr
std::shared_ptr< class Robot > RobotPtr
Definition: Bus.h:18
armarx::TripleBuffer< NonlinearManifoldInfoStruct >
armarx::control::njoint_mp_controller::task_space::ConstraintPtr
std::shared_ptr< Constraint1 > ConstraintPtr
Definition: KVILImpedanceController.h:56
armarx::control::njoint_mp_controller::task_space::Constraint1
Definition: KVILImpedanceController.h:35
armarx::control::njoint_mp_controller::task_space::KVILImpedanceMPConfig::constraintList
std::vector< Constraint1 > constraintList
Definition: KVILImpedanceController.h:63