30#include <Ice/Current.h>
32#include <SimoxUtility/algorithm/apply.hpp>
33#include <VirtualRobot/VirtualRobot.h>
41#include <ArmarXCore/interface/core/time.h>
47#include <RobotAPI/interface/aron/Aron.h>
54#include <VisionX/libraries/armem_human/aron/FaceRecognition.aron.generated.h>
55#include <VisionX/libraries/armem_human/aron/HumanPose.aron.generated.h>
56#include <VisionX/libraries/armem_human/aron/Person.aron.generated.h>
70 profileSegment.defineProperties(defs,
"profile.");
71 personInstanceSegment.defineProperties(defs,
"instance");
72 poseSegment.defineProperties(defs,
"pose.");
73 faceRecognitionSegment.defineProperties(defs,
"face.");
74 identificationSegment.defineProperties(defs,
"ident.");
75 humanActivitySegment.defineProperties(defs,
"activity.");
76 humanRobotInteractionSegment.defineProperties(defs,
"interaction.");
89 visu(poseSegment, faceRecognitionSegment, personInstanceSegment)
103 profileSegment.init();
104 personInstanceSegment.init();
106 faceRecognitionSegment.init();
107 identificationSegment.init();
108 humanActivitySegment.init();
109 humanRobotInteractionSegment.init();
139 if (robots.count(robotName) == 0)
141 auto newRobot = virtualRobotReaderPlugin->get().getRobot(robotName);
143 <<
"Failed to obtain robot with name `" << robotName <<
"`.";
145 robots[robotName] = newRobot;
148 return robots.at(robotName);
152 bool const success = virtualRobotReaderPlugin->get().synchronizeRobot(*robot,
timestamp);
168 const ::armarx::aron::data::dto::AronDictSeq& dictSeq,
169 const ::std::string& providerName,
170 const ::armarx::core::time::dto::DateTime& iceTimestamp,
171 const ::Ice::Current& )
183 const auto toHumanPose = [](const ::armarx::aron::data::dto::DictPtr& dict)
184 {
return armarx::human::arondto::HumanPose::FromAron(dict); };
186 std::vector<armarx::human::arondto::HumanPose> humanPoses =
187 simox::alg::apply(dictSeq, toHumanPose);
190 const std::string robotName =
191 humanPoses.front().keypoints.begin()->second.positionCamera.header.agent;
198 <<
"`. Won't commit poses";
206 for (armarx::human::arondto::HumanPose& humanPose : humanPoses)
208 for (
auto& [_, keyPoint] : humanPose.keypoints)
210 const auto& cameraFrame = keyPoint.positionCamera.header.frame;
211 const auto& agent = keyPoint.positionCamera.header.agent;
214 keyPoint.positionCamera.position, cameraFrame, agent);
219 keyPoint.positionGlobal = armarx::arondto::FramedPosition();
228 keyPoint.positionRobot = armarx::arondto::FramedPosition();
231 robot->getRootNode()->getName(),
236 if (keyPoint.orientationCamera.has_value())
239 keyPoint.positionCamera.header.frame);
242 keyPoint.orientationCamera->orientation.toRotationMatrix(),
243 keyPoint.positionCamera.position,
249 const Eigen::Isometry3f global_T_human(
252 keyPoint.orientationGlobal = armarx::arondto::FramedOrientation();
255 keyPoint.orientationGlobal.value(),
263 const Eigen::Isometry3f robot_root_T_human(
267 keyPoint.orientationRobot = armarx::arondto::FramedOrientation();
271 Eigen::Matrix3f{robot_root_T_human.linear()},
272 robot->getRootNode()->getName(),
286 const ::armarx::aron::data::dto::AronDictSeq& dictSeq,
287 const ::std::string& providerName,
288 const ::armarx::core::time::dto::DateTime& iceTimestamp,
289 const ::Ice::Current& )
301 const auto toPersonFace = [](const ::armarx::aron::data::dto::DictPtr& dict)
302 {
return armarx::human::arondto::FaceRecognition::FromAron(dict); };
304 std::vector<armarx::human::arondto::FaceRecognition> personFaces =
305 simox::alg::apply(dictSeq, toPersonFace);
308 const std::string robotName =
"Armar7";
315 <<
"`. Won't commit poses";
323 for (armarx::human::arondto::FaceRecognition& personFace : personFaces)
326 fromAron(personFace.framedPosition3D, fp);
337 const std::vector<::armarx::human::arondto::HumanPose>& humanPoses,
338 const std::string& providerName,
345 const auto entityID = providerId.withEntityName(
"human_poses").withTimestamp(
timestamp);
348 update.entityID = entityID;
355 std::back_inserter(update.instancesData),
357 { return humanPose.toAron(); });
368 const std::vector<::armarx::human::arondto::FaceRecognition>& personFaces,
369 const std::string& providerName,
376 const auto entityID = providerId.withEntityName(
"human_poses").withTimestamp(
timestamp);
379 update.entityID = entityID;
383 std::transform(personFaces.begin(),
385 std::back_inserter(update.instancesData),
386 [](const ::armarx::human::arondto::FaceRecognition& personFace)
398 const ::std::string& providerName,
399 const ::armarx::core::time::dto::DateTime& iceTimestamp,
400 const ::std::string& entityName,
401 const ::Ice::Current& )
413 const auto toHumanProfile = [](const ::armarx::aron::data::dto::DictPtr& dict)
414 {
return armarx::human::arondto::Person::FromAron(dict); };
416 std::vector<armarx::human::arondto::Person> humanProfiles =
417 simox::alg::apply(dictSeq, toHumanProfile);
419 ARMARX_DEBUG <<
"Collected all information on human profile from ice call"
421 <<
"entityName: " << entityName;
429 const std::vector<armarx::human::arondto::Person>& humanProfiles,
430 const ::std::string& providerName,
432 const ::std::string& entityName)
437 const auto entityID = providerId.withEntityName(entityName).withTimestamp(
timestamp);
440 update.entityID = entityID;
444 for (
const auto& humanProfile : humanProfiles)
446 update.instancesData.push_back(humanProfile.toAron());
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.
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.