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