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/Robot.h>
26 
31 
33 #include <armarx/control/common/control_law/aron/CollisionAvoidanceControllerConfig.aron.generated.h>
36 #include <armarx/control/njoint_controller/task_space/ControllerInterface.h>
38 
39 #include <simox/control/environment/CollisionRobot.h>
40 #include <simox/control/geodesics/metric/inertia.h>
41 #include <simox/control/impl/simox/robot/Robot.h>
42 
44 {
46 
47  /**
48  * @defgroup Library-NJointTaskspaceController NJointTaskspaceCollisionAvoidanceMixedImpedanceVelocityController
49  * @ingroup Library-RobotUnit-NJointControllers
50  * A description of the library NJointTaskspaceCollisionAvoidanceMixedImpedanceVelocityController.
51  *
52  * @class NJointTaskspaceCollisionAvoidanceMixedImpedanceVelocityController
53  * @ingroup Library-NJointTaskspaceController
54  * @brief Brief description of class NJointTaskspaceCollisionAvoidanceMixedImpedanceVelocityController.
55  *
56  * Detailed description of class NJointTaskspaceCollisionAvoidanceMixedImpedanceVelocityController.
57  */
62  {
63  public:
64  using ConfigPtrT = ConfigurableNJointControllerConfigPtr;
65  using CollisionCtrlCfg = common::control_law::arondto::
66  CollisionAvoidanceTSMixedImpedanceVelocityControllerConfig;
67 
69  const RobotUnitPtr& robotUnit,
70  const NJointControllerConfigPtr& config,
71  const VirtualRobot::RobotPtr& robot);
72 
73  std::string getClassName(const Ice::Current& = Ice::emptyCurrent) const override;
74 
75  void rtRun(const IceUtil::Time& sensorValuesTimestamp,
76  const IceUtil::Time& timeSinceLastIteration) override;
77 
78  /// NJointController interface for collision avoidance
79  void
81  const Ice::Current& iceCurrent = Ice::emptyCurrent) override;
83  getCollisionAvoidanceConfig(const Ice::Current& iceCurrent = Ice::emptyCurrent) override;
84 
87  const std::map<std::string, ConstControlDevicePtr>&,
88  const std::map<std::string, ConstSensorDevicePtr>&);
89 
91 
93  const Ice::Current& iceCurrent) override;
94  ::armarx::aron::data::dto::DictPtr getConfig(const Ice::Current& iceCurrent) override;
95 
96  protected:
97  void limbRT(ArmPtr& arm, const double deltaT);
98  void onPublish(const SensorAndControl& sc,
99  const DebugDrawerInterfacePrx& drawer,
100  const DebugObserverInterfacePrx&) override;
101 
103  const DebugObserverInterfacePrx& debugObs);
104 
105  protected:
106  /// NJointControllerBase interface
107  void rtPreActivateController() override;
108  void rtPostDeactivateController() override;
109 
110  private:
111  core::CollisionAvoidanceBasePtr coll = nullptr;
112  std::atomic_bool collReady{false};
113 
114  CollisionCtrlCfg userCfgWithColl;
115  };
116 } // namespace armarx::control::njoint_controller::task_space
armarx::control::NJointTaskspaceCollisionAvoidanceMixedImpedanceVelocityControllerInterface
Definition: ControllerInterface.ice:105
ArVizComponentPlugin.h
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:626
armarx::StringVariantBaseMap
std::map< std::string, VariantBasePtr > StringVariantBaseMap
Definition: ManagedIceObject.h:111
RobotUnit.h
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:154
armarx::control::njoint_controller::task_space::NJointTaskspaceCollisionAvoidanceMixedImpedanceVelocityController::GenerateConfigFromVariants
static ConfigPtrT GenerateConfigFromVariants(const StringVariantBaseMap &values)
Definition: CollisionAvoidanceMixedImpedanceVelocityController.cpp:660
armarx::control::njoint_controller::task_space
Definition: AdmittanceController.cpp:37
ProsthesisInterface.values
values
Definition: ProsthesisInterface.py:190
armarx::control::njoint_controller::task_space::NJointTaskspaceCollisionAvoidanceMixedImpedanceVelocityController
Brief description of class NJointTaskspaceCollisionAvoidanceMixedImpedanceVelocityController.
Definition: CollisionAvoidanceMixedImpedanceVelocityController.h:58
armarx::NJointControllerBase::ConfigPtrT
NJointControllerConfigPtr ConfigPtrT
Definition: NJointControllerBase.h:586
armarx::control::njoint_controller::task_space::NJointTaskspaceCollisionAvoidanceMixedImpedanceVelocityController::onPublish
void onPublish(const SensorAndControl &sc, const DebugDrawerInterfacePrx &drawer, const DebugObserverInterfacePrx &) override
Definition: CollisionAvoidanceMixedImpedanceVelocityController.cpp:583
device.h
MixedImpedanceVelocityController.h
armarx::control::njoint_controller::core::CollisionAvoidanceBasePtr
std::shared_ptr< CollisionAvoidanceBase > CollisionAvoidanceBasePtr
Definition: CollisionAvoidanceCore.h:144
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:129
IceInternal::Handle
Definition: forward_declarations.h:8
armarx::detail::ControlThreadOutputBufferEntry
Definition: ControlThreadOutputBuffer.h:177
armarx::control::njoint_controller::task_space::NJointTaskspaceCollisionAvoidanceMixedImpedanceVelocityController::limbRT
void limbRT(ArmPtr &arm, const double deltaT)
Definition: CollisionAvoidanceMixedImpedanceVelocityController.cpp:70
armarx::ArVizComponentPluginUser
Provides a ready-to-use ArViz client arviz as member variable.
Definition: ArVizComponentPlugin.h:36
armarx::control::njoint_controller::task_space::NJointTaskspaceMixedImpedanceVelocityController
Brief description of class NJointTaskspaceMixedImpedanceVelocityController.
Definition: MixedImpedanceVelocityController.h:51
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::core::CollisionAvoidanceBase::CollArmPtr
std::shared_ptr< CollisionAvoidanceArmData > CollArmPtr
Definition: CollisionAvoidanceCore.h:103
ControlTarget1DoFActuator.h
armarx::control::njoint_controller::task_space::NJointTaskspaceCollisionAvoidanceMixedImpedanceVelocityController::rtPostDeactivateController
void rtPostDeactivateController() override
This function is called after the controller is deactivated.
Definition: CollisionAvoidanceMixedImpedanceVelocityController.cpp:613
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:185
armarx::control::njoint_controller::task_space::NJointTaskspaceCollisionAvoidanceMixedImpedanceVelocityController::getClassName
std::string getClassName(const Ice::Current &=Ice::emptyCurrent) const override
Definition: CollisionAvoidanceMixedImpedanceVelocityController.cpp:63
NJointController.h
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:599
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:174
armarx::control::njoint_controller::task_space::NJointTaskspaceCollisionAvoidanceMixedImpedanceVelocityController::NJointTaskspaceCollisionAvoidanceMixedImpedanceVelocityController
NJointTaskspaceCollisionAvoidanceMixedImpedanceVelocityController(const RobotUnitPtr &robotUnit, const NJointControllerConfigPtr &config, const VirtualRobot::RobotPtr &robot)
Definition: CollisionAvoidanceMixedImpedanceVelocityController.cpp:47
armarx::control::njoint_controller::task_space::NJointTaskspaceCollisionAvoidanceMixedImpedanceVelocityController::collLimbPublish
void collLimbPublish(core::CollisionAvoidanceBase::CollArmPtr &arm, const DebugObserverInterfacePrx &debugObs)
Definition: CollisionAvoidanceMixedImpedanceVelocityController.cpp:198
armarx::control::njoint_controller::task_space::NJointTaskspaceCollisionAvoidanceMixedImpedanceVelocityController::CollisionCtrlCfg
common::control_law::arondto::CollisionAvoidanceTSMixedImpedanceVelocityControllerConfig CollisionCtrlCfg
Definition: CollisionAvoidanceMixedImpedanceVelocityController.h:66
armarx::control::njoint_controller::task_space::NJointTaskspaceMixedImpedanceVelocityController::ArmPtr
std::unique_ptr< ArmData > ArmPtr
Definition: MixedImpedanceVelocityController.h:101
armarx::control::njoint_controller::task_space::NJointTaskspaceMixedImpedanceVelocityController::robotUnit
RobotUnitPtr robotUnit
Definition: MixedImpedanceVelocityController.h:170
VirtualRobot::RobotPtr
std::shared_ptr< class Robot > RobotPtr
Definition: Bus.h:18