OpenPoseSimulation.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 VisionX::ArmarXObjects::OpenPoseEstimation
17  * @author Stefan Reither ( stef dot reither at web dot de )
18  * @date 2018
19  * @copyright http://www.gnu.org/licenses/gpl-2.0.txt
20  * GNU General Public License
21  */
22 #pragma once
23 
24 #include <SimoxUtility/threads/CountingSemaphore.h>
25 #include <VirtualRobot/Robot.h>
26 
29 
32 
33 #include <VisionX/interface/components/OpenPoseEstimationInterface.h>
34 
35 namespace armarx
36 {
37 
38  /**
39  * @class OpenPoseEstimationPropertyDefinitions
40  * @brief
41  */
43  {
44  public:
46  };
47 
48  /**
49  * @defgroup Component-OpenPoseEstimation OpenPoseEstimation
50  * @ingroup VisionX-Components
51  * A description of the component OpenPoseEstimation.
52  *
53  * @class OpenPoseEstimation
54  * @ingroup Component-OpenPoseEstimation
55  * @brief Brief description of class OpenPoseEstimation.
56  *
57  * Detailed description of class OpenPoseEstimation.
58  */
60  public armarx::Component,
61  public OpenPoseEstimationInterface,
63  {
64  public:
65  /**
66  * @see armarx::ManagedIceObject::getDefaultName()
67  */
68  std::string
69  getDefaultName() const override
70  {
71  return "OpenPoseSimulation";
72  }
73 
74  void start(const Ice::Current& = Ice::emptyCurrent) override;
75  void stop(const Ice::Current& = Ice::emptyCurrent) override;
76  void start3DPoseEstimation(const Ice::Current& = Ice::emptyCurrent) override;
77  void stop3DPoseEstimation(const Ice::Current& = Ice::emptyCurrent) override;
78 
79  /**
80  * @see PropertyUser::createPropertyDefinitions()
81  */
83 
84  protected:
85  /**
86  * @see armarx::ManagedIceObject::onInitComponent()
87  */
88  void onInitComponent() override;
89 
90  /**
91  * @see armarx::ManagedIceObject::onConnectComponent()
92  */
93  void onConnectComponent() override;
94 
95  /**
96  * @see armarx::ManagedIceObject::onDisconnectComponent()
97  */
98  void onDisconnectComponent() override;
99 
100  /**
101  * @see armarx::ManagedIceObject::onExitComponent()
102  */
103  void onExitComponent() override;
104 
105 
106  //
107  void reportImageAvailable(const ::std::string&,
108  const ::Ice::Current& = ::Ice::emptyCurrent) override{};
109 
110  protected:
111  //Texting interface
112  void onMessage(const Texting::TextMessage& text,
113  const Ice::Current& = Ice::emptyCurrent) override;
114 
115  private:
117  std::atomic<bool> running2D;
118  std::atomic<bool> running3D;
119  void run();
120 
121  // Topics
122  OpenPose2DListenerPrx listener2DPrx;
123  OpenPose3DListenerPrx listener3DPrx;
124 
125  // Robot
126  RobotStateComponentInterfacePrx robotStateInterface;
127  VirtualRobot::RobotPtr localRobot;
128 
129  std::string layerName = "OpenPoseSimulation";
130  };
131 } // namespace armarx
ArVizComponentPlugin.h
armarx::PropertyDefinitionContainer::prefix
std::string prefix
Prefix of the properties such as namespace, domain, component name, etc.
Definition: PropertyDefinitionContainer.h:345
armarx::OpenPoseSimulation::start3DPoseEstimation
void start3DPoseEstimation(const Ice::Current &=Ice::emptyCurrent) override
Definition: OpenPoseSimulation.cpp:134
RunningTask.h
armarx::OpenPoseSimulation::reportImageAvailable
void reportImageAvailable(const ::std::string &, const ::Ice::Current &=::Ice::emptyCurrent) override
Definition: OpenPoseSimulation.h:107
armarx::OpenPoseSimulation::onConnectComponent
void onConnectComponent() override
Definition: OpenPoseSimulation.cpp:62
armarx::ArVizComponentPluginUser
Provides a ready-to-use ArViz client arviz as member variable.
Definition: ArVizComponentPlugin.h:35
armarx::OpenPoseSimulation::createPropertyDefinitions
armarx::PropertyDefinitionsPtr createPropertyDefinitions() override
Definition: OpenPoseSimulation.cpp:50
armarx::OpenPoseSimulationPropertyDefinitions::OpenPoseSimulationPropertyDefinitions
OpenPoseSimulationPropertyDefinitions(std::string prefix)
Definition: OpenPoseSimulation.cpp:222
armarx::OpenPoseSimulation::getDefaultName
std::string getDefaultName() const override
Definition: OpenPoseSimulation.h:69
armarx::OpenPoseSimulation::onInitComponent
void onInitComponent() override
Definition: OpenPoseSimulation.cpp:57
armarx::OpenPoseSimulation
Definition: OpenPoseSimulation.h:59
Component.h
armarx::Component
Baseclass for all ArmarX ManagedIceObjects requiring properties.
Definition: Component.h:91
armarx::ComponentPropertyDefinitions
Default component property definition container.
Definition: Component.h:69
armarx::OpenPoseSimulation::onDisconnectComponent
void onDisconnectComponent() override
Definition: OpenPoseSimulation.cpp:90
IceUtil::Handle< class PropertyDefinitionContainer >
armarx::OpenPoseSimulation::stop
void stop(const Ice::Current &=Ice::emptyCurrent) override
Definition: OpenPoseSimulation.cpp:118
IceInternal::ProxyHandle<::IceProxy::armarx::RobotStateComponentInterface >
armarx::OpenPoseSimulationPropertyDefinitions
Definition: OpenPoseSimulation.h:42
armarx::OpenPoseSimulation::stop3DPoseEstimation
void stop3DPoseEstimation(const Ice::Current &=Ice::emptyCurrent) override
Definition: OpenPoseSimulation.cpp:150
armarx::OpenPoseSimulation::onExitComponent
void onExitComponent() override
Definition: OpenPoseSimulation.cpp:96
armarx
This file offers overloads of toIce() and fromIce() functions for STL container types.
Definition: ArmarXTimeserver.cpp:27
armarx::OpenPoseSimulation::start
void start(const Ice::Current &=Ice::emptyCurrent) override
Definition: OpenPoseSimulation.cpp:101
VirtualRobot::RobotPtr
std::shared_ptr< class Robot > RobotPtr
Definition: Bus.h:19
armarx::OpenPoseSimulation::onMessage
void onMessage(const Texting::TextMessage &text, const Ice::Current &=Ice::emptyCurrent) override
Definition: OpenPoseSimulation.cpp:166
RobotStateComponent.h