KeypointsImpedanceController.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 
25 #include <VirtualRobot/Robot.h>
26 
31 
33 #include <armarx/control/interface/ConfigurableNJointControllerInterface.h>
34 #include <armarx/control/njoint_controller/task_space/ControllerInterface.h>
36 
37 
39 {
41  /**
42  * @defgroup Library-NJointKeypointsImpedanceController NJointKeypointsImpedanceController
43  * @ingroup Library-RobotUnit-NJointControllers
44  * A description of the library NJointKeypointsImpedanceController.
45  *
46  * @class NJointKeypointsImpedanceController
47  * @ingroup Library-NJointKeypointsImpedanceController
48  * @brief Brief description of class NJointKeypointsImpedanceController.
49  *
50  * Detailed description of class NJointKeypointsImpedanceController.
51  */
53  virtual public NJointController,
55  {
56  public:
57  using ConfigPtrT = ConfigurableNJointControllerConfigPtr;
58  using AronDTO = law::arondto::KeypointControllerConfig;
59  using BO = law::KeypointsImpedanceController::Config;
60 
62  const NJointControllerConfigPtr& config,
63  const VirtualRobot::RobotPtr&);
64 
65  std::string getClassName(const Ice::Current&) const override;
66 
67  void rtRun(const IceUtil::Time& sensorValuesTimestamp,
68  const IceUtil::Time& timeSinceLastIteration) override;
69 
70  /// NJointController interface
71  // std::string getKinematicChainName(const Ice::Current&) override;
72 
74  const Ice::Current& iceCurrent = Ice::emptyCurrent) override;
75 
76  void validateConfigData(BO& config);
77 
78  protected:
79  virtual void additionalTask();
80  void onPublish(const SensorAndControl&,
82  const DebugObserverInterfacePrx&) override;
83 
84  protected:
85  /// devices
87  {
88  std::vector<const SensorValue1DoFActuatorTorque*> torqueSensors;
89  std::vector<const SensorValue1DoFActuatorVelocity*> velocitySensors;
90  std::vector<const SensorValue1DoFActuatorPosition*> positionSensors;
91  };
93 
94  std::vector<ControlTarget1DoFActuatorTorque*> targets;
95 
96  protected:
97  /// variables
98  std::string kinematicChainName;
99  std::vector<std::string> jointNames;
101 
102  /// set buffers
106 
107  std::atomic_bool rtFirstRun = true;
108  std::atomic_bool rtReady = false;
109  std::atomic_bool reInitPreActivate = false;
110 
112 
114 
115  RobotUnitPtr robotUnit;
116 
117  protected:
118  /// NJointControllerBase interface
119  void onInitNJointController() override;
120  void rtPreActivateController() override;
121  void rtPostDeactivateController() override;
122  };
123 } /// namespace armarx::control::njoint_controller::task_space
armarx::control::njoint_controller::task_space::NJointKeypointsImpedanceController::SensorDevices::velocitySensors
std::vector< const SensorValue1DoFActuatorVelocity * > velocitySensors
Definition: KeypointsImpedanceController.h:89
armarx::control::njoint_controller::task_space::NJointKeypointsImpedanceController::bufferRtToAdditionalTask
TripleBuffer< law::RobotStatus > bufferRtToAdditionalTask
Definition: KeypointsImpedanceController.h:105
armarx::control::njoint_controller::task_space::NJointKeypointsImpedanceController::robotUnit
RobotUnitPtr robotUnit
Definition: KeypointsImpedanceController.h:115
armarx::control::njoint_controller::task_space::NJointKeypointsImpedanceController::BO
law::KeypointsImpedanceController::Config BO
Definition: KeypointsImpedanceController.h:59
armarx::control::njoint_controller::task_space::NJointKeypointsImpedanceController::kinematicChainName
std::string kinematicChainName
variables
Definition: KeypointsImpedanceController.h:98
armarx::control::njoint_controller::task_space::NJointKeypointsImpedanceController
Brief description of class NJointKeypointsImpedanceController.
Definition: KeypointsImpedanceController.h:52
RobotUnit.h
armarx::control::njoint_controller::task_space::NJointKeypointsImpedanceController::bufferUserToRt
TripleBuffer< BO > bufferUserToRt
Definition: KeypointsImpedanceController.h:104
armarx::SynchronousNJointController
Definition: NJointControllerBase.h:1145
armarx::control::njoint_controller::task_space
Definition: AdmittanceController.cpp:35
armarx::control::njoint_controller::task_space::NJointKeypointsImpedanceController::sensorDevices
SensorDevices sensorDevices
Definition: KeypointsImpedanceController.h:92
armarx::control::njoint_controller::task_space::NJointKeypointsImpedanceController::nonRtRobot
VirtualRobot::RobotPtr nonRtRobot
Definition: KeypointsImpedanceController.h:111
armarx::NJointControllerBase::ConfigPtrT
NJointControllerConfigPtr ConfigPtrT
Definition: NJointControllerBase.h:586
armarx::control::njoint_controller::task_space::NJointKeypointsImpedanceController::onInitNJointController
void onInitNJointController() override
NJointControllerBase interface.
Definition: KeypointsImpedanceController.cpp:121
armarx::control::njoint_controller::task_space::NJointKeypointsImpedanceController::rtFirstRun
std::atomic_bool rtFirstRun
Definition: KeypointsImpedanceController.h:107
armarx::detail::ControlThreadOutputBufferEntry
Definition: ControlThreadOutputBuffer.h:177
armarx::control::njoint_controller::task_space::NJointKeypointsImpedanceController::targets
std::vector< ControlTarget1DoFActuatorTorque * > targets
Definition: KeypointsImpedanceController.h:94
armarx::control::njoint_controller::task_space::NJointKeypointsImpedanceController::controlTargets
common::control_law::ControlTarget controlTargets
Definition: KeypointsImpedanceController.h:113
armarx::control::njoint_controller::task_space::NJointKeypointsImpedanceController::rtPostDeactivateController
void rtPostDeactivateController() override
This function is called after the controller is deactivated.
Definition: KeypointsImpedanceController.cpp:306
armarx::control::njoint_controller::task_space::NJointKeypointsImpedanceController::validateConfigData
void validateConfigData(BO &config)
Definition: KeypointsImpedanceController.cpp:204
armarx::control::njoint_controller::task_space::NJointKeypointsImpedanceController::jointNames
std::vector< std::string > jointNames
Definition: KeypointsImpedanceController.h:99
KeypointsImpedanceController.h
armarx::control::njoint_controller::task_space::NJointKeypointsImpedanceController::additionalTask
virtual void additionalTask()
Definition: KeypointsImpedanceController.cpp:142
armarx::control::common::control_law
namespace armarx::control::common::ft
Definition: aron_conversions.cpp:62
ControlTarget1DoFActuator.h
armarx::control::njoint_controller::task_space::NJointKeypointsImpedanceController::NJointKeypointsImpedanceController
NJointKeypointsImpedanceController(const RobotUnitPtr &robotUnit, const NJointControllerConfigPtr &config, const VirtualRobot::RobotPtr &)
Definition: KeypointsImpedanceController.cpp:41
armarx::control::NJointKeypointsImpedanceControllerInterface
Definition: ControllerInterface.ice:54
armarx::control::njoint_controller::task_space::NJointKeypointsImpedanceController::AronDTO
law::arondto::KeypointControllerConfig AronDTO
Definition: KeypointsImpedanceController.h:58
armarx::control::common::control_law::KeypointsImpedanceController
Definition: KeypointsImpedanceController.h:37
armarx::armem::Time
armarx::core::time::DateTime Time
Definition: forward_declarations.h:13
armarx::control::njoint_controller::task_space::NJointKeypointsImpedanceController::SensorDevices::torqueSensors
std::vector< const SensorValue1DoFActuatorTorque * > torqueSensors
Definition: KeypointsImpedanceController.h:88
armarx::control::njoint_controller::task_space::NJointKeypointsImpedanceController::reInitPreActivate
std::atomic_bool reInitPreActivate
Definition: KeypointsImpedanceController.h:109
NJointController.h
armarx::aron::data::DictPtr
std::shared_ptr< Dict > DictPtr
Definition: Dict.h:41
armarx::control::njoint_controller::task_space::NJointKeypointsImpedanceController::bufferUserToAdditionalTask
TripleBuffer< BO > bufferUserToAdditionalTask
set buffers
Definition: KeypointsImpedanceController.h:103
armarx::control::njoint_controller::task_space::NJointKeypointsImpedanceController::rtPreActivateController
void rtPreActivateController() override
This function is called before the controller is activated.
Definition: KeypointsImpedanceController.cpp:270
armarx::control::njoint_controller::task_space::NJointKeypointsImpedanceController::SensorDevices
devices
Definition: KeypointsImpedanceController.h:86
armarx::control::njoint_controller::task_space::NJointKeypointsImpedanceController::getClassName
std::string getClassName(const Ice::Current &) const override
Definition: KeypointsImpedanceController.cpp:110
armarx::control::njoint_controller::task_space::NJointKeypointsImpedanceController::updateConfig
void updateConfig(const ::armarx::aron::data::dto::DictPtr &dto, const Ice::Current &iceCurrent=Ice::emptyCurrent) override
NJointController interface.
Definition: KeypointsImpedanceController.cpp:189
IceInternal::ProxyHandle<::IceProxy::armarx::DebugDrawerInterface >
armarx::control::njoint_controller::task_space::NJointKeypointsImpedanceController::onPublish
void onPublish(const SensorAndControl &, const DebugDrawerInterfacePrx &, const DebugObserverInterfacePrx &) override
Definition: KeypointsImpedanceController.cpp:238
armarx::control::common::control_law::ControlTarget
Definition: common.h:44
armarx::control::njoint_controller::task_space::NJointKeypointsImpedanceController::rtRun
void rtRun(const IceUtil::Time &sensorValuesTimestamp, const IceUtil::Time &timeSinceLastIteration) override
TODO make protected and use attorneys.
Definition: KeypointsImpedanceController.cpp:153
armarx::control::njoint_controller::task_space::NJointKeypointsImpedanceController::controller
law::KeypointsImpedanceController controller
Definition: KeypointsImpedanceController.h:100
armarx::control::njoint_controller::task_space::NJointKeypointsImpedanceController::SensorDevices::positionSensors
std::vector< const SensorValue1DoFActuatorPosition * > positionSensors
Definition: KeypointsImpedanceController.h:90
armarx::control::njoint_controller::task_space::NJointKeypointsImpedanceController::rtReady
std::atomic_bool rtReady
Definition: KeypointsImpedanceController.h:108
SensorValue1DoFActuator.h
VirtualRobot::RobotPtr
std::shared_ptr< class Robot > RobotPtr
Definition: Bus.h:18
armarx::TripleBuffer< BO >
controller_descriptions.h