Revision: 6919
          http://playerstage.svn.sourceforge.net/playerstage/?rev=6919&view=rev
Author:   jeremy_asher
Date:     2008-07-24 00:03:46 +0000 (Thu, 24 Jul 2008)

Log Message:
-----------
libstageplugin: added fiducial test, updated other tests, fixed initialization 
of sonar data in p_sonar

Modified Paths:
--------------
    code/stage/trunk/libstageplugin/p_sonar.cc
    code/stage/trunk/libstageplugin/test/CMakeLists.txt
    code/stage/trunk/libstageplugin/test/lsp_test_laser.cc
    code/stage/trunk/libstageplugin/test/lsp_test_position2d.cc
    code/stage/trunk/libstageplugin/test/lsp_test_position2d.hh
    code/stage/trunk/worlds/lsp_test.cfg
    code/stage/trunk/worlds/lsp_test.world

Added Paths:
-----------
    code/stage/trunk/libstageplugin/test/lsp_test_fiducial.cc
    code/stage/trunk/libstageplugin/test/lsp_test_fiducial.hh

Modified: code/stage/trunk/libstageplugin/p_sonar.cc
===================================================================
--- code/stage/trunk/libstageplugin/p_sonar.cc  2008-07-24 00:00:30 UTC (rev 
6918)
+++ code/stage/trunk/libstageplugin/p_sonar.cc  2008-07-24 00:03:46 UTC (rev 
6919)
@@ -119,6 +119,9 @@
          // fill in the geometry data formatted player-like
          pgeom.poses[i].px = mod->sensors[i].pose.x;     
          pgeom.poses[i].py = mod->sensors[i].pose.y;     
+         pgeom.poses[i].pz = 0;
+         pgeom.poses[i].ppitch = 0;
+         pgeom.poses[i].proll = 0;
          pgeom.poses[i].pyaw = mod->sensors[i].pose.a;     
        }
       

Modified: code/stage/trunk/libstageplugin/test/CMakeLists.txt
===================================================================
--- code/stage/trunk/libstageplugin/test/CMakeLists.txt 2008-07-24 00:00:30 UTC 
(rev 6918)
+++ code/stage/trunk/libstageplugin/test/CMakeLists.txt 2008-07-24 00:03:46 UTC 
(rev 6919)
@@ -21,6 +21,8 @@
        lsp_test_speech.hh
        lsp_test_sonar.cc
        lsp_test_sonar.hh
+       lsp_test_fiducial.cc
+       lsp_test_fiducial.hh
        lsp_test_position2d.cc
        lsp_test_position2d.hh
 )

Added: code/stage/trunk/libstageplugin/test/lsp_test_fiducial.cc
===================================================================
--- code/stage/trunk/libstageplugin/test/lsp_test_fiducial.cc                   
        (rev 0)
+++ code/stage/trunk/libstageplugin/test/lsp_test_fiducial.cc   2008-07-24 
00:03:46 UTC (rev 6919)
@@ -0,0 +1,52 @@
+#include "lsp_test_fiducial.hh"
+
+using namespace lspTest;
+
+const int Fiducial::Samples = 361;
+
+void Fiducial::setUp() {
+       connect();
+       fiducialProxy = playerc_fiducial_create( client, 0 );
+       CPPUNIT_ASSERT( playerc_fiducial_subscribe( fiducialProxy, 
PLAYER_OPEN_MODE ) == 0 );
+}
+
+
+void Fiducial::tearDown() {
+       CPPUNIT_ASSERT( playerc_fiducial_unsubscribe( fiducialProxy ) == 0 );
+       playerc_fiducial_destroy( fiducialProxy );
+       disconnect();
+}
+
+void Fiducial::testGeom() {
+       CPPUNIT_ASSERT( playerc_fiducial_get_geom( fiducialProxy ) == 0 );
+       
+       // values from lsp_test.world
+       CPPUNIT_ASSERT_DOUBLES_EQUAL_MESSAGE( "pose (x)", -0.15, 
fiducialProxy->fiducial_geom.pose.px, Delta );
+       CPPUNIT_ASSERT_DOUBLES_EQUAL_MESSAGE( "pose (y)", 0, 
fiducialProxy->fiducial_geom.pose.py, Delta );
+       CPPUNIT_ASSERT_DOUBLES_EQUAL_MESSAGE( "pose (z)", 0, 
fiducialProxy->fiducial_geom.pose.pz, Delta );
+       CPPUNIT_ASSERT_DOUBLES_EQUAL_MESSAGE( "pose (pitch)", 0, 
fiducialProxy->fiducial_geom.pose.ppitch, Delta );
+       CPPUNIT_ASSERT_DOUBLES_EQUAL_MESSAGE( "pose (roll)", 0, 
fiducialProxy->fiducial_geom.pose.proll, Delta );
+       CPPUNIT_ASSERT_DOUBLES_EQUAL_MESSAGE( "pose (yaw)", 0, 
fiducialProxy->fiducial_geom.pose.pyaw, Delta );
+}
+
+void Fiducial::testData() {
+       playerc_client_read( client );  
+       
+       // verify that we're getting new data
+       fiducialProxy->info.fresh = 0;
+       playerc_client_read( client );
+       CPPUNIT_ASSERT_MESSAGE( "fiducial updating", fiducialProxy->info.fresh 
== 1 );
+       
+       CPPUNIT_ASSERT( fiducialProxy->info.datatime > 0 );
+//     CPPUNIT_ASSERT_EQUAL_MESSAGE( "fiducials_count", 1, 
fiducialProxy->fiducials_count ); // lsp_test.world
+       
+       printf("\nfiducials_count: %d\n", fiducialProxy->fiducials_count );
+       for ( int i = 0; i < fiducialProxy->fiducials_count; i++ ) {
+//             CPPUNIT_ASSERT( fiducialProxy->fiducials[i].id == 2 );
+               printf( "fiducial return: %d @ [ %6.4f %6.4f %6.4f ]\n",
+                           fiducialProxy->fiducials[i].id,
+                           fiducialProxy->fiducials[i].pose.px,
+                           fiducialProxy->fiducials[i].pose.py,
+                           fiducialProxy->fiducials[i].pose.pyaw );
+       }
+}
\ No newline at end of file

Added: code/stage/trunk/libstageplugin/test/lsp_test_fiducial.hh
===================================================================
--- code/stage/trunk/libstageplugin/test/lsp_test_fiducial.hh                   
        (rev 0)
+++ code/stage/trunk/libstageplugin/test/lsp_test_fiducial.hh   2008-07-24 
00:03:46 UTC (rev 6919)
@@ -0,0 +1,33 @@
+#ifndef _LSP_FIDUCIAL_TEST_H_
+#define _LSP_FIDUCIAL_TEST_H_
+
+#include <cppunit/extensions/HelperMacros.h>
+#include <libplayerc/playerc.h>
+
+#include "lsp_test_proxy.hh"
+
+namespace lspTest {
+       class Fiducial : public Proxy
+               {
+                       CPPUNIT_TEST_SUITE( Fiducial );
+                       CPPUNIT_TEST( testGeom );
+                       CPPUNIT_TEST( testData );
+                       CPPUNIT_TEST_SUITE_END();
+                       
+               protected:
+                       playerc_fiducial_t* fiducialProxy;
+                       
+                       void testConfig();
+                       void testGeom();
+                       void testData();
+                       
+                       static const int Samples;
+               public:
+                       void setUp();
+                       void tearDown();
+               };
+};
+
+CPPUNIT_TEST_SUITE_REGISTRATION( lspTest::Fiducial );
+
+#endif
\ No newline at end of file

Modified: code/stage/trunk/libstageplugin/test/lsp_test_laser.cc
===================================================================
--- code/stage/trunk/libstageplugin/test/lsp_test_laser.cc      2008-07-24 
00:00:30 UTC (rev 6918)
+++ code/stage/trunk/libstageplugin/test/lsp_test_laser.cc      2008-07-24 
00:03:46 UTC (rev 6919)
@@ -42,8 +42,8 @@
 void Laser::testGeom() {
        CPPUNIT_ASSERT( playerc_laser_get_geom( laserProxy ) == 0 );
        
-       // values from lsp_test.cfg/world and sick.inc
-       CPPUNIT_ASSERT_DOUBLES_EQUAL_MESSAGE( "pose (x)", 0, 
laserProxy->pose[0], Delta );
+       // values from lsp_test.world and sick.inc
+       CPPUNIT_ASSERT_DOUBLES_EQUAL_MESSAGE( "pose (x)", 0.03, 
laserProxy->pose[0], Delta );
        CPPUNIT_ASSERT_DOUBLES_EQUAL_MESSAGE( "pose (y)", 0, 
laserProxy->pose[1], Delta );
        CPPUNIT_ASSERT_DOUBLES_EQUAL_MESSAGE( "pose (angle)", 0, 
laserProxy->pose[2], Delta );
        CPPUNIT_ASSERT_DOUBLES_EQUAL_MESSAGE( "size (x)", 0.156, 
laserProxy->size[0], Delta );

Modified: code/stage/trunk/libstageplugin/test/lsp_test_position2d.cc
===================================================================
--- code/stage/trunk/libstageplugin/test/lsp_test_position2d.cc 2008-07-24 
00:00:30 UTC (rev 6918)
+++ code/stage/trunk/libstageplugin/test/lsp_test_position2d.cc 2008-07-24 
00:03:46 UTC (rev 6919)
@@ -22,7 +22,7 @@
 void Position2D::testGeom() {
        CPPUNIT_ASSERT( playerc_position2d_get_geom( posProxy ) == 0 );
        
-       // values from lsp_test.cfg/world (pioneer2dx)
+       // values from pioneer.inc
        CPPUNIT_ASSERT_DOUBLES_EQUAL_MESSAGE( "geom pose (x)", -0.04, 
posProxy->pose[0], Delta );
        CPPUNIT_ASSERT_DOUBLES_EQUAL_MESSAGE( "geom pose (y)", 0, 
posProxy->pose[1], Delta );
        CPPUNIT_ASSERT_DOUBLES_EQUAL_MESSAGE( "geom pose (angle)", 0, 
posProxy->pose[2], Delta );

Modified: code/stage/trunk/libstageplugin/test/lsp_test_position2d.hh
===================================================================
--- code/stage/trunk/libstageplugin/test/lsp_test_position2d.hh 2008-07-24 
00:00:30 UTC (rev 6918)
+++ code/stage/trunk/libstageplugin/test/lsp_test_position2d.hh 2008-07-24 
00:03:46 UTC (rev 6919)
@@ -12,7 +12,7 @@
                CPPUNIT_TEST_SUB_SUITE( Position2D, Proxy );
                CPPUNIT_TEST( testGeom );
                CPPUNIT_TEST( testData );
-               CPPUNIT_TEST( testMove );
+//             CPPUNIT_TEST( testMove );
                CPPUNIT_TEST_SUITE_END();
                
        protected:

Modified: code/stage/trunk/worlds/lsp_test.cfg
===================================================================
--- code/stage/trunk/worlds/lsp_test.cfg        2008-07-24 00:00:30 UTC (rev 
6918)
+++ code/stage/trunk/worlds/lsp_test.cfg        2008-07-24 00:03:46 UTC (rev 
6919)
@@ -16,7 +16,7 @@
 driver
 ( 
   name "stage"
-  provides [ "position2d:0" "speech:0" "laser:0" "sonar:0" ]
+  provides [ "position2d:0" "speech:0" "laser:0" "sonar:0" "fiducial:0" ]
   model "r0" 
 )
 

Modified: code/stage/trunk/worlds/lsp_test.world
===================================================================
--- code/stage/trunk/worlds/lsp_test.world      2008-07-24 00:00:30 UTC (rev 
6918)
+++ code/stage/trunk/worlds/lsp_test.world      2008-07-24 00:03:46 UTC (rev 
6919)
@@ -26,13 +26,43 @@
   bitmap "bitmaps/cave.png"
 )
 
-pioneer2dx
+# extend the pioneer2dx definition from pioneer.inc
+#
+define trickedoutpioneer pioneer2dx
+(
+  ranger()
+
+  sicklaser( pose [ 0.03 0 0 0 ]  )
+
+  fiducial
+  (
+    pose [ -0.15 0 0 0 ]
+    range_max 8
+    range_max_id 5
+  ) 
+
+  blobfinder
+  ( 
+    channel_count 6 
+    channels [ "red" "blue" "green" "cyan" "yellow" "magenta" ]  
+  )
+    
+  localization "odom"
+  localization_origin [ 0 0 0 ]
+)
+
+trickedoutpioneer
 (                
-  # can refer to the robot by this name
   name "r0"
 
-  localization "odom"
+  fiducial_return 1
   pose [ -7.490 -7.490 0 45.000 ] 
-  sicklaser()
 )
 
+trickedoutpioneer
+(                
+  name "r1"
+
+  fiducial_return 2
+  pose [ -5.085 -7.193 0 144.304 ] 
+)


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