HandOverGroupStatechartContext.cpp
Go to the documentation of this file.
1
/*
2
* This file is part of ArmarX.
3
*
4
* Copyright (C) 2011-2017, High Performance Humanoid Technologies (H2T), Karlsruhe Institute of Technology (KIT), all rights reserved.
5
*
6
* ArmarX is free software; you can redistribute it and/or modify
7
* it under the terms of the GNU General Public License version 2 as
8
* published by the Free Software Foundation.
9
*
10
* ArmarX is distributed in the hope that it will be useful, but
11
* WITHOUT ANY WARRANTY; without even the implied warranty of
12
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
* GNU General Public License for more details.
14
*
15
* You should have received a copy of the GNU General Public License
16
* along with this program. If not, see <http://www.gnu.org/licenses/>.
17
*
18
* @package ArmarX
19
* @author Mirko Waechter( mirko.waechter at kit dot edu)
20
* @date 2018
21
* @copyright http://www.gnu.org/licenses/gpl-2.0.txt
22
* GNU General Public License
23
*/
24
#include "
HandOverGroupStatechartContext.h
"
25
#include <IceUtil/UUID.h>
26
#include <
ArmarXCore/core/util/algorithm.h
>
27
28
#include <mutex>
29
30
namespace
armarx
31
{
32
33
HandOverGroupStatechartContextExtension::HandOverGroupStatechartContextExtension
()
34
{
35
listener =
new
OpenPose3DListenerImpl
();
36
}
37
38
const
IceInternal::Handle<OpenPose3DListenerImpl>
&
HandOverGroupStatechartContextExtension::getPoseData
()
const
39
{
40
return
listener;
41
}
42
void
HandOverGroupStatechartContextExtension::onInitStatechartContext
()
43
{
44
HandOverGroup::HandOverGroupStatechartContext::onInitStatechartContext();
45
auto
object
= getIceManager()->registerObject(listener,
"OpenPose3dListenerImpl"
+ IceUtil::generateUUID()).first;
46
getIceManager()->subscribeTopic(
object
,
"OpenPoseEstimation3D"
);
47
}
48
49
void
HandOverGroupStatechartContextExtension::onConnectStatechartContext
()
50
{
51
HandOverGroup::HandOverGroupStatechartContext::onConnectStatechartContext();
52
}
53
54
void
OpenPose3DListenerImpl::report3DKeypoints
(
const
HumanPose3DMap&
data
,
Ice::Long
timestamp,
const
Ice::Current&)
55
{
56
ARMARX_INFO
<<
deactivateSpam
(5) <<
"Got new data of size: "
<<
data
.size() <<
" keys: "
<<
ARMARX_STREAM_PRINTER
57
{
58
if
(!
data
.empty())
59
{
60
//for (auto& pair : data.at(0))
61
//{
62
// out << pair.first << ": " << pair.second.x << ", " << pair.second.y << ", " << pair.second.z << "\n";
63
//}
64
// out << armarx::getMapKeys(data.at(0));
65
}
66
};
67
std::unique_lock lock(mutex);
68
std::vector<armarx::Keypoint3DMap> vec;
69
for
(
const
auto
& [name, entity] :
data
)
70
{
71
vec.push_back(entity.keypointMap);
72
}
73
latestData = vec;
74
this->timestamp = IceUtil::Time::microSeconds(timestamp);
75
}
76
77
std::pair<IceUtil::Time, std::vector<armarx::Keypoint3DMap>>
OpenPose3DListenerImpl::getLatestData
()
78
{
79
std::unique_lock lock(mutex);
80
return
std::make_pair(timestamp, latestData);
81
}
82
}
// namespace armarx
83
84
85
86
87
88
algorithm.h
armarx::HandOverGroupStatechartContextExtension::getPoseData
const IceInternal::Handle< OpenPose3DListenerImpl > & getPoseData() const
Definition:
HandOverGroupStatechartContext.cpp:38
IceInternal::Handle
Definition:
forward_declarations.h:8
armarx::OpenPose3DListenerImpl::report3DKeypoints
void report3DKeypoints(const armarx::HumanPose3DMap &, Ice::Long, const Ice::Current &) override
Definition:
HandOverGroupStatechartContext.cpp:54
deactivateSpam
SpamFilterDataPtr deactivateSpam(SpamFilterDataPtr const &spamFilter, float deactivationDurationSec, const std::string &identifier, bool deactivate)
Definition:
Logging.cpp:72
armarx::HandOverGroupStatechartContextExtension::onInitStatechartContext
void onInitStatechartContext() override
Definition:
HandOverGroupStatechartContext.cpp:42
HandOverGroupStatechartContext.h
data
uint8_t data[1]
Definition:
EtherCATFrame.h:68
armarx::HandOverGroupStatechartContextExtension::onConnectStatechartContext
void onConnectStatechartContext() override
Definition:
HandOverGroupStatechartContext.cpp:49
armarx::VariantType::Long
const VariantTypeId Long
Definition:
Variant.h:917
armarx::HandOverGroupStatechartContextExtension::HandOverGroupStatechartContextExtension
HandOverGroupStatechartContextExtension()
Definition:
HandOverGroupStatechartContext.cpp:33
ARMARX_INFO
#define ARMARX_INFO
Definition:
Logging.h:174
armarx::OpenPose3DListenerImpl
Definition:
HandOverGroupStatechartContext.h:34
armarx::OpenPose3DListenerImpl::getLatestData
std::pair< IceUtil::Time, std::vector< armarx::Keypoint3DMap > > getLatestData()
Definition:
HandOverGroupStatechartContext.cpp:77
armarx
This file offers overloads of toIce() and fromIce() functions for STL container types.
Definition:
ArmarXTimeserver.cpp:28
ARMARX_STREAM_PRINTER
#define ARMARX_STREAM_PRINTER
use this macro to write output code that is executed when printed and thus not executed if the debug ...
Definition:
Logging.h:304
RobotSkillTemplates
statecharts
HandOverGroup
HandOverGroupStatechartContext.cpp
Generated on Sat Oct 12 2024 09:14:13 for armarx_documentation by
1.8.17