Revision: 6902
          http://playerstage.svn.sourceforge.net/playerstage/?rev=6902&view=rev
Author:   jeremy_asher
Date:     2008-07-22 17:58:47 +0000 (Tue, 22 Jul 2008)

Log Message:
-----------
libstageplugin: fixed more laser bugs

Modified Paths:
--------------
    code/stage/trunk/libstageplugin/p_laser.cc
    code/stage/trunk/libstageplugin/test/lsp_test_laser.cc

Modified: code/stage/trunk/libstageplugin/p_laser.cc
===================================================================
--- code/stage/trunk/libstageplugin/p_laser.cc  2008-07-22 17:01:34 UTC (rev 
6901)
+++ code/stage/trunk/libstageplugin/p_laser.cc  2008-07-22 17:58:47 UTC (rev 
6902)
@@ -108,20 +108,20 @@
       // TODO
       // int intensity = plc->intensity;
 
-      PRINT_DEBUG3( "requested laser config:\n %f %f %f",
-                   RTOD(plc->min_angle), RTOD(plc->max_angle), 
-                   plc->resolution/1e2);
-
       stg_laser_cfg_t cfg = mod->GetConfig();
+               
+         printf( "laser config was: resolution %d, fov %.6f, interval %d\n", 
+                         cfg.resolution, cfg.fov, cfg.interval );
      
-         cfg.resolution = 1.0 / plc->resolution;
          cfg.fov = plc->max_angle - plc->min_angle;
+         cfg.resolution = cfg.fov / ( cfg.sample_count * plc->resolution );
+         if ( cfg.resolution < 1 ) 
+                 cfg.resolution = 1;
          cfg.interval = 1.0E6 / plc->scanning_frequency;
-
-      PRINT_DEBUG4( "setting laser config: fov %.2f max_range %.2f " /
-                                   "resolution %.2f interval %.2f",
-                                   cfg.fov, cfg.range_bounds.max,
-                                   cfg.resolution, cfg.interval );
+               
+               //PRINT_DEBUG3
+         printf( "setting laser config: resolution %d, fov %.6f, interval 
%d\n", 
+                         cfg.resolution, cfg.fov, cfg.interval );
       
          // Range resolution is currently locked to the world setting
          //  and intensity values are always read.  The relevant settings
@@ -155,7 +155,7 @@
       memset(&plc,0,sizeof(plc));
       plc.min_angle = -cfg.fov/2.0;
       plc.max_angle = +cfg.fov/2.0;
-      plc.resolution = cfg.fov / cfg.sample_count;
+      plc.resolution = cfg.fov / ( cfg.sample_count * cfg.resolution );
       plc.max_range = cfg.range_bounds.max;
          plc.range_res = 1.0; // todo
       plc.intensity = 1; // todo

Modified: code/stage/trunk/libstageplugin/test/lsp_test_laser.cc
===================================================================
--- code/stage/trunk/libstageplugin/test/lsp_test_laser.cc      2008-07-22 
17:01:34 UTC (rev 6901)
+++ code/stage/trunk/libstageplugin/test/lsp_test_laser.cc      2008-07-22 
17:58:47 UTC (rev 6902)
@@ -54,20 +54,23 @@
 void Laser::testData() {
        playerc_client_read( client );  
        
+       // verify that we're getting new data
+       laserProxy->info.fresh = 0;
+       playerc_client_read( client );
+       CPPUNIT_ASSERT_MESSAGE( "laser updating", laserProxy->info.fresh == 1 );
+       
        CPPUNIT_ASSERT( laserProxy->info.datatime > 0 );
        CPPUNIT_ASSERT( laserProxy->scan_count == Samples );
        CPPUNIT_ASSERT_DOUBLES_EQUAL_MESSAGE( "min scan angle", -M_PI/2, 
laserProxy->scan[0][1], Delta );
        CPPUNIT_ASSERT_DOUBLES_EQUAL_MESSAGE( "max scan angle", M_PI/2, 
laserProxy->scan[Samples-1][1], Delta );
+
        for ( int i = 0; i < laserProxy->scan_count; i++ ) {
                double distance = laserProxy->scan[i][0];
+
+               // check range of each sample is within max and min
                CPPUNIT_ASSERT( distance <= laserProxy->max_range );
                CPPUNIT_ASSERT( distance >= laserProxy->min_right );
-//        printf("[%6.3f, %6.3f ] \n", laserProxy->scan[i][0], 
laserProxy->scan[i][1]);
+
+               //        printf("[%6.3f, %6.3f ] \n", laserProxy->scan[i][0], 
laserProxy->scan[i][1]);
        }
-       
-       laserProxy->info.fresh = 0;
-       playerc_client_read( client );
-       CPPUNIT_ASSERT( laserProxy->info.fresh == 1 );
-       
-       // check range of each is within max and min
 }
\ No newline at end of file


This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Playerstage-commit mailing list
Playerstage-commit@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/playerstage-commit

Reply via email to