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
37using namespace visionx;
38
41{
44
45 def->topic<armarx::OpenPose3DListener>("OpenPoseEstimation3D");
46 return def;
47}
48
49void
54
55void
60
61void
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}
std::string timestamp()
Default component property definition container.
Definition Component.h:70
std::string getConfigIdentifier()
Retrieve config identifier for this component as set in constructor.
Definition Component.cpp:90
bool usingProxy(const std::string &name, const std::string &endpoints="")
Registers a proxy for retrieval after initialization and adds it to the dependency list.
Ice::ObjectPrx getProxy(long timeoutMs=0, bool waitForScheduler=true) const
Returns the proxy of this object (optionally it waits for the proxy)
memoryx::SimpleEpisodicMemoryInterface::ProxyType m_simple_episodic_memory
void report3DKeypoints(const armarx::Keypoint3DMapList &, long, const Ice::Current &)
IceUtil::Handle< class PropertyDefinitionContainer > PropertyDefinitionsPtr
PropertyDefinitions smart pointer type.
ArmarX headers.