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 #include <armarx/control/njoint_mp_controller/task_space/aron/NJointMPControllerConfig.aron.generated.h>
30 
31 
32 
34 {
36  using namespace armarx::control::common;
37 
38 
39  struct Constraint
40  {
41  std::string type;
42  Eigen::Vector3f pcaMean;
45  Eigen::Vector3f localFrameOrigin;
46  Eigen::VectorXf vmpStart;
47 
48  int priority = 0;
49  Eigen::MatrixXf density_mu;
50  Eigen::VectorXf density_weights;
51  float density_std_dev = 0.0f;
52  float spatial_scale = 0.0;
53 
54  float pm_scale = 1.0;
55  Eigen::Vector3f pm_init_proj_point;
56  float pm_init_proj_value = 0.0;
57  Eigen::Vector3f pm_init_tangent_vec;
58 
59  };
60  using ConstraintPtr = std::shared_ptr<Constraint>;
61 
62 
65  {
67  std::vector<Constraint> constraintList;
68  };
69 
70 
71  /**
72  * @defgroup Library-NJointKVILImpedanceMPController NJointKVILImpedanceMPController
73  * @ingroup Library-RobotUnit-NJointControllers
74  * A description of the library NJointKVILImpedanceMPController.
75  *
76  * @class NJointKVILImpedanceMPController
77  * @ingroup Library-NJointKVILImpedanceMPController
78  * @brief Brief description of class NJointKVILImpedanceMPController.
79  *
80  * Detailed description of class NJointKVILImpedanceMPController.
81  */
84  , virtual public mp::MPPool
86  {
87  public:
88  using AronDTO = arondto::KVILImpedanceMPConfig;
90 
91  NJointKVILImpedanceMPController(const RobotUnitPtr& robotUnit, const NJointControllerConfigPtr& config, const VirtualRobot::RobotPtr&);
92 
93  std::string getClassName(const Ice::Current&) const override;
94  void updateConfig(const ::armarx::aron::data::dto::DictPtr& dto,
95  const Ice::Current& iceCurrent = Ice::emptyCurrent) override;
96  void rtPreActivateController() override;
97  void additionalTask() override;
98 
99 // void configureConstraints(const std::vector<Constraint>&c);
100 
101  void setCurveProjection(const Eigen::Vector3f& curve_proj_point_, float proj_value_, const Eigen::Vector3f& curve_vec_, const Ice::Current &) override;
102  Eigen::Vector3f getCurveKeypointPosition(const Ice::Current &) override;
103 
104  private:
105  std::map<std::string, ConstraintPtr> constraints;
106  int n_constraints = 0;
107 
108  struct NonlinearManifoldInfoStruct
109  {
110  Eigen::Vector3f pm_proj_point;
111  float pm_proj_point_to_mean_distance = 100.0f;
112  Eigen::Vector3f pm_tangent_vec;
113  };
114 
115  struct p2CStruct
116  {
117  Eigen::Vector3f curve_kpt_position;
118  };
119 
121  TripleBuffer<p2CStruct> kpt_status_buffer;
122 
123  protected:
126  };
127 }
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_controller::task_space::NJointKeypointsImpedanceController::BO
law::KeypointsImpedanceController::Config BO
Definition: KeypointsImpedanceController.h:59
armarx::control::njoint_mp_controller::task_space::ConstraintPtr
std::shared_ptr< Constraint > ConstraintPtr
Definition: KVILImpedanceController.h:60
armarx::control::njoint_mp_controller::task_space::KVILImpedanceMPConfig::constraintList
std::vector< Constraint > constraintList
Definition: KVILImpedanceController.h:67
armarx::control::njoint_controller::task_space::NJointKeypointsImpedanceController
Brief description of class NJointKeypointsImpedanceController.
Definition: KeypointsImpedanceController.h:52
armarx::control::njoint_mp_controller::task_space::KVILImpedanceMPConfig::mpConfig
mp::MP::MPListConfig mpConfig
Definition: KVILImpedanceController.h:66
armarx::control::njoint_controller::task_space
Definition: AdmittanceController.cpp:35
armarx::control::njoint_mp_controller::task_space::NJointKVILImpedanceMPController::bufferUserToRt
TripleBuffer< BO > bufferUserToRt
Definition: KVILImpedanceController.h:125
armarx::control::common
This file is part of ArmarX.
Definition: aron_conversions.cpp:25
armarx::control::njoint_mp_controller::task_space::Constraint::vmpStart
Eigen::VectorXf vmpStart
Definition: KVILImpedanceController.h:46
armarx::control::njoint_mp_controller::task_space::Constraint::pcaMean
Eigen::Vector3f pcaMean
Definition: KVILImpedanceController.h:42
KeypointsMP.h
armarx::control::njoint_mp_controller::task_space::Constraint
Definition: KVILImpedanceController.h:39
armarx::control::njoint_mp_controller::task_space::Constraint::pm_init_tangent_vec
Eigen::Vector3f pm_init_tangent_vec
Definition: KVILImpedanceController.h:57
armarx::control::njoint_mp_controller::task_space::Constraint::density_mu
Eigen::MatrixXf density_mu
Definition: KVILImpedanceController.h:49
armarx::control::njoint_mp_controller::task_space::Constraint::localFrameOrigin
Eigen::Vector3f localFrameOrigin
Definition: KVILImpedanceController.h:45
armarx::control::njoint_controller::task_space::NJointKeypointsImpedanceController::AronDTO
law::arondto::KeypointControllerConfig AronDTO
Definition: KeypointsImpedanceController.h:58
armarx::control::njoint_mp_controller::task_space::Constraint::pcaComponents
Eigen::Matrix3f pcaComponents
Definition: KVILImpedanceController.h:43
armarx::control::njoint_mp_controller::task_space
This file is part of ArmarX.
Definition: AdmittanceController.cpp:28
armarx::control::njoint_mp_controller::task_space::Constraint::localFrameRotMat
Eigen::Matrix3f localFrameRotMat
Definition: KVILImpedanceController.h:44
armarx::aron::data::DictPtr
std::shared_ptr< Dict > DictPtr
Definition: Dict.h:41
armarx::control::common::mp::MP::MPListConfig
Definition: MP.h:102
GfxTL::Matrix3f
MatrixXX< 3, 3, float > Matrix3f
Definition: MatrixXX.h:600
armarx::control::njoint_mp_controller::task_space::Constraint::pm_init_proj_point
Eigen::Vector3f pm_init_proj_point
Definition: KVILImpedanceController.h:55
armarx::control::njoint_mp_controller::task_space::KVILImpedanceMPConfig
Definition: KVILImpedanceController.h:63
armarx::control::njoint_mp_controller::task_space::NJointKVILImpedanceMPController
Brief description of class NJointKVILImpedanceMPController.
Definition: KVILImpedanceController.h:82
armarx::control::common::mp::MPPool
Definition: MPPool.h:45
armarx::control::njoint_mp_controller::task_space::NJointKVILImpedanceMPController::bufferUserToAdditionalTask
TripleBuffer< BO > bufferUserToAdditionalTask
Definition: KVILImpedanceController.h:124
MPPool.h
armarx::control::njoint_mp_controller::task_space::Constraint::density_weights
Eigen::VectorXf density_weights
Definition: KVILImpedanceController.h:50
armarx::control::NJointKVILImpedanceMPControllerInterface
Definition: ControllerInterface.ice:171
KeypointsImpedanceController.h
armarx::control::njoint_mp_controller::task_space::Constraint::type
std::string type
Definition: KVILImpedanceController.h:41
VirtualRobot::RobotPtr
std::shared_ptr< class Robot > RobotPtr
Definition: Bus.h:18
armarx::TripleBuffer< NonlinearManifoldInfoStruct >