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 
26 namespace armarx
27 {
30  {
31  defineOptionalProperty<std::string>("HandUnitNameCSV", "", "");
32  }
33 
34 
35  std::string MultiHandUnit::getDefaultName() const
36  {
37  return "MultiHandUnit";
38  }
39 
40 
42  {
43  const auto units = getPropertyAsCSV<std::string>("HandUnitNameCSV");
44  if (units.empty())
45  {
46  ARMARX_ERROR << "PROPERTY HandUnitNameCSV IS EMPTY";
47  }
48  _handInfos.reserve(units.size());
49  for (const auto& name : units)
50  {
51  _handInfos.emplace_back();
52  _handInfos.back().proxyName = name;
53  usingProxy(name);
54  }
55  }
56 
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 
68  {
69  _hands.clear();
70  }
71 
73  {
74 
75  }
76 
78  {
81  }
82 
83  HandInfoSeq MultiHandUnit::getHandInfos(const Ice::Current&)
84  {
85  return _handInfos;
86  }
87 
88  void MultiHandUnit::setJointValues(const std::string& handName, const NameValueMap& jointValues, const Ice::Current&)
89  {
90  _hands.at(handName)->setJointAngles(jointValues);
91  }
92 
93  NameValueMap MultiHandUnit::getJointValues(const std::string& handName, const Ice::Current&)
94  {
95  return _hands.at(handName)->getCurrentJointValues();
96  }
97 }
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:93
armarx::MultiHandUnitPropertyDefinitions
Definition: MultiHandUnit.h:36
armarx::MultiHandUnitPropertyDefinitions::MultiHandUnitPropertyDefinitions
MultiHandUnitPropertyDefinitions(std::string prefix)
Definition: MultiHandUnit.cpp:28
armarx::MultiHandUnit::onDisconnectComponent
virtual void onDisconnectComponent() override
Definition: MultiHandUnit.cpp:67
armarx::MultiHandUnit::getDefaultName
virtual std::string getDefaultName() const override
Definition: MultiHandUnit.cpp:35
armarx::MultiHandUnit::onInitComponent
virtual void onInitComponent() override
Definition: MultiHandUnit.cpp:41
ARMARX_ERROR
#define ARMARX_ERROR
Definition: Logging.h:189
armarx::MultiHandUnit::onExitComponent
virtual void onExitComponent() override
Definition: MultiHandUnit.cpp:72
armarx::MultiHandUnit::createPropertyDefinitions
virtual armarx::PropertyDefinitionsPtr createPropertyDefinitions() override
Definition: MultiHandUnit.cpp:77
armarx::MultiHandUnit::setJointValues
void setJointValues(const std::string &handName, const NameValueMap &jointValues, const Ice::Current &=Ice::emptyCurrent) override
Definition: MultiHandUnit.cpp:88
armarx::control::njoint_controller::platform::platform_follower_controller::NameValueMap
std::map< std::string, float > NameValueMap
Definition: PlatformFollowerController.h:91
armarx::Component::getConfigIdentifier
std::string getConfigIdentifier()
Retrieve config identifier for this component as set in constructor.
Definition: Component.cpp:74
MultiHandUnit.h
armarx::ComponentPropertyDefinitions
Default component property definition container.
Definition: Component.h:70
armarx::MultiHandUnit::getHandInfos
HandInfoSeq getHandInfos(const Ice::Current &=Ice::emptyCurrent) override
Definition: MultiHandUnit.cpp:83
IceUtil::Handle< class PropertyDefinitionContainer >
armarx::PropertyDefinitionsPtr
IceUtil::Handle< class PropertyDefinitionContainer > PropertyDefinitionsPtr
PropertyDefinitions smart pointer type.
Definition: forward_declarations.h:34
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:393
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:151
armarx
This file offers overloads of toIce() and fromIce() functions for STL container types.
Definition: ArmarXTimeserver.cpp:28