CollisionAvoidanceImpedanceController.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 
29 
31 #include <armarx/control/common/control_law/aron/CollisionAvoidanceControllerConfig.aron.generated.h>
34 #include <armarx/control/njoint_controller/task_space/ControllerInterface.h>
36 
37 #include <simox/control/environment/CollisionRobot.h>
38 #include <simox/control/geodesics/metric/inertia.h>
39 #include <simox/control/impl/simox/robot/Robot.h>
40 
42 {
43  /**
44  * @defgroup Library-NJointTaskspaceCollisionAvoidanceImpedanceController NJointTaskspaceCollisionAvoidanceImpedanceController
45  * @ingroup Library-RobotUnit-NJointControllers
46  * A description of the library NJointTaskspaceCollisionAvoidanceImpedanceController.
47  *
48  * @class NJointTaskspaceCollisionAvoidanceImpedanceController
49  * @ingroup Library-NJointTaskspaceCollisionAvoidanceImpedanceController
50  * @brief Brief description of class NJointTaskspaceCollisionAvoidanceImpedanceController.
51  *
52  * Detailed description of class NJointTaskspaceCollisionAvoidanceImpedanceController.
53  */
58  {
59  public:
60  using ConfigPtrT = ConfigurableNJointControllerConfigPtr;
61  using CollisionCtrlCfg =
62  common::control_law::arondto::CollisionAvoidanceTSImpedanceControllerConfig;
63 
65  const RobotUnitPtr& robotUnit,
66  const NJointControllerConfigPtr& config,
67  const VirtualRobot::RobotPtr& robot);
68 
69  std::string getClassName(const Ice::Current& = Ice::emptyCurrent) const override;
70 
71  void rtRun(const IceUtil::Time& sensorValuesTimestamp,
72  const IceUtil::Time& timeSinceLastIteration) override;
73 
74  /// NJointController interface for collision avoidance
75  void
77  const Ice::Current& iceCurrent = Ice::emptyCurrent) override;
79  getCollisionAvoidanceConfig(const Ice::Current& iceCurrent = Ice::emptyCurrent) override;
80 
83  const std::map<std::string, ConstControlDevicePtr>&,
84  const std::map<std::string, ConstSensorDevicePtr>&);
85 
87 
89  const Ice::Current& iceCurrent) override;
90  ::armarx::aron::data::dto::DictPtr getConfig(const Ice::Current& iceCurrent) override;
91 
92  protected:
93  void limbRT(ArmPtr& arm, const double deltaT);
94  void onPublish(const SensorAndControl& sc,
95  const DebugDrawerInterfacePrx& drawer,
96  const DebugObserverInterfacePrx&) override;
97 
99  const DebugObserverInterfacePrx& debugObs);
100 
101  protected:
102  /// NJointControllerBase interface
103  void rtPreActivateController() override;
104  void rtPostDeactivateController() override;
105 
106  private:
107  core::CollisionAvoidanceBasePtr coll = nullptr;
108  std::atomic_bool collReady{false};
109 
110  CollisionCtrlCfg userCfgWithColl;
111  };
112 } // namespace armarx::control::njoint_controller::task_space
ArVizComponentPlugin.h
armarx::control::njoint_controller::task_space::NJointTaskspaceCollisionAvoidanceImpedanceController::GenerateConfigFromVariants
static ConfigPtrT GenerateConfigFromVariants(const StringVariantBaseMap &values)
Definition: CollisionAvoidanceImpedanceController.cpp:653
armarx::control::njoint_controller::task_space::NJointTaskspaceImpedanceController
Brief description of class NJointTaskspaceImpedanceController.
Definition: ImpedanceController.h:49
armarx::control::njoint_controller::task_space::NJointTaskspaceCollisionAvoidanceImpedanceController::CollisionCtrlCfg
common::control_law::arondto::CollisionAvoidanceTSImpedanceControllerConfig CollisionCtrlCfg
Definition: CollisionAvoidanceImpedanceController.h:62
armarx::StringVariantBaseMap
std::map< std::string, VariantBasePtr > StringVariantBaseMap
Definition: ManagedIceObject.h:110
NJointControllerBase.h
armarx::control::njoint_controller::task_space::NJointTaskspaceCollisionAvoidanceImpedanceController::onPublish
void onPublish(const SensorAndControl &sc, const DebugDrawerInterfacePrx &drawer, const DebugObserverInterfacePrx &) override
Definition: CollisionAvoidanceImpedanceController.cpp:576
armarx::control::njoint_controller::task_space
Definition: AdmittanceController.cpp:43
armarx::control::njoint_controller::task_space::NJointTaskspaceCollisionAvoidanceImpedanceController::updateCollisionAvoidanceConfig
void updateCollisionAvoidanceConfig(const ::armarx::aron::data::dto::DictPtr &dto, const Ice::Current &iceCurrent=Ice::emptyCurrent) override
NJointController interface for collision avoidance.
Definition: CollisionAvoidanceImpedanceController.cpp:150
armarx::control::njoint_controller::task_space::NJointTaskspaceCollisionAvoidanceImpedanceController::getClassName
std::string getClassName(const Ice::Current &=Ice::emptyCurrent) const override
Definition: CollisionAvoidanceImpedanceController.cpp:69
ProsthesisInterface.values
values
Definition: ProsthesisInterface.py:190
armarx::NJointControllerBase::ConfigPtrT
NJointControllerConfigPtr ConfigPtrT
Definition: NJointControllerBase.h:587
device.h
armarx::control::njoint_controller::task_space::NJointTaskspaceCollisionAvoidanceImpedanceController::getConfig
::armarx::aron::data::dto::DictPtr getConfig(const Ice::Current &iceCurrent) override
Definition: CollisionAvoidanceImpedanceController.cpp:182
armarx::control::njoint_controller::core::CollisionAvoidanceBasePtr
std::shared_ptr< CollisionAvoidanceBase > CollisionAvoidanceBasePtr
Definition: CollisionAvoidanceCore.h:136
CollisionAvoidanceCore.h
armarx::control::njoint_controller::task_space::NJointTaskspaceCollisionAvoidanceImpedanceController::limbRT
void limbRT(ArmPtr &arm, const double deltaT)
Definition: CollisionAvoidanceImpedanceController.cpp:75
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::NJointTaskspaceImpedanceController::ArmPtr
std::unique_ptr< ArmData > ArmPtr
Definition: ImpedanceController.h:98
armarx::ArVizComponentPluginUser
Provides a ready-to-use ArViz client arviz as member variable.
Definition: ArVizComponentPlugin.h:35
armarx::control::CollisionAvoidanceControllerInterface::getCollisionAvoidanceConfig
armarx::aron::data::dto::Dict getCollisionAvoidanceConfig()
armarx::control::njoint_controller::task_space::NJointTaskspaceCollisionAvoidanceImpedanceController::NJointTaskspaceCollisionAvoidanceImpedanceController
NJointTaskspaceCollisionAvoidanceImpedanceController(const RobotUnitPtr &robotUnit, const NJointControllerConfigPtr &config, const VirtualRobot::RobotPtr &robot)
Definition: CollisionAvoidanceImpedanceController.cpp:53
armarx::control::njoint_controller::task_space::NJointTaskspaceCollisionAvoidanceImpedanceController::GenerateConfigDescription
static WidgetDescription::WidgetPtr GenerateConfigDescription(const VirtualRobot::RobotPtr &, const std::map< std::string, ConstControlDevicePtr > &, const std::map< std::string, ConstSensorDevicePtr > &)
Definition: CollisionAvoidanceImpedanceController.cpp:619
armarx::control::njoint_controller::task_space::NJointTaskspaceCollisionAvoidanceImpedanceController::collLimbPublish
void collLimbPublish(core::CollisionAvoidanceBase::NodeSetData &arm, const DebugObserverInterfacePrx &debugObs)
Definition: CollisionAvoidanceImpedanceController.cpp:191
armarx::control::njoint_controller::task_space::NJointTaskspaceCollisionAvoidanceImpedanceController
Brief description of class NJointTaskspaceCollisionAvoidanceImpedanceController.
Definition: CollisionAvoidanceImpedanceController.h:54
armarx::armem::Time
armarx::core::time::DateTime Time
Definition: forward_declarations.h:13
armarx::control::njoint_controller::task_space::NJointTaskspaceCollisionAvoidanceImpedanceController::rtRun
void rtRun(const IceUtil::Time &sensorValuesTimestamp, const IceUtil::Time &timeSinceLastIteration) override
TODO make protected and use attorneys.
Definition: CollisionAvoidanceImpedanceController.cpp:126
armarx::aron::data::DictPtr
std::shared_ptr< Dict > DictPtr
Definition: Dict.h:41
armarx::control::NJointTaskspaceCollisionAvoidanceImpedanceControllerInterface
Definition: ControllerInterface.ice:61
IceUtil::Handle< class RobotUnit >
armarx::control::njoint_controller::task_space::NJointTaskspaceCollisionAvoidanceImpedanceController::rtPostDeactivateController
void rtPostDeactivateController() override
This function is called after the controller is deactivated.
Definition: CollisionAvoidanceImpedanceController.cpp:606
IceInternal::ProxyHandle<::IceProxy::armarx::DebugDrawerInterface >
ImpedanceController.h
CollisionAvoidance.h
armarx::control::njoint_controller::task_space::NJointTaskspaceCollisionAvoidanceImpedanceController::updateConfig
void updateConfig(const ::armarx::aron::data::dto::DictPtr &dto, const Ice::Current &iceCurrent) override
Definition: CollisionAvoidanceImpedanceController.cpp:171
armarx::control::njoint_controller::task_space::NJointTaskspaceCollisionAvoidanceImpedanceController::rtPreActivateController
void rtPreActivateController() override
NJointControllerBase interface.
Definition: CollisionAvoidanceImpedanceController.cpp:592
armarx::control::njoint_controller::task_space::NJointTaskspaceImpedanceController::robotUnit
RobotUnitPtr robotUnit
Definition: ImpedanceController.h:163
VirtualRobot::RobotPtr
std::shared_ptr< class Robot > RobotPtr
Definition: Bus.h:19