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 
45  {
46  public:
48  };
49 
50 
63  public armarx::Component,
64  public OpenPoseEstimationInterface,
66  {
67  public:
68 
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 
86 
87  protected:
91  void onInitComponent() override;
92 
96  void onConnectComponent() override;
97 
101  void onDisconnectComponent() override;
102 
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
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
armarx::OpenPoseSimulation::onMessage
void onMessage(const Texting::TextMessage &text, const Ice::Current &=Ice::emptyCurrent) override
Definition: OpenPoseSimulation.cpp:160
RobotStateComponent.h