~mrol-dev/mrol/trunk

« back to all changes in this revision

Viewing changes to mrol_mapping/mrol.py

  • Committer: Julian Ryde
  • Date: 2012-03-04 02:43:54 UTC
  • mto: (16.1.12 trunk) (29.1.2 trunk)
  • mto: This revision was merged to the branch mainline in revision 25.
  • Revision ID: julian_ryde-20120304024354-yjf7woyr2bsd6vyn
Fixed mapper_test.  Updated the ground truth poses so that test passes aligning all simulated scans.

Show diffs side-by-side

added added

removed removed

Lines of Context:
32
32
topn = 100
33
33
 
34
34
# approximate number of sample points selected from the scan to be aligned
35
 
sample_size = 1000 
 
35
sample_size = 2000
36
36
 
37
37
# TODO consider pulling in table class from icra2011 code, table.py
38
38
def printtable(table, width):
223
223
        # cast points to float32 for speed
224
224
        xyzs = np.float32(xyzs)
225
225
        xyzs_sample = self._sample_points(xyzs, sample_size)
 
226
        #xyzs_sample = util.volumetricsample(xyzs, 0.4)
226
227
 
227
228
        if verbose: 
228
229
            print 'Number of sample points: %d' % len(xyzs_sample)
230
231
        bestpose = initialpose
231
232
        for level, ol in enumerate(self.mapvoxels):
232
233
            objective_func = ol.cost_func 
233
 
            #objective_func = self.objectivefuncMROL
234
234
            dtheta = dtheta_base*pow(self.factor,(len(self.mapvoxels)-level-1))
235
235
            dx = ol.resolution
236
236
            # This helps avoid local minima, but limits accuracy to voxel size 
237
237
            # at the finest resolution
238
238
            if verbose:
239
239
                print 'resolution: %f' % (ol.resolution)
240
 
            # objective_func is -self.calccollisions(pose, xyzs)
 
240
            # objective_func is -occupiedlist.calccollisions(pose, xyzs)
241
241
            bestpose, cost = optimization.cost_min(objective_func, bestpose, (xyzs_sample,), dx, dtheta, max_iterations=20, verbosity=2)
242
242
            #bestpose, cost = optimization._cost_min_scipy(objective_func, bestpose, (xyzs_sample,))
243
243
        # run it again at the finest resolution with tighter steps to get