32#include <Ice/Current.h>
34#include <SimoxUtility/algorithm/apply.hpp>
35#include <VirtualRobot/VirtualRobot.h>
43#include <ArmarXCore/interface/core/time.h>
49#include <RobotAPI/interface/aron/Aron.h>
56#include <VisionX/libraries/armem_human/aron/FaceRecognition.aron.generated.h>
57#include <VisionX/libraries/armem_human/aron/HumanPose.aron.generated.h>
58#include <VisionX/libraries/armem_human/aron/Person.aron.generated.h>
72 profileSegment.defineProperties(defs,
"profile.");
73 personInstanceSegment.defineProperties(defs,
"instance");
74 poseSegment.defineProperties(defs,
"pose.");
75 faceRecognitionSegment.defineProperties(defs,
"face.");
76 identificationSegment.defineProperties(defs,
"ident.");
77 humanActivitySegment.defineProperties(defs,
"activity.");
78 humanRobotInteractionSegment.defineProperties(defs,
"interaction.");
91 visu(poseSegment, faceRecognitionSegment, personInstanceSegment)
111 profileSegment.init();
112 personInstanceSegment.init();
114 faceRecognitionSegment.init();
115 identificationSegment.init();
116 humanActivitySegment.init();
117 humanRobotInteractionSegment.init();
147 if (robots.count(robotName) == 0)
149 auto newRobot = virtualRobotReaderPlugin->get().getRobot(robotName);
151 <<
"Failed to obtain robot with name `" << robotName <<
"`.";
153 robots[robotName] = newRobot;
156 return robots.at(robotName);
160 bool const success = virtualRobotReaderPlugin->get().synchronizeRobot(*robot,
timestamp);
176 const ::armarx::aron::data::dto::AronDictSeq& dictSeq,
177 const ::std::string& providerName,
178 const ::armarx::core::time::dto::DateTime& iceTimestamp,
179 const ::Ice::Current& )
191 const auto toHumanPose = [](const ::armarx::aron::data::dto::DictPtr& dict)
192 {
return armarx::human::arondto::HumanPose::FromAron(dict); };
194 std::vector<armarx::human::arondto::HumanPose> humanPoses =
195 simox::alg::apply(dictSeq, toHumanPose);
198 const std::string robotName =
199 humanPoses.front().keypoints.begin()->second.positionCamera.header.agent;
206 <<
"`. Won't commit poses";
214 for (armarx::human::arondto::HumanPose& humanPose : humanPoses)
216 for (
auto& [_, keyPoint] : humanPose.keypoints)
218 const auto& cameraFrame = keyPoint.positionCamera.header.frame;
219 const auto& agent = keyPoint.positionCamera.header.agent;
222 keyPoint.positionCamera.position, cameraFrame, agent);
227 keyPoint.positionGlobal = armarx::arondto::FramedPosition();
236 keyPoint.positionRobot = armarx::arondto::FramedPosition();
239 robot->getRootNode()->getName(),
244 if (keyPoint.orientationCamera.has_value())
247 keyPoint.positionCamera.header.frame);
250 keyPoint.orientationCamera->orientation.toRotationMatrix(),
251 keyPoint.positionCamera.position,
257 const Eigen::Isometry3f global_T_human(
260 keyPoint.orientationGlobal = armarx::arondto::FramedOrientation();
263 keyPoint.orientationGlobal.value(),
271 const Eigen::Isometry3f robot_root_T_human(
275 keyPoint.orientationRobot = armarx::arondto::FramedOrientation();
279 Eigen::Matrix3f{robot_root_T_human.linear()},
280 robot->getRootNode()->getName(),
294 const ::armarx::aron::data::dto::AronDictSeq& dictSeq,
295 const ::std::string& providerName,
296 const ::armarx::core::time::dto::DateTime& iceTimestamp,
297 const ::Ice::Current& )
309 const auto toPersonFace = [](const ::armarx::aron::data::dto::DictPtr& dict)
310 {
return armarx::human::arondto::FaceRecognition::FromAron(dict); };
312 std::vector<armarx::human::arondto::FaceRecognition> personFaces =
313 simox::alg::apply(dictSeq, toPersonFace);
316 const std::string robotName =
"Armar7";
323 <<
"`. Won't commit poses";
331 for (armarx::human::arondto::FaceRecognition& personFace : personFaces)
334 fromAron(personFace.framedPosition3D, fp);
345 const std::vector<::armarx::human::arondto::HumanPose>& humanPoses,
346 const std::string& providerName,
353 const auto entityID = providerId.withEntityName(
"human_poses").withTimestamp(
timestamp);
356 update.entityID = entityID;
363 std::back_inserter(update.instancesData),
365 { return humanPose.toAron(); });
376 const std::vector<::armarx::human::arondto::FaceRecognition>& personFaces,
377 const std::string& providerName,
384 const auto entityID = providerId.withEntityName(
"human_poses").withTimestamp(
timestamp);
387 update.entityID = entityID;
391 std::transform(personFaces.begin(),
393 std::back_inserter(update.instancesData),
394 [](const ::armarx::human::arondto::FaceRecognition& personFace)
406 const ::std::string& providerName,
407 const ::armarx::core::time::dto::DateTime& iceTimestamp,
408 const ::std::string& entityName,
409 const ::Ice::Current& )
421 const auto toHumanProfile = [](const ::armarx::aron::data::dto::DictPtr& dict)
422 {
return armarx::human::arondto::Person::FromAron(dict); };
424 std::vector<armarx::human::arondto::Person> humanProfiles =
425 simox::alg::apply(dictSeq, toHumanProfile);
427 ARMARX_DEBUG <<
"Collected all information on human profile from ice call"
429 <<
"entityName: " << entityName;
437 const std::vector<armarx::human::arondto::Person>& humanProfiles,
438 const ::std::string& providerName,
440 const ::std::string& entityName)
445 const auto entityID = providerId.withEntityName(entityName).withTimestamp(
timestamp);
448 update.entityID = entityID;
452 for (
const auto& humanProfile : humanProfiles)
454 update.instancesData.push_back(humanProfile.toAron());
#define ARMARX_REGISTER_COMPONENT_EXECUTABLE(ComponentT, applicationName)
armarx::viz::Client arviz
Default component property definition container.
std::string getConfigIdentifier()
Retrieve config identifier for this component as set in constructor.
const DebugObserverInterfacePrx & getDebugObserver() const
The FramedOrientation class.
Eigen::Matrix4f toGlobalEigen(const SharedRobotInterfacePrx &referenceRobot) const
Eigen::Matrix4f toRootEigen(const SharedRobotInterfacePrx &referenceRobot) const
The FramedPosition class.
Eigen::Vector3f toGlobalEigen(const SharedRobotInterfacePrx &referenceRobot) const
Eigen::Vector3f toRootEigen(const SharedRobotInterfacePrx &referenceRobot) const
SpamFilterDataPtr deactivateSpam(float deactivationDurationSec=10.0f, const std::string &identifier="", bool deactivate=true) const
disables the logging for the current line for the given amount of seconds.
PluginT * addPlugin(const std::string prefix="", ParamsT &&... params)
data::CommitResult commitLocking(const data::Commit &commitIce, Time timeArrived)
static const std::string CORE_SEGMENT_NAME
static const std::string CORE_SEGMENT_NAME
static const std::string CORE_SEGMENT_NAME
void commitHumanProfiles(const ::armarx::aron::data::dto::AronDictSeq &dictSeq, const ::std::string &providerName, const ::armarx::core::time::dto::DateTime ×tamp, const std::string &entityName, const ::Ice::Current &=::Ice::emptyCurrent) override
void onInitComponent() override
Pure virtual hook for the subclass.
void onDisconnectComponent() override
Hook for subclass.
void commitPersonFaces(const std::vector<::armarx::human::arondto::FaceRecognition > &personFaces, const std::string &providerName, const armarx::DateTime ×tamp)
void commitHumanPosesInCameraFrame(const ::armarx::aron::data::dto::AronDictSeq &dictSeq, const ::std::string &providerName, const ::armarx::core::time::dto::DateTime ×tamp, const ::Ice::Current &=::Ice::emptyCurrent) override
VirtualRobot::RobotPtr getSynchronizedRobot(const std::string &robotName, const armarx::DateTime ×tamp)
void commitHumanProfilesA(const std::vector< armarx::human::arondto::Person > &humanProfiles, const ::std::string &providerName, const armarx::DateTime ×tamp, const ::std::string &entityName)
armarx::PropertyDefinitionsPtr createPropertyDefinitions() override
Creates the property definition container.
void commitPersonFacesInCameraFrame(const ::armarx::aron::data::dto::AronDictSeq &dictSeq, const ::std::string &providerName, const ::armarx::core::time::dto::DateTime ×tamp, const ::Ice::Current &=::Ice::emptyCurrent) override
void onConnectComponent() override
Pure virtual hook for the subclass.
static std::string GetDefaultName()
void commitHumanPoses(const std::vector<::armarx::human::arondto::HumanPose > &humanPoses, const std::string &providerName, const armarx::DateTime ×tamp)
void onExitComponent() override
Hook for subclass.
std::string getDefaultName() const override
Retrieve default name of component.
void setMemoryName(const std::string &memoryName)
server::wm::Memory & workingMemory()
virtual data::CommitResult commit(const data::Commit &commit, const Ice::Current &=Ice::emptyCurrent) override
MemoryToIceAdapter & iceAdapter()
CoreSegment & addCoreSegment(const std::string &name, Args... args)
Represents a point in time.
#define ARMARX_CHECK_NOT_NULL(ptr)
This macro evaluates whether ptr is not null and if it turns out to be false it will throw an Express...
#define ARMARX_CHECK_EQUAL(lhs, rhs)
This macro evaluates whether lhs is equal (==) rhs and if it turns out to be false it will throw an E...
#define ARMARX_INFO
The normal logging level.
#define ARMARX_DEBUG
The logging level for output that is only interesting while debugging.
std::string const GlobalFrame
Variable of the global coordinate system.
std::shared_ptr< class Robot > RobotPtr
void fromIce(const data::MemoryID &ice, MemoryID &id)
void fromAron(const arondto::MemoryID &dto, MemoryID &bo)
std::shared_ptr< Dict > DictPtr
void toAron(arondto::PackagePath &dto, const PackageFileLocation &bo)
IceUtil::Handle< class PropertyDefinitionContainer > PropertyDefinitionsPtr
PropertyDefinitions smart pointer type.
A bundle of updates to be sent to the memory.
An update of an entity for a specific point in time.