TCPControllerSubUnit.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 RobotAPI::ArmarXObjects::TCPControllerSubUnit
17 * @author Stefan Reither ( stef dot reither at web dot de )
18 * @date 2017
19 * @copyright http://www.gnu.org/licenses/gpl-2.0.txt
20 * GNU General Public License
21 */
22
23#pragma once
24
25#include <mutex>
26
28
29#include <RobotAPI/interface/units/TCPControlUnit.h>
30
32#include "../util.h"
33#include "RobotUnitSubUnit.h"
34
35namespace armarx
36{
38
40 {
41 public:
44 {
46 "AvoidJointLimitsKp",
47 1.f,
48 "Proportional gain value of P-Controller for joint limit avoidance",
50 }
51 };
52
54
56 virtual public RobotUnitSubUnit,
57 virtual public TCPControlUnitInterface,
58 virtual public Component
59 {
60 public:
61 void setup(RobotUnit* rUnit, VirtualRobot::RobotPtr robot);
62
63 // TCPControlUnitInterface interface
64 void setCycleTime(Ice::Int milliseconds,
65 const Ice::Current& c = Ice::emptyCurrent) override;
66 void setTCPVelocity(const std::string& nodeSetName,
67 const std::string& tcpName,
68 const ::armarx::FramedDirectionBasePtr& translationVelocity,
69 const ::armarx::FramedDirectionBasePtr& orientationVelocityRPY,
70 const Ice::Current& c = Ice::emptyCurrent) override;
71 bool isRequested(const Ice::Current& = Ice::emptyCurrent) override;
72
73 // RobotUnitSubUnit interface
74 void update(const SensorAndControl& sc, const JointAndNJointControllers& c) override;
75
76 private:
77 mutable std::mutex dataMutex;
78 RobotUnit* robotUnit = nullptr;
79 VirtualRobot::RobotPtr coordinateTransformationRobot;
80 std::map<std::string, std::string> tcpControllerNameMap;
81
82 // ManagedIceObject interface
83 protected:
84 void
85 onInitComponent() override
86 {
87 }
88
89 void
91 {
92 }
93
94 std::string
95 getDefaultName() const override
96 {
97 return "TCPControlUnit";
98 }
99
101
102 // UnitResourceManagementInterface interface
103 public:
104 void
105 request(const Ice::Current&) override
106 {
107 }
108
109 void
110 release(const Ice::Current&) override
111 {
112 }
113
114 // UnitExecutionManagementInterface interface
115 public:
116 void
117 init(const Ice::Current&) override
118 {
119 }
120
121 void
122 start(const Ice::Current&) override
123 {
124 }
125
126 void
127 stop(const Ice::Current&) override
128 {
129 }
130
131 UnitExecutionState
132 getExecutionState(const Ice::Current&) override
133 {
134 return UnitExecutionState::eUndefinedUnitExecutionState;
135 }
136
137 // KinematicUnitListener interface
138 public:
139 void
140 reportControlModeChanged(const NameControlModeMap&,
141 Ice::Long,
142 bool,
143 const Ice::Current&) override
144 {
145 }
146
147 void
148 reportJointAngles(const NameValueMap&, Ice::Long, bool, const Ice::Current&) override
149 {
150 }
151
152 void
153 reportJointVelocities(const NameValueMap&, Ice::Long, bool, const Ice::Current&) override
154 {
155 }
156
157 void
158 reportJointTorques(const NameValueMap&, Ice::Long, bool, const Ice::Current&) override
159 {
160 }
161
162 void
163 reportJointAccelerations(const NameValueMap&, Ice::Long, bool, const Ice::Current&) override
164 {
165 }
166
167 void
168 reportJointCurrents(const NameValueMap&, Ice::Long, bool, const Ice::Current&) override
169 {
170 }
171
172 void
173 reportJointMotorTemperatures(const NameValueMap&,
174 Ice::Long,
175 bool,
176 const Ice::Current&) override
177 {
178 }
179
180 void
181 reportJointStatuses(const NameStatusMap&, Ice::Long, bool, const Ice::Current&) override
182 {
183 }
184
185 // PropertyUser interface
186 public:
187 void componentPropertiesUpdated(const std::set<std::string>& changedProperties) override;
188 };
189} // namespace armarx
#define TYPEDEF_PTRS_HANDLE(T)
constexpr T c
Default component property definition container.
Definition Component.h:70
ComponentPropertyDefinitions(std::string prefix, bool hasObjectNameParameter=true)
Definition Component.cpp:46
Component()
Protected default constructor. Used for virtual inheritance. Use createManagedIceObject() instead.
Definition Component.cpp:66
std::string prefix
Prefix of the properties such as namespace, domain, component name, etc.
PropertyDefinition< PropertyType > & defineOptionalProperty(const std::string &name, PropertyType defaultValue, const std::string &description="", PropertyDefinitionBase::PropertyConstness constness=PropertyDefinitionBase::eConstant)
The RobotUnit class manages a robot and its controllers.
Definition RobotUnit.h:192
void reportJointAccelerations(const NameValueMap &, Ice::Long, bool, const Ice::Current &) override
void onInitComponent() override
Pure virtual hook for the subclass.
UnitExecutionState getExecutionState(const Ice::Current &) override
void stop(const Ice::Current &) override
void reportJointStatuses(const NameStatusMap &, Ice::Long, bool, const Ice::Current &) override
void componentPropertiesUpdated(const std::set< std::string > &changedProperties) override
Implement this function if you would like to react to changes in the properties.
void release(const Ice::Current &) override
void init(const Ice::Current &) override
void update(const SensorAndControl &sc, const JointAndNJointControllers &c) override
void reportJointCurrents(const NameValueMap &, Ice::Long, bool, const Ice::Current &) override
void setCycleTime(Ice::Int milliseconds, const Ice::Current &c=Ice::emptyCurrent) override
void reportControlModeChanged(const NameControlModeMap &, Ice::Long, bool, const Ice::Current &) override
void setTCPVelocity(const std::string &nodeSetName, const std::string &tcpName, const ::armarx::FramedDirectionBasePtr &translationVelocity, const ::armarx::FramedDirectionBasePtr &orientationVelocityRPY, const Ice::Current &c=Ice::emptyCurrent) override
void reportJointMotorTemperatures(const NameValueMap &, Ice::Long, bool, const Ice::Current &) override
void onConnectComponent() override
Pure virtual hook for the subclass.
void start(const Ice::Current &) override
PropertyDefinitionsPtr createPropertyDefinitions() override
void reportJointAngles(const NameValueMap &, Ice::Long, bool, const Ice::Current &) override
void reportJointVelocities(const NameValueMap &, Ice::Long, bool, const Ice::Current &) override
void setup(RobotUnit *rUnit, VirtualRobot::RobotPtr robot)
bool isRequested(const Ice::Current &=Ice::emptyCurrent) override
void request(const Ice::Current &) override
std::string getDefaultName() const override
Retrieve default name of component.
void reportJointTorques(const NameValueMap &, Ice::Long, bool, const Ice::Current &) override
std::shared_ptr< class Robot > RobotPtr
Definition Bus.h:19
This file offers overloads of toIce() and fromIce() functions for STL container types.
IceUtil::Handle< class PropertyDefinitionContainer > PropertyDefinitionsPtr
PropertyDefinitions smart pointer type.
detail::ControlThreadOutputBufferEntry SensorAndControl
Structure used by the RobotUnit to swap lists of Joint and NJoint controllers.