15#include <Ice/LocalException.h>
16#include <IceUtil/Time.h>
18#include <opencv2/core/hal/interface.h>
19#include <opencv2/imgproc/imgproc.hpp>
40#include "nuitrack/types/NuitrackDeviceCommon.h"
41#include <Calibration/Calibration.h>
42#include <Image/ImageProcessor.h>
48 getNuitrackToK4ABTMapping(tdv::nuitrack::JointType nuitrackJoint)
50 using namespace tdv::nuitrack;
53 static const std::map<JointType, K4AJoint> mapping = {
54 {JOINT_HEAD, K4AJoint::Head},
55 {JOINT_NECK, K4AJoint::Neck},
57 {JOINT_TORSO, K4AJoint::SpineNaval},
58 {JOINT_WAIST, K4AJoint::Pelvis},
60 {JOINT_LEFT_COLLAR, K4AJoint::ClavicleLeft},
61 {JOINT_LEFT_SHOULDER, K4AJoint::ShoulderLeft},
62 {JOINT_LEFT_ELBOW, K4AJoint::ElbowLeft},
63 {JOINT_LEFT_WRIST, K4AJoint::WristLeft},
64 {JOINT_LEFT_HAND, K4AJoint::HandLeft},
67 {JOINT_RIGHT_COLLAR, K4AJoint::ClavicleRight},
68 {JOINT_RIGHT_SHOULDER, K4AJoint::ShoulderRight},
69 {JOINT_RIGHT_ELBOW, K4AJoint::ElbowRight},
70 {JOINT_RIGHT_WRIST, K4AJoint::WristRight},
71 {JOINT_RIGHT_HAND, K4AJoint::HandRight},
74 {JOINT_LEFT_HIP, K4AJoint::HipLeft},
75 {JOINT_LEFT_KNEE, K4AJoint::KneeLeft},
76 {JOINT_LEFT_ANKLE, K4AJoint::AnkleLeft},
79 {JOINT_RIGHT_HIP, K4AJoint::HipRight},
80 {JOINT_RIGHT_KNEE, K4AJoint::KneeRight},
81 {JOINT_RIGHT_ANKLE, K4AJoint::AnkleRight},
86 auto it = mapping.find(nuitrackJoint);
87 if (it != mapping.end())
89 return static_cast<int>(it->second);
95 printBodyInformation(
const tdv::nuitrack::Skeleton& skeleton)
98 for (
const auto& joint : skeleton.joints)
101 <<
"Position[mm] (" << joint.real.x <<
"," << joint.real.y <<
","
102 << joint.real.z <<
"); "
103 <<
"Confidence " << joint.confidence;
108 constexpr float minSpineLengthMm = 100.0F;
114 std::optional<Eigen::Vector3f>
120 static const std::vector<std::pair<std::string, std::string>> pairs = {
123 {
"Pelvis",
"SpineNaval"},
127 {
"HipRight",
"Neck"},
132 for (
const auto& [bottomName, topName] : pairs)
134 auto bottomIt = pose.
keypoints.find(bottomName);
135 auto topIt = pose.
keypoints.find(topName);
140 Eigen::Vector3f vec = topIt->second.positionCamera.toEigen()
141 - bottomIt->second.positionCamera.toEigen();
145 const float norm = vec.norm();
146 if (
norm < minSpineLengthMm)
157 const Eigen::Vector3f& worldUp,
162 const float maxAngleRad = maxAngleDeg * std::numbers::pi_v<float> / 180.F;
163 if (maxAngleRad >= std::numbers::pi_v<float>)
168 const float cosThreshold = std::cos(maxAngleRad);
169 const float radToDeg = 180.F / std::numbers::pi_v<float>;
175 if (!bodyUp.has_value())
179 <<
"): Could not compute valid body pose up vector.";
182 const float cosAngle = bodyUp->dot(worldUp);
183 if (cosAngle < cosThreshold)
185 const float angleDeg =
186 std::acos(std::clamp(cosAngle, -1.F, 1.F)) * radToDeg;
189 <<
"): body-up angle " << angleDeg <<
"° > max "
190 << maxAngleDeg <<
"°";
202 std::string name =
"duration " + description +
" in [ms]";
204 std::lock_guard g{metaInfoMtx};
209 std::lock_guard g{debugObserverMtx};
229 "Max. allowed depth value in mm. Depth values above this "
230 "threshold will be set to nan.");
239 defs->optional(robotName,
"robotName");
240 defs->optional(bodyCameraFrameName,
"bodyCameraFrameName");
241 defs->optional(framerate.value,
243 "The framerate of RGB-D images [frames per second]."
244 "\nNote that the point cloud and body tracking frame rates are controlled by"
245 " the properties 'framerate' (point cloud) and 'framerate.bodyTracking'"
246 " (body tracking), respectively.")
250 defs->optional(bodyTrackingEnabled,
251 "bodyTrackingEnabled",
252 "Whether the body tracking should be enabled or not.");
254 bodyTrackingRunAtStart,
255 "bodyTrackingRunAtStart",
256 "Whether the body tracking should directly run when the component is startet."
257 "Otherwise it has to be activated by the ice interface.");
258 defs->optional(bodyTrackingDepthMaskMinX,
"bodyTrackingDepthMaskMinX");
259 defs->optional(bodyTrackingDepthMaskMaxX,
"bodyTrackingDepthMaskMaxX");
260 defs->optional(bodyTrackingDepthMaskMaxZ,
"bodyTrackingDepthMaskMaxZ");
261 defs->optional(framerate.bodyTracking.value,
262 "framerate.bodyTracking",
263 "The framerate with with the body tracking is run [frames per second]."
264 "\nNote that the RGB-D image and point cloud frame rates are controlled by"
265 " the properties 'framerate.image' (RGB-D images) and 'framerate'"
266 " (point cloud), respectively.")
270 defs->optional(confidenceThreshold,
"confidenceThreshold");
271 defs->optional(minimumSegmentsWithConfidenceLargerThanThreshold,
272 "minimumSegmentsWithConfidenceLargerThanThreshold");
273 defs->optional(uprightFilterMaxAngleDeg,
274 "uprightFilterMaxAngleDeg",
275 "Maximum angle in degrees between the estimated body up vector "
276 "(spine direction, arm joints excluded) and the world up vector (0, 0, 1). "
277 "Poses exceeding this threshold are dropped. Set >= 180 to disable.")
281 humanPoseWriter.registerPropertyDefinitions(defs);
283 defs->optional(enableHeartbeat,
"enableHeartbeat");
292 if (framerate.value != 5 && framerate.value != 15 && framerate.value != 30)
294 throw armarx::LocalException(
"Invalid image framerate (property 'framerate.images'): ")
295 << framerate.value <<
". Only framerates 5, 15 and 30 are supported.";
298 framerate.pointCloud.value =
300 framerate.pointCloud.update(framerate.value);
302 framerate.bodyTracking.update(framerate.value);
310 ARMARX_INFO <<
"Depth image size: " << depthWidth <<
"x" << depthHeight;
311 ARMARX_INFO <<
"Color image size: " << colorWidth <<
"x" << colorHeight;
317 alignedDepthImage = cv::Mat(colorHeight, colorWidth, CV_16UC1);
318 colorImageRGB = cv::Mat(colorHeight, colorWidth, CV_8UC3);
322 visionx::eBayerPatternGr);
326 std::make_unique<CByteImage>(colorWidth, colorHeight, CByteImage::eRGB24);
328 pointcloud = std::make_unique<pcl::PointCloud<CloudPointType>>();
341 pointcloudTask->start();
344 bodyTrackingEnabled =
true;
345 bodyTrackingRunAtStart =
true;
346 robotName =
"Armar7";
349 if (bodyTrackingEnabled)
356 this, &NuitrackPointCloudProvider::runPublishBodyTrackingResults);
364 {
"Vision",
"Camera"},
365 "NuitrackPointCloudProvider");
378 std::lock_guard<std::mutex> lock(pointcloudProcMutex);
379 ARMARX_DEBUG <<
"Stopping pointcloud processing thread...";
380 const bool WAIT_FOR_JOIN =
false;
381 pointcloudTask->stop(WAIT_FOR_JOIN);
382 pointcloudProcSignal.notify_all();
383 ARMARX_DEBUG <<
"Waiting for pointcloud processing thread to stop...";
384 pointcloudTask->waitForStop();
388 if (bodyTrackingIsRunning)
390 bodyTrackingIsRunning =
false;
391 bodyTrackingPublishTask->stop();
421 tdv::nuitrack::Nuitrack::init();
427 auto devices = tdv::nuitrack::Nuitrack::getDeviceList();
432 throw armarx::LocalException(
"No Nuitrack-compatible devices detected!");
435 ARMARX_INFO <<
"Found " << devices.size() <<
" Nuitrack-compatible devices";
443 tdv::nuitrack::device::VideoMode colorMode{.width = resultColorImage->width,
444 .height = resultColorImage->height,
445 .fps = framerate.value};
446 devices[0]->setVideoMode(tdv::nuitrack::device::StreamType::COLOR, colorMode);
451 tdv::nuitrack::device::VideoMode depthMode{.width = resultDepthImage->width,
452 .height = resultDepthImage->height,
453 .fps = framerate.value};
454 devices[0]->setVideoMode(tdv::nuitrack::device::StreamType::DEPTH, depthMode);
456 tdv::nuitrack::Nuitrack::setDevice(devices[0]);
459 << devices[0]->getInfo(tdv::nuitrack::device::DeviceInfoType::DEVICE_NAME);
462 depthSensor = tdv::nuitrack::DepthSensor::create();
463 colorSensor = tdv::nuitrack::ColorSensor::create();
466 depthSensor->connectOnNewFrame([
this](
auto&& PH1)
468 colorSensor->connectOnNewFrame([
this](
auto&& PH1)
471 if (bodyTrackingEnabled)
473 ARMARX_INFO <<
"Initializing Nuitrack skeleton tracking...";
474 skeletonTracker = tdv::nuitrack::SkeletonTracker::create();
475 skeletonTracker->connectOnUpdate(
478 if (bodyTrackingRunAtStart and not bodyTrackingIsRunning)
480 bodyTrackingIsRunning =
true;
481 bodyTrackingPublishTask->start();
486 tdv::nuitrack::Nuitrack::run();
490 catch (
const tdv::nuitrack::Exception& e)
492 ARMARX_ERROR <<
"Failed to initialize Nuitrack: " << e.what();
494 throw armarx::LocalException(
"Nuitrack initialization failed: ") << e.what();
504 tdv::nuitrack::Nuitrack::release();
506 catch (
const tdv::nuitrack::Exception& e)
521 std::lock_guard<std::mutex> lock(depthFrameMutex);
522 latestDepthFrame = frame;
534 std::lock_guard<std::mutex> lock(colorFrameMutex);
535 latestColorFrame = frame;
545 std::lock_guard<std::mutex> lock(skeletonMutex);
546 latestSkeletonData = skeletonData;
559 tdv::nuitrack::Nuitrack::waitUpdate(depthSensor);
561 catch (
const tdv::nuitrack::Exception& e)
563 ARMARX_WARNING <<
"Failed to get frame from Nuitrack: " << e.what();
567 tdv::nuitrack::DepthFrame::Ptr depthFrame;
568 tdv::nuitrack::RGBFrame::Ptr colorFrame;
571 std::lock_guard<std::mutex> lock(colorFrameMutex);
572 std::lock_guard<std::mutex> lock_(depthFrameMutex);
573 depthFrame = latestDepthFrame;
574 colorFrame = latestColorFrame;
577 if (depthFrame && colorFrame)
581 imagesTime = IceUtil::Time::microSeconds(latestTimestamp);
587 const int width = colorFrame->getCols();
588 const int height = colorFrame->getRows();
589 const tdv::nuitrack::Color3* colorData = colorFrame->getData();
594 auto rgb_buffer_ivt = resultColorImage->pixels;
597 for (
int i = 0; i < width * height; ++i)
599 rgb_buffer_ivt[index_ivt] = colorData[i].red;
600 rgb_buffer_ivt[index_ivt + 1] = colorData[i].green;
601 rgb_buffer_ivt[index_ivt + 2] = colorData[i].blue;
610 const int width = depthFrame->getCols();
611 const int height = depthFrame->getRows();
612 const uint16_t* depthData = depthFrame->getData();
615 if (not framerate.pointCloud.skip())
617 std::lock_guard lock{pointcloudProcMutex};
621 alignedDepthImage.data, depthData, width * height *
sizeof(uint16_t));
624 depthImageReady =
true;
626 pointcloudProcSignal.notify_one();
634 const int width = depthFrame->getCols();
635 const int height = depthFrame->getRows();
636 const uint16_t* depthData = depthFrame->getData();
642 auto result_depth_buffer = resultDepthImage->pixels;
645 for (
int i = 0; i < width * height; ++i)
647 uint16_t depth_value = depthData[i];
649 result_depth_buffer[
index],
650 result_depth_buffer[
index + 1],
651 result_depth_buffer[
index + 2]);
659 CByteImage* images[2] = {resultColorImage.get(), resultDepthImage.get()};
665 std::unique_lock signal_lock{pointcloudProcMutex};
666 ARMARX_DEBUG <<
"Capturing thread waiting for signal...";
667 pointcloudProcSignal.wait(signal_lock, [&] {
return depthImageProcessed; });
672 std::lock_guard g{debugObserverMtx};
678 heartbeatPlugin->heartbeat();
687 std::lock_guard g{debugObserverMtx};
695 NuitrackPointCloudProvider::runPublishBodyTrackingResults()
698 while (bodyTrackingIsRunning)
701 tdv::nuitrack::SkeletonData::Ptr skeletonData;
703 std::lock_guard<std::mutex> lock(skeletonMutex);
704 skeletonData = latestSkeletonData;
714 std::lock_guard<std::mutex> lock(colorFrameMutex);
717 const auto& skeletons = skeletonData->getSkeletons();
718 std::uint32_t num_bodies = skeletons.size();
721 std::lock_guard g{debugObserverMtx};
725 std::vector<armarx::armem::human::HumanPose> humanPoses;
726 humanPoses.reserve(num_bodies);
728 for (
const auto& skeleton : skeletons)
730 printBodyInformation(skeleton);
732 armarx::armem::human::HumanPose humanPose;
737 int segmentsWithConfidenceLargerThanThreshold = 0;
740 for (
const auto& nuitrackJoint : skeleton.joints)
742 auto k4aJointIdx = getNuitrackToK4ABTMapping(nuitrackJoint.type);
743 if (!k4aJointIdx.has_value())
751 k4aJointIdx.value());
759 Eigen::Vector3f position(
760 nuitrackJoint.real.x, -nuitrackJoint.real.y, nuitrackJoint.real.z);
763 Eigen::Matrix3f rotMatrix;
764 rotMatrix << nuitrackJoint.orient.matrix[0], nuitrackJoint.orient.matrix[1],
765 nuitrackJoint.orient.matrix[2], nuitrackJoint.orient.matrix[3],
766 nuitrackJoint.orient.matrix[4], nuitrackJoint.orient.matrix[5],
767 nuitrackJoint.orient.matrix[6], nuitrackJoint.orient.matrix[7],
768 nuitrackJoint.orient.matrix[8];
770 humanPose.
keypoints[name] = armarx::armem::human::PoseKeypoint{
772 .confidence = nuitrackJoint.confidence,
774 armarx::FramedPosition(position, bodyCameraFrameName, robotName),
775 .orientationCamera = armarx::FramedOrientation(
776 rotMatrix, bodyCameraFrameName, robotName)};
778 segmentsWithConfidenceLargerThanThreshold +=
779 static_cast<int>(nuitrackJoint.confidence > confidenceThreshold);
782 if (segmentsWithConfidenceLargerThanThreshold >=
783 minimumSegmentsWithConfidenceLargerThanThreshold)
785 humanPoses.push_back(humanPose);
790 <<
"Ignoring human due to minimum confident segments="
791 << segmentsWithConfidenceLargerThanThreshold <<
"<"
792 << minimumSegmentsWithConfidenceLargerThanThreshold;
797 std::lock_guard g{debugObserverMtx};
804 Eigen::Vector3f::UnitZ(),
805 uprightFilterMaxAngleDeg);
807 if (not humanPoses.empty())
810 humanPoseWriter.commitHumanPosesInCameraFrame(humanPoses,
getName(),
timestamp);
818 metronome.waitForNextTick();
830 while (not pointcloudTask->isStopped())
833 std::unique_lock signal_lock{pointcloudProcMutex};
834 ARMARX_DEBUG <<
"Pointcloud thread waiting for signal...";
835 pointcloudProcSignal.wait(
836 signal_lock, [&] {
return pointcloudTask->isStopped() or depthImageReady; });
840 const IceUtil::Time TIMESTAMP = imagesTime;
841 depthImageReady =
false;
842 depthImageProcessed =
false;
850 const int width = alignedDepthImage.cols;
851 const int height = alignedDepthImage.rows;
853 pointcloud->width =
static_cast<uint32_t
>(width);
854 pointcloud->height =
static_cast<uint32_t
>(height);
855 pointcloud->is_dense =
false;
856 pointcloud->points.resize(pointcloud->width * pointcloud->height);
858 const uint16_t* depth_buffer =
859 reinterpret_cast<const uint16_t*
>(alignedDepthImage.data);
860 unsigned char* color_buffer = resultColorImage->pixels;
874 const float fx = 525.0f;
875 const float fy = 525.0f;
876 const float cx = width / 2.0f;
877 const float cy = height / 2.0f;
881 size_t point_index = 0;
884 for (
int y = 0; y < height; ++y)
886 for (
int x = 0;
x < width; ++
x, ++point_index)
888 auto& p = pointcloud->points[point_index];
891 p.r = color_buffer[color_index++];
892 p.g = color_buffer[color_index++];
893 p.b = color_buffer[color_index++];
896 uint16_t depth_value = depth_buffer[point_index];
898 if (depth_value > 0 && depth_value <= max_depth)
903 p.x = (
x - cx) * depth_meters / fx;
904 p.y = (y - cy) * depth_meters / fy;
908 p.x = std::numeric_limits<float>::quiet_NaN();
909 p.y = std::numeric_limits<float>::quiet_NaN();
910 p.z = std::numeric_limits<float>::quiet_NaN();
920 depthImageProcessed =
true;
921 signal_lock.unlock();
923 pointcloudProcSignal.notify_all();
930 pointcloud->header.stamp =
static_cast<unsigned long>(TIMESTAMP.toMicroSeconds());
944 return "AzureKinectPointCloudProvider";
961 robot = robotReader.getRobot(
"Armar7");
969 if (bodyTrackingIsRunning)
971 bodyTrackingIsRunning =
false;
972 bodyTrackingPublishTask->stop();
992 using namespace Eigen;
996 StereoCalibration stereo_calibration;
1003 MonocularCalibration colorCalib;
1004 colorCalib.cameraParam.width = colorWidth;
1005 colorCalib.cameraParam.height = colorHeight;
1007 auto intrinsics = colorSensor->getOutputMode().intrinsics;
1008 colorCalib.cameraParam.focalLength = {intrinsics.fx, intrinsics.fy};
1010 colorCalib.cameraParam.principalPoint = {intrinsics.cx, intrinsics.cy};
1013 colorCalib.cameraParam.distortion = {0.0f, 0.0f, 0.0f, 0.0f};
1016 colorCalib.cameraParam.rotation = convertEigenMatToVisionX(Matrix3f::Identity());
1017 colorCalib.cameraParam.translation = {0.0f, 0.0f, 0.0f};
1019 stereo_calibration.calibrationLeft = colorCalib;
1023 MonocularCalibration depthCalib = colorCalib;
1024 depthCalib.cameraParam.distortion = {0.0f, 0.0f, 0.0f, 0.0f};
1025 stereo_calibration.calibrationRight = depthCalib;
1027 stereo_calibration.rectificationHomographyLeft =
1028 convertEigenMatToVisionX(Matrix3f::Identity());
1029 stereo_calibration.rectificationHomographyRight =
1030 convertEigenMatToVisionX(Matrix3f::Identity());
1032 return stereo_calibration;
1047 std::vector<imrec::ChannelPreferences>
1052 imrec::ChannelPreferences rgb;
1053 rgb.requiresLossless =
false;
1056 imrec::ChannelPreferences depth;
1057 depth.requiresLossless =
true;
1058 depth.name =
"depth";
1060 return {rgb, depth};
1065 const armarx::EnableHumanPoseEstimationInput& input,
1066 const Ice::Current&)
1068 if (bodyTrackingEnabled)
1071 if (not bodyTrackingIsRunning and input.enable3d)
1073 bodyTrackingIsRunning =
true;
1074 bodyTrackingPublishTask->start();
1076 else if (bodyTrackingIsRunning and not input.enable3d)
1078 bodyTrackingIsRunning =
false;
1079 bodyTrackingPublishTask->stop();
1084 ARMARX_ERROR <<
"Azure Kinect Body Tracking is not enabled";
1091 std::scoped_lock lock(bodyTrackingParameterMutex);
1092 bodyTrackingDepthMaskMaxZ = maxDepthInMM;
1098 const Ice::Current&)
1100 std::scoped_lock lock(bodyTrackingParameterMutex);
1101 bodyTrackingDepthMaskMinX = minXinPixel;
1102 bodyTrackingDepthMaskMaxX = maxXinPixel;
1113 if (std::abs(std::fmod(higherFramerate,
value)) > 1e-6)
1115 std::stringstream ss;
1116 ss <<
"Invalid value (" <<
value <<
" fps) for framerate of '" <<
name <<
"'."
1117 <<
" Reason: The framerate has to be a divider of the property framerate.image ("
1118 << higherFramerate <<
" fps).";
1119 throw armarx::LocalException() << ss.str();
static DateTime Now()
Current time on the virtual clock.
std::string getConfigIdentifier()
Retrieve config identifier for this component as set in constructor.
Property< PropertyType > getProperty(const std::string &name)
void setDebugObserverDatafield(Ts &&... ts) const
void sendDebugObserverBatch()
void setDebugObserverBatchModeEnabled(bool enable)
static Duration MicroSeconds(std::int64_t microSeconds)
Constructs a duration in microseconds.
static Duration MilliSeconds(std::int64_t milliSeconds)
Constructs a duration in milliseconds.
The FramedPosition class.
Eigen::Vector3f toGlobalEigen(const SharedRobotInterfacePrx &referenceRobot) const
static Frequency Hertz(std::int64_t hertz)
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.
virtual void onExitComponent()
Hook for subclass.
bool usingProxy(const std::string &name, const std::string &endpoints="")
Registers a proxy for retrieval after initialization and adds it to the dependency list.
virtual void onDisconnectComponent()
Hook for subclass.
PluginT * addPlugin(const std::string prefix="", ParamsT &&... params)
virtual void onConnectComponent()=0
Pure virtual hook for the subclass.
std::string getName() const
Retrieve name of object.
virtual void onInitComponent()=0
Pure virtual hook for the subclass.
void setMetaInfo(const std::string &id, const VariantBasePtr &value)
Allows to set meta information that can be queried live via Ice interface on the ArmarXManager.
ArmarXManagerPtr getArmarXManager() const
Returns the ArmarX manager used to add and remove components.
std::string prefix
Prefix of the properties such as namespace, domain, component name, etc.
PropertyDefinition< PropertyType > & defineOptionalProperty(const std::string &name, PropertyType defaultValue, const std::string &description="", PropertyDefinitionBase::PropertyConstness constness=PropertyDefinitionBase::eConstant)
IceUtil::Handle< RunningTask< T > > pointer_type
Shared pointer type for convenience.
static IceUtil::Time GetTime(TimeMode timeMode=TimeMode::VirtualTime)
Get the current time.
static IceUtil::Time GetTimeSince(IceUtil::Time referenceTime, TimeMode timeMode=TimeMode::VirtualTime)
Get the difference between the current time and a reference time.
The Variant class is described here: Variants.
MemoryNameSystem & memoryNameSystem()
std::int64_t toMicroSecondsSinceEpoch() const
Simple rate limiter for use in loops to maintain a certain frequency given a clock.
Measures the time this stop watch was inside the current scope.
Measures the passed time between the construction or calling reset() and stop().
CapturingPointCloudProviderPropertyDefinitions(std::string prefix)
void stopCapture(const Ice::Current &c=Ice::emptyCurrent) override
Stops point cloud capturing.
std::atomic_bool captureEnabled
Indicates that capturing is enabled and running.
void setPointCloudSyncMode(ImageSyncMode pointCloudSyncMode)
Sets the point cloud synchronization mode.
void onInitComponent() override
void onDisconnectComponent() override
Hook for subclass.
ImageFormatInfo getImageFormat(const Ice::Current &c=Ice::emptyCurrent) override
Returns the entire image format info struct via Ice.
void setImageFormat(ImageDimension imageDimension, ImageType imageType, BayerPatternType bayerPatternType=visionx::eBayerPatternRg)
Sets the image basic format data.
void provideImages(void **inputBuffers, const IceUtil::Time &imageTimestamp=IceUtil::Time())
send images raw.
void onConnectComponent() override
void setNumberImages(int numberImages)
Sets the number of images on each capture.
void onExitComponent() override
NuitrackPointCloudProviderPropertyDefinitions(std::string prefix)
void onNewSkeletonData(tdv::nuitrack::SkeletonData::Ptr skeletonData)
void onInitComponent() override
Pure virtual hook for the subclass.
void setMaxDepthBodyTracking(int maxDepthInMM, const Ice::Current &=Ice::emptyCurrent) override
bool doCapture() override
Main capturing function.
void enableHumanPoseEstimation(const armarx::EnableHumanPoseEstimationInput &input, const Ice::Current &=Ice::emptyCurrent) override
std::optional< Eigen::Vector3f > computeBodyUpVector(const armarx::armem::human::HumanPose &pose)
void onExitCapturingPointCloudProvider() override
This is called when the Component::onExitComponent() setup is called.
NuitrackPointCloudProvider()
void onDisconnectComponent() override
Hook for subclass.
void onNewColorFrame(tdv::nuitrack::RGBFrame::Ptr frame)
void onStartCapture(float frames_per_second) override
This is called when the point cloud provider capturing has been started.
void filterPosesByUpright(std::vector< armarx::armem::human::HumanPose > &poses, const Eigen::Vector3f &worldUp, float maxAngleDeg)
armarx::PropertyDefinitionsPtr createPropertyDefinitions() override
void runPointcloudPublishing()
void onConnectImageProvider() override
This is called when the Component::onConnectComponent() setup is called.
visionx::StereoCalibration getStereoCalibration(const Ice::Current &c) override
std::string getReferenceFrame(const Ice::Current &c) override
std::function< void(armarx::Duration)> createSwCallback(const std::string &description)
void onInitCapturingPointCloudProvider() override
This is called when the Component::onInitComponent() is called.
void onConnectComponent() override
Pure virtual hook for the subclass.
void onStopCapture() override
This is called when the point cloud provider capturing has been stopped.
bool getImagesAreUndistorted(const ::Ice::Current &c) override
std::vector< imrec::ChannelPreferences > getImageRecordingChannelPreferences(const Ice::Current &) override
void onInitImageProvider() override
This is called when the Component::onInitComponent() is called.
void setWidthBodyTracking(int minXinPixel, int maxXinPixel, const Ice::Current &=Ice::emptyCurrent) override
void onExitComponent() override
Hook for subclass.
void onDisconnectImageProvider() override
void onNewDepthFrame(tdv::nuitrack::DepthFrame::Ptr frame)
std::string getDefaultName() const override
MetaPointCloudFormatPtr getPointCloudFormat(const Ice::Current &c=Ice::emptyCurrent) override
Returns the point cloud format info struct via Ice.
void providePointCloud(PointCloudPtrT pointCloudPtr)
offer the new point cloud.
#define ARMARX_CHECK_EXPRESSION(expression)
This macro evaluates the expression and if it turns out to be false it will throw an ExpressionExcept...
#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_ERROR
The logging level for unexpected behaviour, that must be fixed.
#define ARMARX_DEBUG
The logging level for output that is only interesting while debugging.
#define ARMARX_WARNING
The logging level for unexpected behaviour, but not a serious problem.
#define ARMARX_VERBOSE
The logging level for verbose information.
const std::string ModelId
const simox::meta::EnumNames< Joints > JointNames
Names of the joints as defined in the body model.
Joints
Joints with index as defined in the body model.
This file offers overloads of toIce() and fromIce() functions for STL container types.
IceUtil::Handle< class PropertyDefinitionContainer > PropertyDefinitionsPtr
PropertyDefinitions smart pointer type.
double norm(const Point &a)
std::optional< std::string > humanTrackingId
std::string cameraFrameName
unsigned int skipFramesCount
void update(int higherFramerate)