-3

I am writing an algorithm for Frontier Based Exploration in c++ using player stage simulation 2.0 and I am stuck on a specific part. From my understanding the laserProxy provides a 180 degree scan of the environment in front of the robot. i have a for loop that iterates through all 180 beams of the robot, and analyzes each one.

for (int i = 0; i < lp->GetCount(); i++) {

lp is a pointer to a LaserProxy. I checked the reference manual for laserProxy and GetCount() is suppose to return the number of points in the scan. I assumed that this will always be 180 since thats how many beams are being projected from the robot but this is not the case, sometimes GetCount() is 0, other times it is 90, and other values. Can anyone explain why this is so?

Thank you

jamalsabs
  • 119
  • 3

1 Answers1

0

This question requires you to look at the code. I implementing a laser scanner in another open-source robot simulator. What's most easy to do is to cast rays and calculate the intersection. The lines do not necessarily need to intersect. Hence, it might be understandable that when they do not intersect there will be no point (of intersection) returned at all. The files you have to look at:

$ grep -lr scan_count .  | grep drivers 
./server/drivers/laser/laserrescan.cc
./server/drivers/laser/sickLDMRS.cc
./server/drivers/mixed/mricp/src/mricp_driver.cpp

The laserrescan file returns always 181 points, but the SICK laser doesn't, see the code.

Anne van Rossum
  • 3,091
  • 1
  • 35
  • 39