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 {
44 
45  def->topic<armarx::OpenPose3DListener>("OpenPoseEstimation3D");
46  return def;
47 }
48 
49 void
51 {
52  usingProxy("SimpleEpisodicMemory");
53 }
54 
55 void
57 {
59 }
60 
61 void
63  const armarx::Keypoint3DMapList& kpml,
64  long timestamp,
65  const Ice::Current&)
66 {
67  if (kpml.empty())
68  {
69  return;
70  }
71  IceUtil::Time time = IceUtil::Time::microSeconds(timestamp);
72 
73  for (unsigned int i = 0; i < kpml.size(); ++i)
74  {
75  memoryx::Body25HumanPoseEvent human_pose_event;
76  human_pose_event.receivedInMs = time.toMilliSecondsDouble();
77 
78  for (const auto& [key, value] : kpml[i])
79  {
80  memoryx::HumanKeypoint kp;
81  if (key == "Background")
82  {
83  continue;
84  }
85 
86  kp.label = value.label;
87  kp.x = value.x;
88  kp.y = value.y;
89  kp.z = value.z;
90  kp.globalX = value.globalX;
91  kp.globalY = value.globalY;
92  kp.globalZ = value.globalZ;
93  kp.confidence = value.confidence;
94  human_pose_event.keypoints[key] = kp;
95  }
96  m_simple_episodic_memory->registerHumanPoseEvent(human_pose_event);
97  }
98 }
visionx::SimpleEpisodicMemoryOpenPoseEstimationConnector::onInitComponent
void onInitComponent()
Pure virtual hook for the subclass.
Definition: SimpleEpisodicMemoryOpenPoseEstimationConnector.cpp:50
visionx
ArmarX headers.
Definition: OpenPoseStressTest.h:38
SimpleEpisodicMemoryOpenPoseEstimationConnector.h
cxxopts::value
std::shared_ptr< Value > value()
Definition: cxxopts.hpp:855
FramedPose.h
timestamp
std::string timestamp()
Definition: CartographerAdapter.cpp:85
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:39
visionx::SimpleEpisodicMemoryOpenPoseEstimationConnector::report3DKeypoints
void report3DKeypoints(const armarx::Keypoint3DMapList &, long, const Ice::Current &)
Definition: SimpleEpisodicMemoryOpenPoseEstimationConnector.cpp:62
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:79
armarx::ComponentPropertyDefinitions
Default component property definition container.
Definition: Component.h:69
IceUtil::Handle< class PropertyDefinitionContainer >
visionx::SimpleEpisodicMemoryOpenPoseEstimationConnector::onConnectComponent
void onConnectComponent()
Pure virtual hook for the subclass.
Definition: SimpleEpisodicMemoryOpenPoseEstimationConnector.cpp:56
memoryx::SimpleEpisodicMemoryConnector::m_simple_episodic_memory_proxy_name
std::string m_simple_episodic_memory_proxy_name
Definition: SimpleEpisodicMemoryConnector.h:38
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:407
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:154