HumanPoseWriter.cpp
Go to the documentation of this file.
1 #include "HumanPoseWriter.h"
2 
4 
6 
8 
10 {
11 
12 
13  Writer::Writer() : armem::client::util::SimpleWriterBase()
14  {
15  }
16 
17  Writer::~Writer() = default;
18 
19  void
21  {
23  }
24 
25  void
27  {
28  ARMARX_VERBOSE << "Connecting ...";
30  ARMARX_VERBOSE << "Connected.";
31 
32  humanMemory =
33  armem::human::HumanMemoryServerInterfacePrx::checkedCast(this->memoryWriter().memory);
34  }
35 
36  bool
38  const std::string& provider,
39  const armem::Time& referencedTime)
40  {
41  ARMARX_WARNING << "NYI";
42  return true;
43  }
44 
45  bool
46  Writer::commitHumanPoses(const std::vector<HumanPose>& humanPoses,
47  const std::string& provider,
48  const armem::Time& referencedTime)
49  {
50  ARMARX_WARNING << "NYI";
51  return true;
52  }
53 
54  bool
56  const std::string& provider,
57  const armem::Time& referencedTime)
58  {
59  return commitHumanPosesInCameraFrame({humanPose}, provider, referencedTime);
60  }
61 
62  bool
63  Writer::commitHumanPosesInCameraFrame(const std::vector<HumanPose>& humanPoses,
64  const std::string& provider,
65  const armem::Time& referencedTime)
66  {
69 
70  std::vector<armarx::aron::data::dto::DictPtr> humanPosesDto;
71  for (const HumanPose& humanPose : humanPoses)
72  {
73  armarx::human::arondto::HumanPose humanPoseAron;
74  toAron(humanPoseAron, humanPose);
75  humanPosesDto.push_back(humanPoseAron.toAronDTO());
76  }
77 
78  core::time::dto::DateTime referencedTimeDto;
79  toIce(referencedTimeDto, referencedTime);
80 
81  try
82  {
83  humanMemory->commitHumanPosesInCameraFrame(humanPosesDto, provider, referencedTimeDto);
84  return true;
85  }
86  catch (const Ice::Exception& e)
87  {
88  ARMARX_ERROR << "Failed to commit human poses: " << e;
89  return false;
90  }
91  }
92 
93 } // namespace armarx::armem::human::client
armarx::armem::human::client::Writer::commitHumanPoseInCameraFrame
bool commitHumanPoseInCameraFrame(const HumanPose &humanPose, const std::string &provider, const armem::Time &referencedTime)
Definition: HumanPoseWriter.cpp:55
ARMARX_VERBOSE
#define ARMARX_VERBOSE
Definition: Logging.h:180
armarx::armem::human::toAron
void toAron(armarx::human::arondto::HumanPose &dto, const HumanPose &bo)
Definition: aron_conversions.cpp:31
armarx::armem
Definition: LegacyRobotStateMemoryAdapter.cpp:31
armarx::armem::toIce
void toIce(data::MemoryID &ice, const MemoryID &id)
Definition: ice_conversions.cpp:21
armarx::armem::human::client
Definition: HumanPoseReader.cpp:14
ice_conversions.h
armarx::armem::human::client::Writer::commitHumanPose
bool commitHumanPose(const HumanPose &humanPose, const std::string &provider, const armem::Time &referencedTime)
Definition: HumanPoseWriter.cpp:37
aron_conversions.h
armarx::armem::human::client::Writer::commitHumanPosesInCameraFrame
bool commitHumanPosesInCameraFrame(const std::vector< HumanPose > &humanPoses, const std::string &provider, const armem::Time &referencedTime)
Calls a dedicated interface of the human memory in order to resolve keypoints in several frames given...
Definition: HumanPoseWriter.cpp:63
armarx::memory
Brief description of class memory.
Definition: memory.h:39
armarx::armem::human::client::Writer::registerPropertyDefinitions
void registerPropertyDefinitions(armarx::PropertyDefinitionsPtr &def)
Definition: HumanPoseWriter.cpp:20
armarx::armem::client::util::SimpleWriterBase::registerPropertyDefinitions
void registerPropertyDefinitions(armarx::PropertyDefinitionsPtr &def)
Definition: SimpleWriterBase.cpp:13
armarx::armem::client::util::SimpleWriterBase::memoryWriter
armem::client::Writer & memoryWriter()
Definition: SimpleWriterBase.cpp:51
armarx::armem::human::client::Writer::Writer
Writer()
Definition: HumanPoseWriter.cpp:13
armarx::armem::client::util::SimpleWriterBase::connect
void connect(armarx::armem::client::MemoryNameSystem &mns)
Definition: SimpleWriterBase.cpp:33
ARMARX_ERROR
#define ARMARX_ERROR
Definition: Logging.h:189
armarx::armem::human::HumanPose
Definition: types.h:30
armarx::armem::human::client::Writer::connect
void connect(armem::client::MemoryNameSystem &memoryNameSystem)
Definition: HumanPoseWriter.cpp:26
armarx::core::time::DateTime
Represents a point in time.
Definition: DateTime.h:24
aron_conversions.h
armarx::aron::toAron
void toAron(T &dto, const T &bo)
Framework for converting ARON DTOs (Data Transfer Objects) to C++ BOs (Business Objects) and back.
Definition: aron_conversions.h:74
HumanPoseWriter.h
IceUtil::Handle< class PropertyDefinitionContainer >
armarx::armem::client::MemoryNameSystem
The memory name system (MNS) client.
Definition: MemoryNameSystem.h:69
armarx::armem::human::client::Writer::commitHumanPoses
bool commitHumanPoses(const std::vector< HumanPose > &humanPoses, const std::string &provider, const armem::Time &referencedTime)
Definition: HumanPoseWriter.cpp:46
ARMARX_WARNING
#define ARMARX_WARNING
Definition: Logging.h:186
armarx::armem::human::client::Writer::~Writer
~Writer() override