lsp_test_sonar.cc
Go to the documentation of this file.
1 #include "lsp_test_sonar.hh"
2 
3 using namespace lspTest;
4 
5 void Sonar::setUp() {
6  connect();
7  sonarProxy = playerc_sonar_create( client, 0 );
8  CPPUNIT_ASSERT( playerc_sonar_subscribe( sonarProxy, PLAYER_OPEN_MODE ) == 0 );
9 }
10 
11 
13  CPPUNIT_ASSERT( playerc_sonar_unsubscribe( sonarProxy ) == 0 );
14  playerc_sonar_destroy( sonarProxy );
15  disconnect();
16 }
17 
19  CPPUNIT_ASSERT( playerc_sonar_get_geom( sonarProxy ) == 0 );
20 
21  // values from pioneer.inc
22  CPPUNIT_ASSERT( sonarProxy->pose_count == 16 );
23  CPPUNIT_ASSERT_DOUBLES_EQUAL_MESSAGE( "pose[0] (x)", 0.075, sonarProxy->poses[0].px, Delta );
24  CPPUNIT_ASSERT_DOUBLES_EQUAL_MESSAGE( "pose[0] (y)", 0.130, sonarProxy->poses[0].py, Delta );
25  CPPUNIT_ASSERT_DOUBLES_EQUAL_MESSAGE( "pose[0] (z)", 0, sonarProxy->poses[0].pz, Delta ); // currently unused
26  CPPUNIT_ASSERT_DOUBLES_EQUAL_MESSAGE( "pose[0] (angle)", M_PI/2, sonarProxy->poses[0].pyaw, Delta );
27 }
28 
30  playerc_client_read( client );
31 
32  // verify that we're getting new data
33  sonarProxy->info.fresh = 0;
34  playerc_client_read( client );
35  CPPUNIT_ASSERT_MESSAGE( "sonar updating", sonarProxy->info.fresh == 1 );
36 
37  CPPUNIT_ASSERT( sonarProxy->info.datatime > 0 );
38  CPPUNIT_ASSERT( sonarProxy->scan_count == 16 ); // from pioneer.inc, actually sensor_count
39 
40  // sanity check
41  for ( int i = 0; i < sonarProxy->scan_count; i++ ) {
42  CPPUNIT_ASSERT( sonarProxy->scan[i] >= 0 );
43 // printf(" range[%d]: %6.3f ]\n", i, sonarProxy->scan[i]);
44  }
45 }
static const double Delta
playerc_client_t * client
playerc_sonar_t * sonarProxy


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 Mon Jun 10 2019 15:06:09