SharedRobotServants.h
Go to the documentation of this file.
1 /*
2  * This file is part of ArmarX.
3  *
4  * Copyright (C) 2011-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
19  * @author
20  * @date
21  * @copyright http://www.gnu.org/licenses/gpl-2.0.txt
22  * GNU General Public License
23  */
24 #pragma once
25 
29 #include <RobotAPI/interface/core/RobotState.h>
30 
31 #include <VirtualRobot/VirtualRobot.h>
32 
33 #include <mutex>
34 
35 namespace armarx
36 {
37  // Zugriff muss mutex geschuetzt werden!
38 
39  /**
40  * @brief The base class for remote objects on the ice server
41  *
42  */
43 
45  virtual public SharedObjectInterface
46  {
47  public:
48  void ref(const Ice::Current& c = Ice::emptyCurrent) override;
49  void unref(const Ice::Current& c = Ice::emptyCurrent) override;
50  void destroy(const Ice::Current& c = Ice::emptyCurrent) override;
52  private:
53  unsigned int _referenceCount;
54  std::mutex _counterMutex;
55  };
56 
57  /**
58  * @brief The SharedRobotNodeServant class is a remote representation of a Simox VirtualRobot::Robot
59  * @ingroup Component-RobotStateComponent
60  * @details This class is used only internally by the the RobotStateComponent. Other classes such as the LinkedPose, RemoteRobot,
61  * TCPControlUnit and HeadIKUnit classes address this class by the SharedRobotNodeInterface and SharedRobotNodeInterfacePrx generated by
62  * Ice.
63  */
65  virtual public SharedRobotNodeInterface,
66  public SharedObjectBase
67  {
68  public:
69  SharedRobotNodeServant(VirtualRobot::RobotNodePtr node /*,const Ice::Current & current = Ice::emptyCurrent*/);
70  ~SharedRobotNodeServant() override;
71 
72  float getJointValue(const Ice::Current& current = Ice::emptyCurrent) const override;
73  std::string getName(const Ice::Current& current = Ice::emptyCurrent) const override;
74 
75  PoseBasePtr getLocalTransformation(const Ice::Current& current = Ice::emptyCurrent) const override;
76  FramedPoseBasePtr getGlobalPose(const Ice::Current& current = Ice::emptyCurrent) const override;
77  FramedPoseBasePtr getPoseInRootFrame(const Ice::Current& current = Ice::emptyCurrent) const override;
78 
79  JointType getType(const Ice::Current& current = Ice::emptyCurrent) const override;
80  Vector3BasePtr getJointTranslationDirection(const Ice::Current& current = Ice::emptyCurrent) const override;
81  Vector3BasePtr getJointRotationAxis(const Ice::Current& current = Ice::emptyCurrent) const override;
82 
83  bool hasChild(const std::string& name, bool recursive, const Ice::Current& current = Ice::emptyCurrent) const override;
84  std::string getParent(const Ice::Current& current = Ice::emptyCurrent) const override;
85  NameList getChildren(const Ice::Current& current = Ice::emptyCurrent) const override;
86  NameList getAllParents(const std::string& name, const Ice::Current& current = Ice::emptyCurrent) const override;
87 
88  float getJointValueOffest(const Ice::Current& current = Ice::emptyCurrent) const override;
89  float getJointLimitHigh(const Ice::Current& current = Ice::emptyCurrent) const override;
90  float getJointLimitLow(const Ice::Current& current = Ice::emptyCurrent) const override;
91 
92  Vector3BasePtr getCoM(const Ice::Current& current = Ice::emptyCurrent) const override;
93  Ice::FloatSeq getInertia(const Ice::Current& current = Ice::emptyCurrent) const override;
94  float getMass(const Ice::Current& current = Ice::emptyCurrent) const override;
95 
96 
97 
98  protected:
99  VirtualRobot::RobotNodePtr _node;
100  };
101 
102  /**
103  * @ingroup Component-RobotStateComponent
104  * @brief The SharedRobotNodeServant class is a remote represenation of a Simox VirtualRobot::Robot
105  *
106  * @details This class is used only internally by the the RobotStateComponent. The RemoteRobot class SharedRobotInterface and SharedRobotInterfacePrx
107  * classes generated by Ice.
108  */
109 
111  public virtual SharedRobotInterface,
112  public SharedObjectBase
113  {
114  public:
116  ~SharedRobotServant() override;
118  SharedRobotNodeInterfacePrx getRobotNode(const std::string& name, const Ice::Current& current = Ice::emptyCurrent) override;
119  SharedRobotNodeInterfacePrx getRootNode(const Ice::Current& current = Ice::emptyCurrent) override;
120  bool hasRobotNode(const std::string& name, const Ice::Current& current = Ice::emptyCurrent) override;
121 
122  NameList getRobotNodes(const Ice::Current& current = Ice::emptyCurrent) override;
123  RobotNodeSetInfoPtr getRobotNodeSet(const std::string& name, const Ice::Current& current = Ice::emptyCurrent) override;
124  NameList getRobotNodeSets(const Ice::Current& current = Ice::emptyCurrent) override;
125  bool hasRobotNodeSet(const std::string& name, const Ice::Current& current = Ice::emptyCurrent) override;
126 
127  std::string getName(const Ice::Current& current = Ice::emptyCurrent) override;
128  std::string getType(const Ice::Current& current = Ice::emptyCurrent) override;
129 
130  PoseBasePtr getGlobalPose(const Ice::Current& current = Ice::emptyCurrent) override;
131  NameValueMap getConfig(const Ice::Current& current = Ice::emptyCurrent) override;
132  NameValueMap getConfigAndPose(PoseBasePtr& globalPose, const Ice::Current& current = Ice::emptyCurrent) override;
133  void setGlobalPose(const PoseBasePtr& pose, const Ice::Current& current = Ice::emptyCurrent) override;
134 
135  float getScaling(const Ice::Current& = Ice::emptyCurrent) override;
136 
138 
139  void setTimestamp(const IceUtil::Time& updateTime);
140  TimestampBasePtr getTimestamp(const Ice::Current& = Ice::emptyCurrent) const override;
141  RobotStateComponentInterfacePrx getRobotStateComponent(const Ice::Current&) const override;
142  protected:
144  std::recursive_mutex m;
145  std::map<std::string, SharedRobotNodeInterfacePrx> _cachedNodes;
148  RobotStateListenerInterfacePrx robotStateListenerPrx;
149 
150  };
151 
153 }
154 
armarx::SharedRobotServant::_robot
VirtualRobot::RobotPtr _robot
Definition: SharedRobotServants.h:143
armarx::SharedRobotNodeServant::getJointTranslationDirection
Vector3BasePtr getJointTranslationDirection(const Ice::Current &current=Ice::emptyCurrent) const override
Definition: SharedRobotServants.cpp:182
armarx::SharedObjectBase::destroy
void destroy(const Ice::Current &c=Ice::emptyCurrent) override
Definition: SharedRobotServants.cpp:93
armarx::SharedRobotServant::getGlobalPose
PoseBasePtr getGlobalPose(const Ice::Current &current=Ice::emptyCurrent) override
Definition: SharedRobotServants.cpp:451
armarx::SharedRobotNodeServant::getGlobalPose
FramedPoseBasePtr getGlobalPose(const Ice::Current &current=Ice::emptyCurrent) const override
Definition: SharedRobotServants.cpp:147
armarx::SharedRobotNodeServant
The SharedRobotNodeServant class is a remote representation of a Simox VirtualRobot::Robot.
Definition: SharedRobotServants.h:64
armarx::SharedRobotNodeServant::getType
JointType getType(const Ice::Current &current=Ice::emptyCurrent) const override
Definition: SharedRobotServants.cpp:164
armarx::SharedRobotServant::getName
std::string getName(const Ice::Current &current=Ice::emptyCurrent) override
Definition: SharedRobotServants.cpp:435
armarx::SharedRobotServant::setRobotStateComponent
void setRobotStateComponent(RobotStateComponentInterfacePrx robotStateComponent)
Definition: SharedRobotServants.cpp:333
armarx::SharedRobotServant::_cachedNodes
std::map< std::string, SharedRobotNodeInterfacePrx > _cachedNodes
Definition: SharedRobotServants.h:145
armarx::SharedRobotServant::getTimestamp
TimestampBasePtr getTimestamp(const Ice::Current &=Ice::emptyCurrent) const override
Definition: SharedRobotServants.cpp:477
armarx::SharedRobotServant::getRootNode
SharedRobotNodeInterfacePrx getRootNode(const Ice::Current &current=Ice::emptyCurrent) override
Definition: SharedRobotServants.cpp:367
armarx::SharedRobotServant::~SharedRobotServant
~SharedRobotServant() override
Definition: SharedRobotServants.cpp:316
armarx::SharedRobotServant::getRobotStateComponent
RobotStateComponentInterfacePrx getRobotStateComponent(const Ice::Current &) const override
Definition: SharedRobotServants.cpp:482
armarx::SharedRobotServant
The SharedRobotNodeServant class is a remote represenation of a Simox VirtualRobot::Robot.
Definition: SharedRobotServants.h:110
c
constexpr T c
Definition: UnscentedKalmanFilterTest.cpp:43
armarx::SharedRobotNodeServant::getInertia
Ice::FloatSeq getInertia(const Ice::Current &current=Ice::emptyCurrent) const override
Definition: SharedRobotServants.cpp:281
armarx::SharedRobotServant::getRobotNodeSets
NameList getRobotNodeSets(const Ice::Current &current=Ice::emptyCurrent) override
Definition: SharedRobotServants.cpp:418
armarx::SharedRobotNodeServant::getJointValue
float getJointValue(const Ice::Current &current=Ice::emptyCurrent) const override
Definition: SharedRobotServants.cpp:129
armarx::SharedRobotServant::getConfig
NameValueMap getConfig(const Ice::Current &current=Ice::emptyCurrent) override
Definition: SharedRobotServants.cpp:457
armarx::SharedRobotNodeServant::getJointLimitLow
float getJointLimitLow(const Ice::Current &current=Ice::emptyCurrent) const override
Definition: SharedRobotServants.cpp:269
armarx::SharedRobotNodeServant::getMass
float getMass(const Ice::Current &current=Ice::emptyCurrent) const override
Definition: SharedRobotServants.cpp:295
IceInternal::Handle< SharedRobotServant >
armarx::SharedRobotNodeServant::getLocalTransformation
PoseBasePtr getLocalTransformation(const Ice::Current &current=Ice::emptyCurrent) const override
Definition: SharedRobotServants.cpp:141
armarx::SharedRobotNodeServant::getAllParents
NameList getAllParents(const std::string &name, const Ice::Current &current=Ice::emptyCurrent) const override
Definition: SharedRobotServants.cpp:245
armarx::SharedRobotServant::getRobotNodeSet
RobotNodeSetInfoPtr getRobotNodeSet(const std::string &name, const Ice::Current &current=Ice::emptyCurrent) override
Definition: SharedRobotServants.cpp:392
armarx::SharedRobotServant::m
std::recursive_mutex m
Definition: SharedRobotServants.h:144
FramedPose.h
armarx::SharedObjectBase::unref
void unref(const Ice::Current &c=Ice::emptyCurrent) override
Definition: SharedRobotServants.cpp:78
armarx::SharedRobotServant::getRobotNode
SharedRobotNodeInterfacePrx getRobotNode(const std::string &name, const Ice::Current &current=Ice::emptyCurrent) override
Definition: SharedRobotServants.cpp:338
armarx::SharedRobotNodeServant::~SharedRobotNodeServant
~SharedRobotNodeServant() override
Definition: SharedRobotServants.cpp:122
armarx::SharedRobotServant::SharedRobotServant
SharedRobotServant(VirtualRobot::RobotPtr robot, RobotStateComponentInterfacePrx robotStateComponent, RobotStateListenerInterfacePrx robotStateListenerPrx)
Definition: SharedRobotServants.cpp:306
armarx::SharedRobotServant::setGlobalPose
void setGlobalPose(const PoseBasePtr &pose, const Ice::Current &current=Ice::emptyCurrent) override
Definition: SharedRobotServants.cpp:487
armarx::SharedRobotNodeServant::getChildren
NameList getChildren(const Ice::Current &current=Ice::emptyCurrent) const override
Definition: SharedRobotServants.cpp:233
armarx::SharedRobotNodeServant::getParent
std::string getParent(const Ice::Current &current=Ice::emptyCurrent) const override
Definition: SharedRobotServants.cpp:220
armarx::SharedRobotServant::getRobotNodes
NameList getRobotNodes(const Ice::Current &current=Ice::emptyCurrent) override
Definition: SharedRobotServants.cpp:381
armarx::SharedRobotNodeServant::getName
std::string getName(const Ice::Current &current=Ice::emptyCurrent) const override
Definition: SharedRobotServants.cpp:135
armarx::SharedRobotServant::setTimestamp
void setTimestamp(const IceUtil::Time &updateTime)
Definition: SharedRobotServants.cpp:446
armarx::SharedObjectBase
The base class for remote objects on the ice server.
Definition: SharedRobotServants.h:44
armarx::armem::Time
armarx::core::time::DateTime Time
Definition: forward_declarations.h:13
armarx::SharedObjectBase::SharedObjectBase
SharedObjectBase()
Definition: SharedRobotServants.cpp:58
Component.h
armarx::SharedRobotServant::updateTimestamp
IceUtil::Time updateTimestamp
Definition: SharedRobotServants.h:146
armarx::SharedRobotNodeServant::hasChild
bool hasChild(const std::string &name, bool recursive, const Ice::Current &current=Ice::emptyCurrent) const override
Definition: SharedRobotServants.cpp:213
armarx::SharedRobotServant::robotStateComponent
RobotStateComponentInterfacePrx robotStateComponent
Definition: SharedRobotServants.h:147
armarx::SharedRobotNodeServant::getJointLimitHigh
float getJointLimitHigh(const Ice::Current &current=Ice::emptyCurrent) const override
Definition: SharedRobotServants.cpp:263
armarx::control::njoint_controller::platform::platform_follower_controller::NameValueMap
std::map< std::string, float > NameValueMap
Definition: PlatformFollowerController.h:91
armarx::SharedObjectBase::ref
void ref(const Ice::Current &c=Ice::emptyCurrent) override
Definition: SharedRobotServants.cpp:67
armarx::SharedRobotServant::getScaling
float getScaling(const Ice::Current &=Ice::emptyCurrent) override
Definition: SharedRobotServants.cpp:499
armarx::SharedRobotNodeServant::SharedRobotNodeServant
SharedRobotNodeServant(VirtualRobot::RobotNodePtr node)
Definition: SharedRobotServants.cpp:113
armarx::SharedRobotServant::getRobot
VirtualRobot::RobotPtr getRobot() const
Definition: SharedRobotServants.cpp:504
IceInternal::ProxyHandle<::IceProxy::armarx::RobotStateComponentInterface >
armarx::SharedRobotNodeServant::getJointRotationAxis
Vector3BasePtr getJointRotationAxis(const Ice::Current &current=Ice::emptyCurrent) const override
Definition: SharedRobotServants.cpp:197
armarx::SharedRobotNodeServant::getJointValueOffest
float getJointValueOffest(const Ice::Current &current=Ice::emptyCurrent) const override
Definition: SharedRobotServants.cpp:257
armarx::SharedRobotServant::getType
std::string getType(const Ice::Current &current=Ice::emptyCurrent) override
Definition: SharedRobotServants.cpp:441
armarx::SharedRobotServant::robotStateListenerPrx
RobotStateListenerInterfacePrx robotStateListenerPrx
Definition: SharedRobotServants.h:148
armarx::SharedRobotServant::getConfigAndPose
NameValueMap getConfigAndPose(PoseBasePtr &globalPose, const Ice::Current &current=Ice::emptyCurrent) override
Definition: SharedRobotServants.cpp:471
armarx::SharedRobotNodeServant::_node
VirtualRobot::RobotNodePtr _node
Definition: SharedRobotServants.h:99
armarx::SharedRobotServant::hasRobotNode
bool hasRobotNode(const std::string &name, const Ice::Current &current=Ice::emptyCurrent) override
Definition: SharedRobotServants.cpp:376
armarx::SharedRobotServant::hasRobotNodeSet
bool hasRobotNodeSet(const std::string &name, const Ice::Current &current=Ice::emptyCurrent) override
Definition: SharedRobotServants.cpp:430
armarx::SharedRobotNodeServant::getCoM
Vector3BasePtr getCoM(const Ice::Current &current=Ice::emptyCurrent) const override
Definition: SharedRobotServants.cpp:275
armarx::SharedRobotNodeServant::getPoseInRootFrame
FramedPoseBasePtr getPoseInRootFrame(const Ice::Current &current=Ice::emptyCurrent) const override
Definition: SharedRobotServants.cpp:155
armarx
This file offers overloads of toIce() and fromIce() functions for STL container types.
Definition: ArmarXTimeserver.cpp:28
VirtualRobot::RobotPtr
std::shared_ptr< class Robot > RobotPtr
Definition: Bus.h:18
ImportExportComponent.h