MultiHandUnit.cpp
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::MultiHandUnit
17  * @author Raphael Grimm ( raphael dot grimm at kit dot edu )
18  * @date 2019
19  * @copyright http://www.gnu.org/licenses/gpl-2.0.txt
20  * GNU General Public License
21  */
22 
23 #include "MultiHandUnit.h"
24 
25 namespace armarx
26 {
29  {
30  defineOptionalProperty<std::string>("HandUnitNameCSV", "", "");
31  }
32 
33  std::string
35  {
36  return "MultiHandUnit";
37  }
38 
39  void
41  {
42  const auto units = getPropertyAsCSV<std::string>("HandUnitNameCSV");
43  if (units.empty())
44  {
45  ARMARX_ERROR << "PROPERTY HandUnitNameCSV IS EMPTY";
46  }
47  _handInfos.reserve(units.size());
48  for (const auto& name : units)
49  {
50  _handInfos.emplace_back();
51  _handInfos.back().proxyName = name;
52  usingProxy(name);
53  }
54  }
55 
56  void
58  {
59  for (auto& info : _handInfos)
60  {
61  getProxy(info.proxy, info.proxyName);
62  info.handName = info.proxy->getHandName();
63  _hands[info.handName] = info.proxy;
64  }
65  }
66 
67  void
69  {
70  _hands.clear();
71  }
72 
73  void
75  {
76  }
77 
80  {
83  }
84 
85  HandInfoSeq
86  MultiHandUnit::getHandInfos(const Ice::Current&)
87  {
88  return _handInfos;
89  }
90 
91  void
92  MultiHandUnit::setJointValues(const std::string& handName,
93  const NameValueMap& jointValues,
94  const Ice::Current&)
95  {
96  _hands.at(handName)->setJointAngles(jointValues);
97  }
98 
100  MultiHandUnit::getJointValues(const std::string& handName, const Ice::Current&)
101  {
102  return _hands.at(handName)->getCurrentJointValues();
103  }
104 } // namespace armarx
armarx::MultiHandUnit::onConnectComponent
virtual void onConnectComponent() override
Definition: MultiHandUnit.cpp:57
armarx::MultiHandUnit::getJointValues
NameValueMap getJointValues(const std::string &handName, const Ice::Current &=Ice::emptyCurrent) override
Definition: MultiHandUnit.cpp:100
armarx::MultiHandUnitPropertyDefinitions
Definition: MultiHandUnit.h:35
armarx::MultiHandUnitPropertyDefinitions::MultiHandUnitPropertyDefinitions
MultiHandUnitPropertyDefinitions(std::string prefix)
Definition: MultiHandUnit.cpp:27
armarx::MultiHandUnit::onDisconnectComponent
virtual void onDisconnectComponent() override
Definition: MultiHandUnit.cpp:68
armarx::MultiHandUnit::getDefaultName
virtual std::string getDefaultName() const override
Definition: MultiHandUnit.cpp:34
armarx::MultiHandUnit::onInitComponent
virtual void onInitComponent() override
Definition: MultiHandUnit.cpp:40
ARMARX_ERROR
#define ARMARX_ERROR
Definition: Logging.h:196
armarx::MultiHandUnit::onExitComponent
virtual void onExitComponent() override
Definition: MultiHandUnit.cpp:74
armarx::MultiHandUnit::createPropertyDefinitions
virtual armarx::PropertyDefinitionsPtr createPropertyDefinitions() override
Definition: MultiHandUnit.cpp:79
armarx::MultiHandUnit::setJointValues
void setJointValues(const std::string &handName, const NameValueMap &jointValues, const Ice::Current &=Ice::emptyCurrent) override
Definition: MultiHandUnit.cpp:92
armarx::control::njoint_controller::platform::platform_follower_controller::NameValueMap
std::map< std::string, float > NameValueMap
Definition: PlatformFollowerController.h:88
armarx::Component::getConfigIdentifier
std::string getConfigIdentifier()
Retrieve config identifier for this component as set in constructor.
Definition: Component.cpp:79
MultiHandUnit.h
armarx::ComponentPropertyDefinitions
Default component property definition container.
Definition: Component.h:69
armarx::MultiHandUnit::getHandInfos
HandInfoSeq getHandInfos(const Ice::Current &=Ice::emptyCurrent) override
Definition: MultiHandUnit.cpp:86
IceUtil::Handle< class PropertyDefinitionContainer >
armarx::PropertyDefinitionsPtr
IceUtil::Handle< class PropertyDefinitionContainer > PropertyDefinitionsPtr
PropertyDefinitions smart pointer type.
Definition: forward_declarations.h:35
armarx::ManagedIceObject::getProxy
Ice::ObjectPrx getProxy(long timeoutMs=0, bool waitForScheduler=true) const
Returns the proxy of this object (optionally it waits for the proxy)
Definition: ManagedIceObject.cpp:407
armarx::ManagedIceObject::usingProxy
bool usingProxy(const std::string &name, const std::string &endpoints="")
Registers a proxy for retrieval after initialization and adds it to the dependency list.
Definition: ManagedIceObject.cpp:154
armarx
This file offers overloads of toIce() and fromIce() functions for STL container types.
Definition: ArmarXTimeserver.cpp:27