lsp_test_sonar.cc
Go to the documentation of this file.
00001 #include "lsp_test_sonar.hh"
00002 
00003 using namespace lspTest;
00004 
00005 void Sonar::setUp() {
00006         connect();
00007         sonarProxy = playerc_sonar_create( client, 0 );
00008         CPPUNIT_ASSERT( playerc_sonar_subscribe( sonarProxy, PLAYER_OPEN_MODE ) == 0 );
00009 }
00010 
00011 
00012 void Sonar::tearDown() {
00013         CPPUNIT_ASSERT( playerc_sonar_unsubscribe( sonarProxy ) == 0 );
00014         playerc_sonar_destroy( sonarProxy );
00015         disconnect();
00016 }
00017 
00018 void Sonar::testGeom() {
00019         CPPUNIT_ASSERT( playerc_sonar_get_geom( sonarProxy ) == 0 );
00020         
00021         // values from pioneer.inc
00022         CPPUNIT_ASSERT( sonarProxy->pose_count == 16 );
00023         CPPUNIT_ASSERT_DOUBLES_EQUAL_MESSAGE( "pose[0] (x)", 0.075, sonarProxy->poses[0].px, Delta );
00024         CPPUNIT_ASSERT_DOUBLES_EQUAL_MESSAGE( "pose[0] (y)", 0.130, sonarProxy->poses[0].py, Delta );
00025         CPPUNIT_ASSERT_DOUBLES_EQUAL_MESSAGE( "pose[0] (z)", 0, sonarProxy->poses[0].pz, Delta ); // currently unused
00026         CPPUNIT_ASSERT_DOUBLES_EQUAL_MESSAGE( "pose[0] (angle)", M_PI/2, sonarProxy->poses[0].pyaw, Delta );
00027 }
00028 
00029 void Sonar::testData() {
00030         playerc_client_read( client );  
00031         
00032         // verify that we're getting new data
00033         sonarProxy->info.fresh = 0;
00034         playerc_client_read( client );
00035         CPPUNIT_ASSERT_MESSAGE( "sonar updating", sonarProxy->info.fresh == 1 );
00036         
00037         CPPUNIT_ASSERT( sonarProxy->info.datatime > 0 );
00038         CPPUNIT_ASSERT( sonarProxy->scan_count == 16 ); // from pioneer.inc, actually sensor_count
00039 
00040         // sanity check
00041         for ( int i = 0; i < sonarProxy->scan_count; i++ ) {
00042                 CPPUNIT_ASSERT( sonarProxy->scan[i] >= 0 );             
00043 //              printf(" range[%d]: %6.3f ]\n", i, sonarProxy->scan[i]);
00044         }
00045 }


stage
Author(s): Richard Vaughan , Brian Gerkey , Reed Hedges , Andrew Howard , Toby Collett , Pooya Karimian , Jeremy Asher , Alex Couture-Beil , Geoff Biggs , Rich Mattes , Abbas Sadat
autogenerated on Thu Aug 27 2015 15:20:57