playerproject / player

The Player cross-platform robot device interface & server
GNU General Public License v2.0
60 stars 32 forks source link

Dose the implementation code for VFH+ work correctly? #20

Open hzlijianjun opened 3 years ago

hzlijianjun commented 3 years ago

https://github.com/playerproject/player/blob/b05878f9a803f981604fda1efffa2ac1ae28329d/server/drivers/position/vfh/vfh.cc#L725

Hi, I found that some lines of code were commented in the VFH_Class::ProcessLaser method form vfh.cc file, Such as lines of No 725, No 733 and No 734. I suspect whether it was a mistake comment.
Dose the implementation code for VFH+ work correctly?
Thanks!
richmattes commented 3 years ago

I'm not entirely sure. The source code was changed in this commit: https://github.com/playerproject/player/commit/7042a798ac1dc558d1a06faf78d267668cdb479e The commit message talks about interpolating the scan to a full 180 degrees, i think the replaced code might have just been commented out but not deleted. Im not sure commented code means something is broken, are you seeing other issues?

hzlijianjun commented 3 years ago

@richmattes Thanks for looking into this. I have a 360 degress scaning lidar, for which I was going to write a custom laser driver. My custom laser driver would provider scaned data as following: data.min_angle = 0; data.resolution = 1; data.ranges_count = 360

I debout that my scaned data may unmatch with following logical of VFH_Class::ProcessLaser method:

for(i = 0; i < 181; i++) { unsigned int index = (int)rint(i/db); //assert(index >= 0 && index < data.ranges_count); if(index < 0 || index >= data.ranges_count) continue; this->laser_ranges[i*2][0] = data.ranges[index] * 1e3; // this->laser_ranges[i*2][1] = index; // b += db; }

And why is "i2" this way but not "i" in the line: ` this->laser_ranges[i2][0] = data.ranges[index] * 1e3;`

Can you show me some light on this? Thanks!