VelocityController.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 2024
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
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-NJointTaskspaceVelocityController NJointTaskspaceVelocityController
40 * @ingroup Library-RobotUnit-NJointControllers
41 * A description of the library NJointTaskspaceVelocityController.
42 *
43 * @class NJointTaskspaceVelocityController
44 * @ingroup Library-NJointTaskspaceVelocityController
45 * @brief Brief description of class NJointTaskspaceVelocityController.
46 *
47 * Detailed description of class NJointTaskspaceVelocityController.
48 */
50 virtual public NJointController,
52 {
53 public:
54 using ConfigPtrT = ConfigurableNJointControllerConfigPtr;
55 using Config = law::TaskspaceVelocityController::Config;
56 using ConfigDict = law::TaskspaceVelocityController::ConfigDict;
57
59 using PoseFrameMode = armarx::control::common::arondto::PoseFrameMode;
60
99
100 using ArmPtr = std::unique_ptr<ArmData>;
101
103 const NJointControllerConfigPtr& config,
105
106 std::string getClassName(const Ice::Current& = Ice::emptyCurrent) const override;
107
108 void rtRun(const IceUtil::Time& sensorValuesTimestamp,
109 const IceUtil::Time& timeSinceLastIteration) override;
110
111 /// NJointController interface
112 void updateConfig(const ::armarx::aron::data::dto::DictPtr& dto,
113 const Ice::Current& iceCurrent = Ice::emptyCurrent) override;
114 bool updateTargetPose(const TargetPoseMap& targetPoseMap,
115 const TargetNullspaceMap& targetNullspaceMap,
116 const Ice::Current& = Ice::emptyCurrent) override;
118 getConfig(const Ice::Current& iceCurrent = Ice::emptyCurrent) override;
119
120 Ice::FloatSeq getTCPVel(const std::string& rns,
121 const Ice::Current& iceCurrent = Ice::emptyCurrent) override;
122
123 /// ft sensor
124 void calibrateFTSensor(const Ice::Current&) override;
125 void
126 enableSafeGuardForceTorque(const std::string& nodeSetName,
127 const bool forceGuard,
128 const bool torqueGuard,
129 const Ice::Current& iceCurrent = Ice::emptyCurrent) override;
130 bool isSafeForceTorque(const std::string& nodeSetName,
131 const Ice::Current& iceCurrent = Ice::emptyCurrent) override;
132
133 public:
136 const std::map<std::string, ConstControlDevicePtr>&,
137 const std::map<std::string, ConstSensorDevicePtr>&);
138
140
141 protected:
142 virtual void additionalTask();
143 std::tuple<bool, bool> additionalTaskUpdateStatus();
145 void validateConfigData(Config& config, ArmPtr& arm);
146 void onPublish(const SensorAndControl&,
148 const DebugObserverInterfacePrx&) override;
149
150 void limbInit(const std::string nodeSetName,
151 ArmPtr& arm,
152 Config& cfg,
153 VirtualRobot::RobotPtr& nonRtRobotPtr);
154 void limbNonRT(ArmPtr& arm);
155 void limbRT(ArmPtr& arm, const double deltaT);
156 void limbRTUpdateStatus(ArmPtr& arm, const double deltaT);
157 void limbRTSetTarget(ArmPtr& arm, const Eigen::VectorXf& targetVelocity);
158 void limbPublish(ArmPtr& arm, const DebugObserverInterfacePrx& debugObs);
159 void limbReInit(ArmPtr& arm);
161
162 protected:
163 std::map<std::string, ArmPtr> limb;
168 std::map<std::string, VirtualRobot::RobotNodeSetPtr> controllableNodeSets;
169
170 protected:
171 /// NJointControllerBase interface
172 void onInitNJointController() override;
173 void rtPreActivateController() override;
174 void rtPostDeactivateController() override;
175 };
176} // namespace armarx::control::njoint_controller::task_space
A simple triple buffer for lockfree comunication between a single writer and a single reader.
std::string getClassName(const Ice::Current &=Ice::emptyCurrent) const override
std::map< std::string, VirtualRobot::RobotNodeSetPtr > controllableNodeSets
void onPublish(const SensorAndControl &, const DebugDrawerInterfacePrx &, const DebugObserverInterfacePrx &) override
static WidgetDescription::WidgetPtr GenerateConfigDescription(const VirtualRobot::RobotPtr &, const std::map< std::string, ConstControlDevicePtr > &, const std::map< std::string, ConstSensorDevicePtr > &)
--------------------------------— GUI Widget ------------------------------------------—
::armarx::aron::data::dto::DictPtr getConfig(const Ice::Current &iceCurrent=Ice::emptyCurrent) override
Ice::FloatSeq getTCPVel(const std::string &rns, const Ice::Current &iceCurrent=Ice::emptyCurrent) override
bool isSafeForceTorque(const std::string &nodeSetName, const Ice::Current &iceCurrent=Ice::emptyCurrent) override
-----------------------------— Other interaces ----------------------------------------—
void limbRTSetTarget(ArmPtr &arm, const Eigen::VectorXf &targetVelocity)
void enableSafeGuardForceTorque(const std::string &nodeSetName, const bool forceGuard, const bool torqueGuard, const Ice::Current &iceCurrent=Ice::emptyCurrent) override
static ConfigPtrT GenerateConfigFromVariants(const StringVariantBaseMap &values)
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 limbInit(const std::string nodeSetName, ArmPtr &arm, Config &cfg, VirtualRobot::RobotPtr &nonRtRobotPtr)
void updateConfig(const ::armarx::aron::data::dto::DictPtr &dto, const Ice::Current &iceCurrent=Ice::emptyCurrent) override
NJointController interface.
bool updateTargetPose(const TargetPoseMap &targetPoseMap, const TargetNullspaceMap &targetNullspaceMap, const Ice::Current &=Ice::emptyCurrent) override
NJointTaskspaceVelocityController(const RobotUnitPtr &robotUnit, const NJointControllerConfigPtr &config, const VirtualRobot::RobotPtr &)
void limbPublish(ArmPtr &arm, const DebugObserverInterfacePrx &debugObs)
void rtPreActivateController() override
This function is called before the controller is activated.
void limbRTUpdateStatus(ArmPtr &arm, const double deltaT)
-----------------------------— Real time cotnrol --------------------------------------—
std::shared_ptr< class Robot > RobotPtr
Definition Bus.h:19
::IceInternal::Handle<::armarx::WidgetDescription::Widget > WidgetPtr
::IceInternal::Handle< Dict > DictPtr
std::shared_ptr< HandControlBase > HandControlPtr
dictionary< string, Ice::FloatSeq > TargetNullspaceMap
dictionary< string, FloatSeqSeq > TargetPoseMap
::IceInternal::ProxyHandle<::IceProxy::armarx::DebugObserverInterface > DebugObserverInterfacePrx
std::map< std::string, VariantBasePtr > StringVariantBaseMap
SynchronousNJointController NJointController
IceUtil::Handle< class RobotUnit > RobotUnitPtr
Definition FTSensor.h:34
::IceInternal::ProxyHandle<::IceProxy::armarx::DebugDrawerInterface > DebugDrawerInterfacePrx
detail::ControlThreadOutputBufferEntry SensorAndControl