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/VirtualRobot.h>
26
28
30#include <armarx/control/interface/ConfigurableNJointControllerInterface.h>
32#include <armarx/control/njoint_controller/task_space/ControllerInterface.h>
33
35{
36 namespace law = armarx::control::common::control_law;
37
38 /**
39 * @defgroup Library-NJointKeypointsImpedanceController NJointKeypointsImpedanceController
40 * @ingroup Library-RobotUnit-NJointControllers
41 * A description of the library NJointKeypointsImpedanceController.
42 *
43 * @class NJointKeypointsImpedanceController
44 * @ingroup Library-NJointKeypointsImpedanceController
45 * @brief Brief description of class NJointKeypointsImpedanceController.
46 *
47 * Detailed description of class NJointKeypointsImpedanceController.
48 */
50 virtual public NJointController,
52 {
53 public:
54 using ConfigPtrT = ConfigurableNJointControllerConfigPtr;
55 using AronDTO = law::arondto::KeypointControllerConfig;
56 using BO = law::KeypointsImpedanceController::Config;
57
59 const NJointControllerConfigPtr& config,
61
62 std::string getClassName(const Ice::Current&) const override;
63
64 void rtRun(const IceUtil::Time& sensorValuesTimestamp,
65 const IceUtil::Time& timeSinceLastIteration) override;
66
67 /// NJointController interface
68 // std::string getKinematicChainName(const Ice::Current&) override;
69
70 void updateConfig(const ::armarx::aron::data::dto::DictPtr& dto,
71 const Ice::Current& iceCurrent = Ice::emptyCurrent) override;
73 getConfig(const Ice::Current& iceCurrent = Ice::emptyCurrent) override;
74 void validateConfigData(BO& config);
75
76 protected:
77 virtual void additionalTask();
78 void onPublish(const SensorAndControl&,
80 const DebugObserverInterfacePrx&) override;
81
82 protected:
83 /// devices
85 {
86 std::vector<const SensorValue1DoFActuatorTorque*> torqueSensors;
87 std::vector<const SensorValue1DoFActuatorVelocity*> velocitySensors;
88 std::vector<const SensorValue1DoFActuatorPosition*> positionSensors;
89 };
90
92
93 std::vector<ControlTarget1DoFActuatorTorque*> targets;
94
95 protected:
96 /// variables
97 std::string kinematicChainName;
98 std::vector<std::string> jointNames;
99 law::KeypointsImpedanceController controller;
100
101 /// set buffers
106
107 std::atomic_bool rtFirstRun = true;
108 std::atomic_bool rtReady = false;
109 std::atomic_bool reInitPreActivate = false;
110
112
114
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
A simple triple buffer for lockfree comunication between a single writer and a single reader.
void onPublish(const SensorAndControl &, const DebugDrawerInterfacePrx &, const DebugObserverInterfacePrx &) override
::armarx::aron::data::dto::DictPtr getConfig(const Ice::Current &iceCurrent=Ice::emptyCurrent) override
NJointKeypointsImpedanceController(const RobotUnitPtr &robotUnit, const NJointControllerConfigPtr &config, const VirtualRobot::RobotPtr &)
void rtPostDeactivateController() override
This function is called after the controller is deactivated.
void rtRun(const IceUtil::Time &sensorValuesTimestamp, const IceUtil::Time &timeSinceLastIteration) override
TODO make protected and use attorneys.
void updateConfig(const ::armarx::aron::data::dto::DictPtr &dto, const Ice::Current &iceCurrent=Ice::emptyCurrent) override
NJointController interface.
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
::IceInternal::ProxyHandle<::IceProxy::armarx::DebugObserverInterface > DebugObserverInterfacePrx
SynchronousNJointController NJointController
IceUtil::Handle< class RobotUnit > RobotUnitPtr
Definition FTSensor.h:34
::IceInternal::ProxyHandle<::IceProxy::armarx::DebugDrawerInterface > DebugDrawerInterfacePrx
detail::ControlThreadOutputBufferEntry SensorAndControl
TODO remove, only used by keypoint controllers.
Definition common.h:146