CollisionAvoidanceMixedImpedanceVelocityController.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/common/control_law/aron/CollisionAvoidanceControllerConfig.aron.generated.h>
33 #include <armarx/control/njoint_controller/task_space/ControllerInterface.h>
35 
36 #include <simox/control/environment/CollisionRobot.h>
37 #include <simox/control/geodesics/metric/inertia.h>
38 #include <simox/control/impl/simox/robot/Robot.h>
39 
41 {
43 
44  /**
45  * @defgroup Library-NJointTaskspaceController NJointTaskspaceCollisionAvoidanceMixedImpedanceVelocityController
46  * @ingroup Library-RobotUnit-NJointControllers
47  * A description of the library NJointTaskspaceCollisionAvoidanceMixedImpedanceVelocityController.
48  *
49  * @class NJointTaskspaceCollisionAvoidanceMixedImpedanceVelocityController
50  * @ingroup Library-NJointTaskspaceController
51  * @brief Brief description of class NJointTaskspaceCollisionAvoidanceMixedImpedanceVelocityController.
52  *
53  * Detailed description of class NJointTaskspaceCollisionAvoidanceMixedImpedanceVelocityController.
54  */
59  {
60  public:
61  using ConfigPtrT = ConfigurableNJointControllerConfigPtr;
62  using CollisionCtrlCfg = common::control_law::arondto::
63  CollisionAvoidanceTSMixedImpedanceVelocityControllerConfig;
64 
66  const RobotUnitPtr& robotUnit,
67  const NJointControllerConfigPtr& config,
68  const VirtualRobot::RobotPtr& robot);
69 
70  std::string getClassName(const Ice::Current& = Ice::emptyCurrent) const override;
71 
72  void rtRun(const IceUtil::Time& sensorValuesTimestamp,
73  const IceUtil::Time& timeSinceLastIteration) override;
74 
75  /// NJointController interface for collision avoidance
76  void
78  const Ice::Current& iceCurrent = Ice::emptyCurrent) override;
80  getCollisionAvoidanceConfig(const Ice::Current& iceCurrent = Ice::emptyCurrent) override;
81 
84  const std::map<std::string, ConstControlDevicePtr>&,
85  const std::map<std::string, ConstSensorDevicePtr>&);
86 
88 
90  const Ice::Current& iceCurrent) override;
91  ::armarx::aron::data::dto::DictPtr getConfig(const Ice::Current& iceCurrent) override;
92 
93  protected:
94  void limbRT(ArmPtr& arm, const double deltaT);
95  void onPublish(const SensorAndControl& sc,
96  const DebugDrawerInterfacePrx& drawer,
97  const DebugObserverInterfacePrx&) override;
98 
100  const DebugObserverInterfacePrx& debugObs);
101 
102  protected:
103  /// NJointControllerBase interface
104  void rtPreActivateController() override;
105  void rtPostDeactivateController() override;
106 
107  private:
108  core::CollisionAvoidanceBasePtr coll = nullptr;
109  std::atomic_bool collReady{false};
110 
111  CollisionCtrlCfg userCfgWithColl;
112 
114  VirtualRobot::RobotNodePtr rootNode;
115  };
116 } // namespace armarx::control::njoint_controller::task_space
armarx::control::NJointTaskspaceCollisionAvoidanceMixedImpedanceVelocityControllerInterface
Definition: ControllerInterface.ice:106
armarx::control::njoint_controller::task_space::NJointTaskspaceCollisionAvoidanceMixedImpedanceVelocityController::GenerateConfigDescription
static WidgetDescription::WidgetPtr GenerateConfigDescription(const VirtualRobot::RobotPtr &, const std::map< std::string, ConstControlDevicePtr > &, const std::map< std::string, ConstSensorDevicePtr > &)
Definition: CollisionAvoidanceMixedImpedanceVelocityController.cpp:657
armarx::StringVariantBaseMap
std::map< std::string, VariantBasePtr > StringVariantBaseMap
Definition: ManagedIceObject.h:110
NJointControllerBase.h
GfxTL::Matrix4f
MatrixXX< 4, 4, float > Matrix4f
Definition: MatrixXX.h:650
armarx::control::njoint_controller::task_space::NJointTaskspaceCollisionAvoidanceMixedImpedanceVelocityController::updateCollisionAvoidanceConfig
void updateCollisionAvoidanceConfig(const ::armarx::aron::data::dto::DictPtr &dto, const Ice::Current &iceCurrent=Ice::emptyCurrent) override
NJointController interface for collision avoidance.
Definition: CollisionAvoidanceMixedImpedanceVelocityController.cpp:169
armarx::control::njoint_controller::task_space::NJointTaskspaceCollisionAvoidanceMixedImpedanceVelocityController::GenerateConfigFromVariants
static ConfigPtrT GenerateConfigFromVariants(const StringVariantBaseMap &values)
Definition: CollisionAvoidanceMixedImpedanceVelocityController.cpp:696
armarx::control::njoint_controller::task_space::NJointTaskspaceCollisionAvoidanceMixedImpedanceVelocityController::collLimbPublish
void collLimbPublish(core::CollisionAvoidanceBase::NodeSetData &arm, const DebugObserverInterfacePrx &debugObs)
Definition: CollisionAvoidanceMixedImpedanceVelocityController.cpp:213
armarx::control::njoint_controller::task_space
Definition: AdmittanceController.cpp:43
ProsthesisInterface.values
values
Definition: ProsthesisInterface.py:190
armarx::control::njoint_controller::task_space::NJointTaskspaceCollisionAvoidanceMixedImpedanceVelocityController
Brief description of class NJointTaskspaceCollisionAvoidanceMixedImpedanceVelocityController.
Definition: CollisionAvoidanceMixedImpedanceVelocityController.h:55
armarx::NJointControllerBase::ConfigPtrT
NJointControllerConfigPtr ConfigPtrT
Definition: NJointControllerBase.h:587
armarx::control::njoint_controller::task_space::NJointTaskspaceCollisionAvoidanceMixedImpedanceVelocityController::onPublish
void onPublish(const SensorAndControl &sc, const DebugDrawerInterfacePrx &drawer, const DebugObserverInterfacePrx &) override
Definition: CollisionAvoidanceMixedImpedanceVelocityController.cpp:614
device.h
MixedImpedanceVelocityController.h
armarx::control::njoint_controller::core::CollisionAvoidanceBasePtr
std::shared_ptr< CollisionAvoidanceBase > CollisionAvoidanceBasePtr
Definition: CollisionAvoidanceCore.h:136
CollisionAvoidanceCore.h
armarx::control::njoint_controller::task_space::NJointTaskspaceCollisionAvoidanceMixedImpedanceVelocityController::rtRun
void rtRun(const IceUtil::Time &sensorValuesTimestamp, const IceUtil::Time &timeSinceLastIteration) override
TODO make protected and use attorneys.
Definition: CollisionAvoidanceMixedImpedanceVelocityController.cpp:143
IceInternal::Handle
Definition: forward_declarations.h:8
armarx::detail::ControlThreadOutputBufferEntry
Definition: ControlThreadOutputBuffer.h:182
armarx::control::njoint_controller::core::CollisionAvoidanceBase::NodeSetData
Definition: CollisionAvoidanceCore.h:68
armarx::control::njoint_controller::task_space::NJointTaskspaceCollisionAvoidanceMixedImpedanceVelocityController::limbRT
void limbRT(ArmPtr &arm, const double deltaT)
Definition: CollisionAvoidanceMixedImpedanceVelocityController.cpp:79
GfxTL::Identity
void Identity(MatrixXX< N, N, T > *a)
Definition: MatrixXX.h:570
armarx::ArVizComponentPluginUser
Provides a ready-to-use ArViz client arviz as member variable.
Definition: ArVizComponentPlugin.h:35
armarx::control::njoint_controller::task_space::NJointTaskspaceMixedImpedanceVelocityController
Brief description of class NJointTaskspaceMixedImpedanceVelocityController.
Definition: MixedImpedanceVelocityController.h:50
armarx::control::CollisionAvoidanceControllerInterface::getCollisionAvoidanceConfig
armarx::aron::data::dto::Dict getCollisionAvoidanceConfig()
armarx::control::common::control_law
This file is part of ArmarX.
Definition: aron_conversions.cpp:68
armarx::control::njoint_controller::task_space::NJointTaskspaceCollisionAvoidanceMixedImpedanceVelocityController::rtPostDeactivateController
void rtPostDeactivateController() override
This function is called after the controller is deactivated.
Definition: CollisionAvoidanceMixedImpedanceVelocityController.cpp:644
armarx::armem::Time
armarx::core::time::DateTime Time
Definition: forward_declarations.h:13
armarx::control::njoint_controller::task_space::NJointTaskspaceCollisionAvoidanceMixedImpedanceVelocityController::getConfig
::armarx::aron::data::dto::DictPtr getConfig(const Ice::Current &iceCurrent) override
Definition: CollisionAvoidanceMixedImpedanceVelocityController.cpp:200
armarx::control::njoint_controller::task_space::NJointTaskspaceCollisionAvoidanceMixedImpedanceVelocityController::getClassName
std::string getClassName(const Ice::Current &=Ice::emptyCurrent) const override
Definition: CollisionAvoidanceMixedImpedanceVelocityController.cpp:72
armarx::aron::data::DictPtr
std::shared_ptr< Dict > DictPtr
Definition: Dict.h:41
armarx::control::njoint_controller::task_space::NJointTaskspaceCollisionAvoidanceMixedImpedanceVelocityController::rtPreActivateController
void rtPreActivateController() override
NJointControllerBase interface.
Definition: CollisionAvoidanceMixedImpedanceVelocityController.cpp:630
IceUtil::Handle< class RobotUnit >
IceInternal::ProxyHandle<::IceProxy::armarx::DebugDrawerInterface >
CollisionAvoidance.h
armarx::control::njoint_controller::task_space::NJointTaskspaceCollisionAvoidanceMixedImpedanceVelocityController::updateConfig
void updateConfig(const ::armarx::aron::data::dto::DictPtr &dto, const Ice::Current &iceCurrent) override
Definition: CollisionAvoidanceMixedImpedanceVelocityController.cpp:189
armarx::control::njoint_controller::task_space::NJointTaskspaceCollisionAvoidanceMixedImpedanceVelocityController::NJointTaskspaceCollisionAvoidanceMixedImpedanceVelocityController
NJointTaskspaceCollisionAvoidanceMixedImpedanceVelocityController(const RobotUnitPtr &robotUnit, const NJointControllerConfigPtr &config, const VirtualRobot::RobotPtr &robot)
Definition: CollisionAvoidanceMixedImpedanceVelocityController.cpp:54
armarx::control::njoint_controller::task_space::NJointTaskspaceCollisionAvoidanceMixedImpedanceVelocityController::CollisionCtrlCfg
common::control_law::arondto::CollisionAvoidanceTSMixedImpedanceVelocityControllerConfig CollisionCtrlCfg
Definition: CollisionAvoidanceMixedImpedanceVelocityController.h:63
armarx::control::njoint_controller::task_space::NJointTaskspaceMixedImpedanceVelocityController::ArmPtr
std::unique_ptr< ArmData > ArmPtr
Definition: MixedImpedanceVelocityController.h:104
armarx::control::njoint_controller::task_space::NJointTaskspaceMixedImpedanceVelocityController::robotUnit
RobotUnitPtr robotUnit
Definition: MixedImpedanceVelocityController.h:173
VirtualRobot::RobotPtr
std::shared_ptr< class Robot > RobotPtr
Definition: Bus.h:19