38 resultCloud.reset(
new pcl::PointCloud<pcl::PointXYZ>());
41 filter.setStddevMulThresh(1.0);
67 const std::string& name,
68 const LaserScan& scan,
70 const Ice::Current&
c)
72 pcl::PointCloud<pcl::PointXYZ> cloud;
73 cloud.points.reserve(scan.size());
75 for (
const LaserScanStep& l : scan)
78 p.x = -l.distance * std::sin(l.angle);
79 p.y = l.distance * std::cos(l.angle);
81 cloud.points.push_back(p);
85 cloud.width = cloud.points.size();
88 std::unique_lock<std::mutex> lock(mutex, std::try_to_lock);
90 if (!lock.owns_lock())
100 const std::string& frameName = name;
102 if (localRobot->hasRobotNode(frameName))
104 Eigen::Matrix4f
transform = localRobot->getRobotNode(frameName)->getPoseInRootFrame();
105 pcl::transformPointCloud(cloud, clouds[name],
transform);
107 resultCloud->clear();
108 for (
auto& kv : clouds)
110 const pcl::PointCloud<pcl::PointXYZ>&
c = kv.second;
119 if (resultCloud->empty())
122 <<
"Input point cloud is empty. Will not report anything.";
126 pcl::PointCloud<pcl::PointXYZ>::Ptr cloudFiltered(
new pcl::PointCloud<pcl::PointXYZ>());
127 filter.setInputCloud(resultCloud);
128 filter.filter(*cloudFiltered);
141 def->topic<LaserScannerUnitListener>(
142 "LaserScans",
"laser_scanner_topic",
"Name of the laser scanner topic.");
147 visionx::MetaPointCloudFormatPtr
150 visionx::MetaPointCloudFormatPtr info =
new visionx::MetaPointCloudFormat();
152 info->size = info->capacity;
153 info->type = visionx::PointContentType::ePoints;
160 return "LaserScannerPointCloudProvider";
#define ARMARX_REGISTER_COMPONENT_EXECUTABLE(ComponentT, applicationName)
SpamFilterDataPtr deactivateSpam(SpamFilterDataPtr const &spamFilter, float deactivationDurationSec, const std::string &identifier, bool deactivate)
std::string getConfigIdentifier()
Retrieve config identifier for this component as set in constructor.
Property< PropertyType > getProperty(const std::string &name)
Brief description of class LaserScannerPointCloudProvider.
void reportSensorValues(const std::string &, const std::string &, const LaserScan &, const TimestampBasePtr &, const Ice::Current &c=Ice::emptyCurrent) override
visionx::MetaPointCloudFormatPtr getDefaultPointCloudFormat() override
default point cloud format used to initialize shared memory
void onConnectPointCloudProvider() override
This is called when the Component::onConnectComponent() setup is called.
armarx::PropertyDefinitionsPtr createPropertyDefinitions() override
void onInitPointCloudProvider() override
This is called when the Component::onInitComponent() is called.
static std::string GetDefaultName()
void onExitPointCloudProvider() override
This is called when the Component::onExitComponent() setup is called.
bool usingProxy(const std::string &name, const std::string &endpoints="")
Registers a proxy for retrieval after initialization and adds it to the dependency list.
Ice::ObjectPrx getProxy(long timeoutMs=0, bool waitForScheduler=true) const
Returns the proxy of this object (optionally it waits for the proxy)
VirtualRobot::RobotPtr createLocalClone()
Clones the structure of this remote robot to a local instance.
static bool synchronizeLocalClone(VirtualRobot::RobotPtr robot, RobotStateComponentInterfacePrx robotStatePrx)
void providePointCloud(PointCloudPtrT pointCloudPtr)
offer the new point cloud.
#define ARMARX_INFO
The normal logging level.
#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.
This file offers overloads of toIce() and fromIce() functions for STL container types.
auto transform(const Container< InputT, Alloc > &in, OutputT(*func)(InputT const &)) -> Container< OutputT, typename std::allocator_traits< Alloc >::template rebind_alloc< OutputT > >
Convenience function (with less typing) to transform a container of type InputT into the same contain...
const std::size_t MAX_LASER_SCANNER_POINTS
IceUtil::Handle< class PropertyDefinitionContainer > PropertyDefinitionsPtr
PropertyDefinitions smart pointer type.