lsp_test_blobfinder.cc
Go to the documentation of this file.
1 #include "lsp_test_blobfinder.hh"
2 
3 using namespace lspTest;
4 
6  connect();
7  blobProxy = playerc_blobfinder_create( client, 0 );
8  CPPUNIT_ASSERT( playerc_blobfinder_subscribe( blobProxy, PLAYER_OPEN_MODE ) == 0 );
9 }
10 
11 
13  CPPUNIT_ASSERT( playerc_blobfinder_unsubscribe( blobProxy ) == 0 );
14  playerc_blobfinder_destroy( blobProxy );
15  disconnect();
16 }
17 
19  playerc_client_read( client );
20 
21  // verify that we're getting new data
22  blobProxy->info.fresh = 0;
23  playerc_client_read( client );
24  CPPUNIT_ASSERT_MESSAGE( "blobfinder updating", blobProxy->info.fresh == 1 );
25 
26  CPPUNIT_ASSERT( blobProxy->info.datatime > 0 );
27 
28  //printf("\ncolor0: 0x%X, color1: 0x%X\n", blobProxy->blobs[0].color, blobProxy->blobs[1].color);
29 
30  // check stage defaults
31  CPPUNIT_ASSERT( blobProxy->width == 80 );
32  CPPUNIT_ASSERT( blobProxy->height == 60 );
33 
34  // Make sure we see three blobs: wall, robot, wall
35  CPPUNIT_ASSERT_EQUAL_MESSAGE( "blobs_count", (unsigned int)3, blobProxy->blobs_count ); // lsp_test.world
36  // sanity checks
37  CPPUNIT_ASSERT( blobProxy->blobs[1].range > 0 );
38  CPPUNIT_ASSERT( blobProxy->blobs[1].area > 0 );
39  CPPUNIT_ASSERT( blobProxy->blobs[1].y > 0 );
40  CPPUNIT_ASSERT( blobProxy->blobs[1].left < blobProxy->blobs[1].right );
41  CPPUNIT_ASSERT( blobProxy->blobs[1].top < blobProxy->blobs[1].bottom );
42 
43  // robot should be red
44  CPPUNIT_ASSERT( blobProxy->blobs[1].color == 0xFFFF0000 );
45 
46  // robot should be closer
47  CPPUNIT_ASSERT( blobProxy->blobs[0].range > blobProxy->blobs[1].range );
48 
49  // robot should be towards the right
50  uint32_t robotCenter = blobProxy->blobs[1].x;
51  uint32_t imageCenter = blobProxy->width / 2;
52  //printf(" robotCenter: %d, imageCenter: %d\n", robotCenter, imageCenter);
53  CPPUNIT_ASSERT( robotCenter > imageCenter );
54 
55 
56 
57 // CPPUNIT_ASSERT_EQUAL_MESSAGE( "id", (unsigned int)2, blobProxy->blobs[0].id );
58 
59 }
playerc_blobfinder_t * blobProxy
playerc_client_t * client


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