SimpleEpisodicMemoryOpenPoseEstimationConnector.cpp
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::SimpleEpisodicMemoryImageConnector
17  * @author Fabian Peller ( fabian dot peller-konrad at kit dot edu )
18  * @date 2020
19  * @copyright http://www.gnu.org/licenses/gpl-2.0.txt
20  * GNU General Public License
21  */
22 
24 
25 
26 // STD/STL
27 
28 // Simox
29 #include <VirtualRobot/Nodes/RobotNode.h>
30 #include <VirtualRobot/XML/RobotIO.h>
31 
32 // IVT
33 
34 // ArmarX
36 
37 using namespace visionx;
38 
41 {
43 
44  def->topic<armarx::OpenPose3DListener>("OpenPoseEstimation3D");
45  return def;
46 }
47 
49 {
50  usingProxy("SimpleEpisodicMemory");
51 }
52 
54 {
56 }
57 
58 void SimpleEpisodicMemoryOpenPoseEstimationConnector::report3DKeypoints(const armarx::Keypoint3DMapList& kpml, long timestamp, const Ice::Current&)
59 {
60  if (kpml.empty())
61  {
62  return;
63  }
64  IceUtil::Time time = IceUtil::Time::microSeconds(timestamp);
65 
66  for (unsigned int i = 0; i < kpml.size(); ++i)
67  {
68  memoryx::Body25HumanPoseEvent human_pose_event;
69  human_pose_event.receivedInMs = time.toMilliSecondsDouble();
70 
71  for (const auto& [key, value] : kpml[i])
72  {
73  memoryx::HumanKeypoint kp;
74  if (key == "Background")
75  {
76  continue;
77  }
78 
79  kp.label = value.label;
80  kp.x = value.x;
81  kp.y = value.y;
82  kp.z = value.z;
83  kp.globalX = value.globalX;
84  kp.globalY = value.globalY;
85  kp.globalZ = value.globalZ;
86  kp.confidence = value.confidence;
87  human_pose_event.keypoints[key] = kp;
88  }
89  m_simple_episodic_memory->registerHumanPoseEvent(human_pose_event);
90  }
91 
92 }
93 
94 
95 
visionx::SimpleEpisodicMemoryOpenPoseEstimationConnector::onInitComponent
void onInitComponent()
Pure virtual hook for the subclass.
Definition: SimpleEpisodicMemoryOpenPoseEstimationConnector.cpp:48
visionx
ArmarX headers.
Definition: OpenPoseStressTest.h:38
SimpleEpisodicMemoryOpenPoseEstimationConnector.h
cxxopts::value
std::shared_ptr< Value > value()
Definition: cxxopts.hpp:926
FramedPose.h
visionx::SimpleEpisodicMemoryOpenPoseEstimationConnector::createPropertyDefinitions
armarx::PropertyDefinitionsPtr createPropertyDefinitions() override
Definition: SimpleEpisodicMemoryOpenPoseEstimationConnector.cpp:40
memoryx::SimpleEpisodicMemoryConnector::m_simple_episodic_memory
memoryx::SimpleEpisodicMemoryInterface::ProxyType m_simple_episodic_memory
Definition: SimpleEpisodicMemoryConnector.h:41
visionx::SimpleEpisodicMemoryOpenPoseEstimationConnector::report3DKeypoints
void report3DKeypoints(const armarx::Keypoint3DMapList &, long, const Ice::Current &)
Definition: SimpleEpisodicMemoryOpenPoseEstimationConnector.cpp:58
armarx::armem::Time
armarx::core::time::DateTime Time
Definition: forward_declarations.h:13
armarx::Component::getConfigIdentifier
std::string getConfigIdentifier()
Retrieve config identifier for this component as set in constructor.
Definition: Component.cpp:74
armarx::ComponentPropertyDefinitions
Default component property definition container.
Definition: Component.h:70
IceUtil::Handle< class PropertyDefinitionContainer >
visionx::SimpleEpisodicMemoryOpenPoseEstimationConnector::onConnectComponent
void onConnectComponent()
Pure virtual hook for the subclass.
Definition: SimpleEpisodicMemoryOpenPoseEstimationConnector.cpp:53
memoryx::SimpleEpisodicMemoryConnector::m_simple_episodic_memory_proxy_name
std::string m_simple_episodic_memory_proxy_name
Definition: SimpleEpisodicMemoryConnector.h:40
armarx::ManagedIceObject::getProxy
Ice::ObjectPrx getProxy(long timeoutMs=0, bool waitForScheduler=true) const
Returns the proxy of this object (optionally it waits for the proxy)
Definition: ManagedIceObject.cpp:393
armarx::ManagedIceObject::usingProxy
bool usingProxy(const std::string &name, const std::string &endpoints="")
Registers a proxy for retrieval after initialization and adds it to the dependency list.
Definition: ManagedIceObject.cpp:151