67 const std::string& name,
68 const LaserScan& scan,
70 const Ice::Current&
c)
72 std::unique_lock lock(dataMutex);
83 float minDistance = FLT_MAX;
84 float minAngle = 0.0f;
85 float maxDistance = -FLT_MAX;
86 float maxAngle = 0.0f;
87 float distanceSum = 0.0f;
88 for (LaserScanStep
const& step : scan)
90 distanceSum += step.distance;
91 if (step.distance < minDistance)
93 minDistance = step.distance;
94 minAngle = step.angle;
96 if (step.distance > maxDistance)
98 maxDistance = step.distance;
99 maxAngle = step.angle;
107 device,
"minAngle", minAngle,
"angle with minimal distance in scan");
110 device,
"maxAngle", maxAngle,
"angle with maximal distance in scan");
111 float averageDistance = distanceSum / scan.size();
113 device,
"averageDistance", averageDistance,
"average distance in scan");
std::string getConfigIdentifier()
Retrieve config identifier for this component as set in constructor.
Property< PropertyType > getProperty(const std::string &name)
Checks if the numbers published in the relevant data fields equal a reference value.
Checks if the numbers published in the relevant data fields are larger than a reference value.
Checks if the numbers published in the relevant data fields are smaller than a reference value.
Checks if the relevant data fields have been updated since the installation of this condition.
void onConnectObserver() override
Framework hook.
void onExitObserver() override
Framework hook.
PropertyDefinitionsPtr createPropertyDefinitions() override
void reportSensorValues(const std::string &device, const std::string &name, const LaserScan &scan, const TimestampBasePtr ×tamp, const Ice::Current &c) override
void onInitObserver() override
Framework hook.
void usingTopic(const std::string &name, bool orderedPublishing=false)
Registers a proxy for subscription after initialization.
bool existsChannel(const std::string &channelName) const
void offerChannel(std::string channelName, std::string description)
Offer a channel.
void offerConditionCheck(std::string checkName, ConditionCheck *conditionCheck)
Offer a condition check.
void updateChannel(const std::string &channelName, const std::set< std::string > &updatedDatafields=std::set< std::string >())
Update all conditions for a channel.
bool offerOrUpdateDataField(std::string channelName, std::string datafieldName, const Variant &value, const std::string &description)
This file offers overloads of toIce() and fromIce() functions for STL container types.
IceUtil::Handle< class PropertyDefinitionContainer > PropertyDefinitionsPtr
PropertyDefinitions smart pointer type.
IceInternal::Handle< TimestampVariant > TimestampVariantPtr