NJointCartesianTorqueController.h
Go to the documentation of this file.
1/*
2 * This file is part of ArmarX.
3 *
4 * Copyright (C) 2011-2017, High Performance Humanoid Technologies (H2T), Karlsruhe Institute of Technology (KIT), all rights reserved.
5 *
6 * ArmarX is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 *
10 * ArmarX is distributed in the hope that it will be useful, but
11 * WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program. If not, see <http://www.gnu.org/licenses/>.
17 *
18 * @package ArmarX
19 * @author Mirko Waechter( mirko.waechter at kit dot edu)
20 * @date 2017
21 * @copyright http://www.gnu.org/licenses/gpl-2.0.txt
22 * GNU General Public License
23 */
24#pragma once
25
26#include <VirtualRobot/VirtualRobot.h>
27
28#include <RobotAPI/interface/units/RobotUnit/NJointCartesianTorqueController.h>
29
33
34namespace armarx
35{
36
38 //TYPEDEF_PTRS_HANDLE(NJointCartesianTorqueControllerConfig);
39
40 /*class NJointCartesianTorqueControllerConfig : virtual public NJointControllerConfig
41 {
42 public:
43 NJointCartesianTorqueControllerConfig(std::string const& nodeSetName, const std::string& tcpName, VirtualRobot::IKSolver::CartesianSelection mode):
44 nodeSetName(nodeSetName),
45 tcpName(tcpName),
46 mode(mode)
47 {}
48
49 const std::string nodeSetName;
50 const std::string tcpName;
51 const VirtualRobot::IKSolver::CartesianSelection mode;
52 };*/
53
55
57 {
58 public:
59 float forceX = 0;
60 float forceY = 0;
61 float forceZ = 0;
62 float torqueX = 0;
63 float torqueY = 0;
64 float torqueZ = 0;
65
66 //VirtualRobot::IKSolver::CartesianSelection mode = VirtualRobot::IKSolver::All;
67 };
68
69 /**
70 * @brief The NJointCartesianTorqueController class
71 * @ingroup Library-RobotUnit-NJointControllers
72 */
74 public NJointControllerWithTripleBuffer<NJointCartesianTorqueControllerControlData>,
75 public NJointCartesianTorqueControllerInterface
76 {
77 public:
78 using ConfigPtrT = NJointCartesianTorqueControllerConfigPtr;
80 const NJointControllerConfigPtr& config,
82
83 // NJointControllerInterface interface
84 std::string getClassName(const Ice::Current&) const override;
86 getFunctionDescriptions(const Ice::Current&) const override;
87 void callDescribedFunction(const std::string& name,
88 const StringVariantBaseMap& valueMap,
89 const Ice::Current&) override;
90
91 // NJointController interface
92 void rtRun(const IceUtil::Time& sensorValuesTimestamp,
93 const IceUtil::Time& timeSinceLastIteration) override;
96 const std::map<std::string, ConstControlDevicePtr>&,
97 const std::map<std::string, ConstSensorDevicePtr>&);
98
99 static NJointCartesianTorqueControllerConfigPtr
102 NJointCartesianTorqueControllerConfigPtr config,
103 const VirtualRobot::RobotPtr& r);
104
105 std::string getNodeSetName() const;
106 static ::armarx::WidgetDescription::HBoxLayoutPtr createSliders();
107 //WidgetDescription::HBoxLayoutPtr createJointSlidersLayout(float min, float max, float defaultValue) const;
108
109 protected:
110 void rtPreActivateController() override;
111 void rtPostDeactivateController() override;
112
113 private:
114 std::vector<ControlTarget1DoFActuatorTorque*> targets;
115 //std::vector<const SensorValue1DoFActuatorPosition*> sensors;
116 //std::vector<const SensorValue1DoFActuatorTorque*> torqueSensors;
117 //std::vector<const SensorValue1DoFGravityTorque*> gravityTorqueSensors;
118
119 std::string nodeSetName;
120
121 VirtualRobot::DifferentialIKPtr ik;
122 VirtualRobot::RobotNodePtr tcp;
123
124
125 // NJointCartesianTorqueControllerInterface interface
126 public:
127 void setControllerTarget(float forceX,
128 float forceY,
129 float forceZ,
130 float torqueX,
131 float torqueY,
132 float torqueZ,
133 const Ice::Current&) override;
134 };
135
136} // namespace armarx
#define TYPEDEF_PTRS_HANDLE(T)
The NJointCartesianTorqueController class.
NJointCartesianTorqueControllerConfigPtr ConfigPtrT
static WidgetDescription::WidgetPtr GenerateConfigDescription(const VirtualRobot::RobotPtr &, const std::map< std::string, ConstControlDevicePtr > &, const std::map< std::string, ConstSensorDevicePtr > &)
WidgetDescription::StringWidgetDictionary getFunctionDescriptions(const Ice::Current &) const override
NJointCartesianTorqueController(RobotUnit *prov, const NJointControllerConfigPtr &config, const VirtualRobot::RobotPtr &)
void setControllerTarget(float forceX, float forceY, float forceZ, float torqueX, float torqueY, float torqueZ, const Ice::Current &) override
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.
static NJointCartesianTorqueControllerConfigPtr GenerateConfigFromVariants(const StringVariantBaseMap &values)
::armarx::WidgetDescription::HBoxLayoutPtr createSliders()
std::string getClassName(const Ice::Current &) const override
void callDescribedFunction(const std::string &name, const StringVariantBaseMap &valueMap, const Ice::Current &) override
void rtPreActivateController() override
This function is called before the controller is activated.
NJointControllerWithTripleBuffer(const NJointCartesianTorqueControllerControlData &initialCommands=NJointCartesianTorqueControllerControlData())
The RobotUnit class manages a robot and its controllers.
Definition RobotUnit.h:192
std::shared_ptr< class Robot > RobotPtr
Definition Bus.h:19
::IceInternal::Handle<::armarx::WidgetDescription::Widget > WidgetPtr
::std::map<::std::string, ::armarx::WidgetDescription::WidgetPtr > StringWidgetDictionary
This file offers overloads of toIce() and fromIce() functions for STL container types.
std::map< std::string, VariantBasePtr > StringVariantBaseMap