HandUnitDynamicSimulation.h
Go to the documentation of this file.
1/*
2 * This file is part of ArmarX.
3 *
4 * Copyright (C) 2013-2016, 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 ArmarXSimulation::units
19 * @author Nikolaus Vahrenkamp (vahrenkamp at kit dot edu)
20 * @date 2014
21 * @copyright http://www.gnu.org/licenses/gpl-2.0.txt
22 * GNU General Public License
23 */
24
25#pragma once
26
27#include <cmath>
28#include <string>
29
30#include <IceUtil/Time.h>
31
34
37
38#include <ArmarXSimulation/interface/simulator/SimulatorInterface.h>
39
40#include <MemoryX/interface/components/WorkingMemoryInterface.h>
41
42namespace armarx
43{
44 /**
45 * @class HandUnitDynamicSimulationPropertyDefinitions
46 * @brief
47 * @ingroup SensorActorUnits
48 */
50 {
51 public:
54 {
56 "SimulatorProxyName", "Simulator", "Name of the simulator proxy to use.");
58 "RobotStateComponentName",
59 "RobotStateComponent",
60 "Name of the RobotStateComponent that should be used");
62 "UseLegacyWorkingMemory",
63 false,
64 "Require the legacy MemoryX working memory to be available before starting.");
65 defineRequiredProperty<std::string>("KinematicUnitName",
66 "Name of the kinematic unit that should be used");
67 }
68 };
69
70 /**
71 * @class HandUnitDynamicSimulation
72 * @brief This unit connects to the physics simulator topic (default: "Simulator") and implements a HandUnit.
73 *
74 * @ingroup SensorActorUnits
75 * @ingroup ArmarXSimulatorComponents
76 */
77 class HandUnitDynamicSimulation : virtual public HandUnit
78 //, virtual public HandUnitDynamicSimulationInterface
79 {
80 public:
81 // inherited from Component
82 std::string
83 getDefaultName() const override
84 {
85 return "HandUnitDynamicSimulation";
86 }
87
88 void onInitHandUnit() override;
89 void onStartHandUnit() override;
90 void onExitHandUnit() override;
91
92 /**
93 * Send command to the hand to open all fingers.
94 */
95 //virtual void open(const Ice::Current&);
96
97
98 /**
99 * @see PropertyUser::createPropertyDefinitions()
100 */
102
103 void setObjectGrasped(const std::string& objectName, const Ice::Current&) override;
104 void setObjectReleased(const std::string& objectName, const Ice::Current&) override;
105
106 NameValueMap getCurrentJointValues(const Ice::Current& c = Ice::emptyCurrent) override;
107
108 protected:
109 std::string simulatorPrxName;
110
111 SimulatorInterfacePrx simulatorPrx;
112
113 KinematicUnitInterfacePrx kinematicUnitPrx;
114
115 memoryx::WorkingMemoryInterfacePrx workingMemoryPrx;
116
119
120 std::string objectPoseStorageName = "ObjectMemory";
121
122 armarx::NameValueMap handUnitJointsToRobotJoints(const armarx::NameValueMap& joints);
123 std::string getRobotNameFromHandUnitName();
124 std::string getHandSideFromHandUnitName();
125
126 // HandUnitInterface interface
127 public:
128 void setShape(const std::string& shapeName, const Ice::Current&) override;
129 void setShapeWithObjectInstance(const std::string& shapeName,
130 const std::string& objectInstanceName,
131 const Ice::Current& c = Ice::emptyCurrent) override;
132 void setJointAngles(const NameValueMap& jointAngles, const Ice::Current&) override;
133 };
134} // namespace armarx
constexpr T c
This unit connects to the physics simulator topic (default: "Simulator") and implements a HandUnit.
armarx::NameValueMap handUnitJointsToRobotJoints(const armarx::NameValueMap &joints)
memoryx::WorkingMemoryInterfacePrx workingMemoryPrx
void setObjectReleased(const std::string &objectName, const Ice::Current &) override
void setShape(const std::string &shapeName, const Ice::Current &) override
void setObjectGrasped(const std::string &objectName, const Ice::Current &) override
NameValueMap getCurrentJointValues(const Ice::Current &c=Ice::emptyCurrent) override
PropertyDefinitionsPtr createPropertyDefinitions() override
Send command to the hand to open all fingers.
RobotStateComponentInterfacePrx robotStateComponentPrx
void setJointAngles(const NameValueMap &jointAngles, const Ice::Current &) override
void setShapeWithObjectInstance(const std::string &shapeName, const std::string &objectInstanceName, const Ice::Current &c=Ice::emptyCurrent) override
std::string getDefaultName() const override
Retrieve default name of component.
HandUnitPropertyDefinitions(std::string prefix)
Definition HandUnit.h:45
Base unit for high-level access to robot hands.
Definition HandUnit.h:71
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)
PropertyDefinition< PropertyType > & defineRequiredProperty(const std::string &name, const std::string &description="", PropertyDefinitionBase::PropertyConstness constness=PropertyDefinitionBase::eConstant)
This file offers overloads of toIce() and fromIce() functions for STL container types.
IceUtil::Handle< class PropertyDefinitionContainer > PropertyDefinitionsPtr
PropertyDefinitions smart pointer type.
::IceInternal::ProxyHandle<::IceProxy::armarx::RobotStateComponentInterface > RobotStateComponentInterfacePrx