simondlevy / BreezySLAM

Simple, efficient, open-source package for Simultaneous Localization and Mapping
GNU Lesser General Public License v3.0
758 stars 251 forks source link

data representation #4

Closed ali-robot closed 8 years ago

ali-robot commented 8 years ago

I have been going through the python code, it is a little bit unclear how your code [ the update() method] expects the scan data to be represented. taking a look at the exp1.dat, exp2.dat, log2pgm.py and mines.py it seems you don't take into consideration the value of the angle returned by the encoder of the lidar, could you clarify this point ?

Moreover, if we take a look at this:

scan = readLidar() slam.update(scan) x, y, theta = slam.getpos(scan) slam.getmap(mapbytes)

if we make a send a scan to the update() method and wait till we get the result at the end of the slam.getmap(mapbytes) wouldn't we lose some data in the mean time being measured by the lidar ?

simondlevy commented 8 years ago

Good questions, ALHarake! The answer is that the crucial computations are done in the super-fast C code (coreslam,c) that is called by the Python code. For example, the scan_update function computes the angle based on the configuration of your lidar unit and the index of the scan distance. Let's say I have a really precise lidar that gives me 1000 scan distances over a 360 degree sweep. Then each distance is 360/1000 degrees from the one before it. The first distance is 0 degrees, the second is 0.36 degrees, the third is 0.72 degrees, etc.

I believe this also answers your second question, about timing. BreezySLAM can process the scans much faster than your lidar unit can deliver them. For example, the RPLidar scans at 5.5Hz (scans per second), whereas BreezySLAM running on an ODROID U3 can process 140 scans per second. So there's little chance of losing any scan data during the time it takes to process the scan.