Skip to content
Snippets Groups Projects
Commit d865b5f2 authored by Fabian Paus's avatar Fabian Paus
Browse files

Hokuyo: Add plausability checks for distance values

parent b453cdc7
No related branches found
No related tags found
No related merge requests found
......@@ -180,9 +180,14 @@ void HokuyoLaserUnit::updateScanData()
for (int stepIndex = 0; stepIndex < lengthDataSize; ++stepIndex)
{
LaserScanStep step;
step.angle = angleOffset + (float)urg_step2rad(&device.urg, stepIndex); // Convert steps to rad
step.distance = (float)device.lengthData[stepIndex]; // Data is already in mm
scan.push_back(step);
long distance = device.lengthData[stepIndex];
// TODO: Extract the min and max valid value for distance into parameters
if (distance >= 21 && distance <= 30000)
{
step.angle = angleOffset + (float)urg_step2rad(&device.urg, stepIndex); // Convert steps to rad
step.distance = (float)distance; // Data is already in mm
scan.push_back(step);
}
}
// TODO: Better names for the devices?
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment