Update of /cvsroot/playerstage/code/player/client_libs/libplayerc++/test
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2950

Modified Files:
        Makefile.am test.cc test.h test_audiodsp.cc test_audiomixer.cc 
        test_blinkenlight.cc test_blobfinder.cc test_bps.cc 
        test_bumper.cc test_dio.cc test_fiducialfinder.cc test_gps.cc 
        test_gripper.cc test_laser.cc test_lbd.cc test_localize.cc 
        test_log.cc test_lookup.cc test_mcom.cc test_misc.cc 
        test_motor.cc test_position.cc test_position2d.cc 
        test_position3d.cc test_position_control.cc test_power.cc 
        test_ptz.cc test_sonar.cc test_speech.cc test_truth.cc 
        test_vision.cc test_wifi.cc 
Added Files:
        test_actarray.cc test_gripper_holdsub.cc 
        test_position2d_holdsub.cc 
Log Message:
applied patch 1624654

Index: test_bumper.cc
===================================================================
RCS file: 
/cvsroot/playerstage/code/player/client_libs/libplayerc++/test/test_bumper.cc,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** test_bumper.cc      20 Sep 2005 13:17:08 -0000      1.1
--- test_bumper.cc      2 Feb 2007 17:12:04 -0000       1.2
***************
*** 5,9 ****
   */
  
- #include "playerclient.h"
  #include "test.h"
  #include <unistd.h>
--- 5,8 ----
***************
*** 12,30 ****
  test_bumper(PlayerClient* client, int index)
  {
!   unsigned char access;
!   BumperProxy sp(client,index,'c');
! 
!   printf("device [bumper] index [%d]\n", index);
! 
!   TEST("subscribing (read)");
!   if((sp.ChangeAccess(PLAYER_READ_MODE,&access) < 0) ||
!      (access != PLAYER_READ_MODE))
!   {
!     FAIL();
!     printf("DRIVER: %s\n", sp.driver_name);
!     return -1;
!   }
!   PASS();
!   printf("DRIVER: %s\n", sp.driver_name);
  
    // wait for P2OS to start up
--- 11,16 ----
  test_bumper(PlayerClient* client, int index)
  {
!   TEST("bumper");
!   BumperProxy sp(client,index);
  
    // wait for P2OS to start up
***************
*** 32,43 ****
      client->Read();
  
    TEST("getting bumper geometry");
  
    player_bumper_geom_t bumper_geom;
!   if(sp.GetBumperGeom( &bumper_geom ) < 0)
!   {
!     FAIL();
!     return(-1);
!   }
    sleep(1);
    PASS();
--- 18,26 ----
      client->Read();
  
+   /*
    TEST("getting bumper geometry");
  
    player_bumper_geom_t bumper_geom;
!   sp.GetBumperGeom( &bumper_geom );
    sleep(1);
    PASS();
***************
*** 52,55 ****
--- 35,39 ----
             bumper_geom.bumper_def[i].radius );
    }
+   */
  
    for(int t = 0; t < 3; t++)
***************
*** 57,80 ****
      TEST1("reading data (attempt %d)", t);
  
!     if(client->Read() < 0)
!     {
!       FAIL();
!       return(-1);
!     }
  
      PASS();
  
!     sp.Print();
    }
  
  
-   TEST("unsubscribing");
-   if((sp.ChangeAccess(PLAYER_CLOSE_MODE,&access) < 0) ||
-      (access != PLAYER_CLOSE_MODE))
-   {
-     FAIL();
-     return -1;
-   }
- 
    PASS();
  
--- 41,55 ----
      TEST1("reading data (attempt %d)", t);
  
!     client->Read();
  
      PASS();
  
!     std::cerr << sp << std::endl;
!     if(sp.IsAnyBumped()) {
!       std::cerr << "A bumper switch is pressed.\n";
!     }
    }
  
  
    PASS();
  

Index: test_lbd.cc
===================================================================
RCS file: 
/cvsroot/playerstage/code/player/client_libs/libplayerc++/test/test_lbd.cc,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** test_lbd.cc 20 Sep 2005 13:17:08 -0000      1.1
--- test_lbd.cc 2 Feb 2007 17:12:04 -0000       1.2
***************
*** 5,9 ****
   */
  
- #include "playerclient.h"
  #include "test.h"
  #include <unistd.h>
--- 5,8 ----

--- NEW FILE: test_position2d_holdsub.cc ---
/*
 * $Id: test_position2d_holdsub.cc,v 1.1 2007/02/02 17:12:04 gerkey Exp $
 *
 * a test for the C++ Position2DProxy
 */

#include "test.h"
#include <unistd.h>
#include <math.h>

using namespace PlayerCc;

int
test_position2d_holdsubscribe(PlayerClient* client, int index)
{
  TEST("position2d");
  Position2dProxy p2d(client,index);

  // wait for P2OS to start up
  for(int i=0;i<20;i++)
    client->Read();

  while(1)
  {
    client->Read();
    std::cerr << p2d << std::endl;
  }

  return -1;
}


                 

Index: test_log.cc
===================================================================
RCS file: 
/cvsroot/playerstage/code/player/client_libs/libplayerc++/test/test_log.cc,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** test_log.cc 20 Sep 2005 13:17:08 -0000      1.1
--- test_log.cc 2 Feb 2007 17:12:04 -0000       1.2
***************
*** 5,9 ****
   */
  
- #include "playerclient.h"
  #include "test.h"
  #include <unistd.h>
--- 5,8 ----

Index: test_mcom.cc
===================================================================
RCS file: 
/cvsroot/playerstage/code/player/client_libs/libplayerc++/test/test_mcom.cc,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** test_mcom.cc        20 Sep 2005 13:17:08 -0000      1.1
--- test_mcom.cc        2 Feb 2007 17:12:04 -0000       1.2
***************
*** 5,9 ****
   */
  
- #include "playerclient.h"
  #include "test.h"
  #include <unistd.h>
--- 5,8 ----

--- NEW FILE: test_gripper_holdsub.cc ---
/*
 * $Id: test_gripper_holdsub.cc,v 1.1 2007/02/02 17:12:04 gerkey Exp $
 *
 * a test for the C++ SonarProxy
 */

#include "test.h"
#include <unistd.h>

using namespace PlayerCc;

int
test_gripper_holdsubscribe(PlayerClient* client, int index)
{
  GripperProxy gp(client,index);

  // wait for P2OS to start up
  for(int i=0; i < 20; i++)
    client->Read();

  while(1)
  {
    client->Read();

    std::cerr << "got gripper data: " << std::endl << gp << std::endl;

  }

  return(-1);
}


                 

Index: test.h
===================================================================
RCS file: 
/cvsroot/playerstage/code/player/client_libs/libplayerc++/test/test.h,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -d -r1.6 -r1.7
*** test.h      11 Apr 2006 15:40:31 -0000      1.6
--- test.h      2 Feb 2007 17:12:04 -0000       1.7
***************
*** 60,63 ****
--- 60,67 ----
  int test_rfid(PlayerClient* client, int index);
  int test_wsn(PlayerClient* client, int index);
+ int test_position2d_holdsubscribe(PlayerClient* client, int index);
+ int test_gripper_holdsubscribe(PlayerClient* client, int index);
+ int test_actarray(PlayerClient* client, int index);
+ 
  //int test_bps(PlayerClient* client, int index);
  

Index: test_speech.cc
===================================================================
RCS file: 
/cvsroot/playerstage/code/player/client_libs/libplayerc++/test/test_speech.cc,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** test_speech.cc      20 Sep 2005 13:17:08 -0000      1.1
--- test_speech.cc      2 Feb 2007 17:12:04 -0000       1.2
***************
*** 5,9 ****
   */
  
- #include "playerclient.h"
  #include "test.h"
  #include <unistd.h>
--- 5,8 ----

Index: test.cc
===================================================================
RCS file: 
/cvsroot/playerstage/code/player/client_libs/libplayerc++/test/test.cc,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** test.cc     11 Apr 2006 15:40:31 -0000      1.5
--- test.cc     2 Feb 2007 17:12:04 -0000       1.6
***************
*** 51,54 ****
--- 51,75 ----
      else if(!strcmp(argv[i],"-stage"))
        use_stage = true;
+     else if(!strcmp(argv[i], "-help") || !strcmp(argv[i], "--help"))
+     {
+       puts("usage: test [-h <host>] [-p <port>] [-stage] [--all|<tests>]\n"\
+         "where <tests> is one or more of --<interface>[:<index>] (default 
index is 0).\n"
+         "Available interfaces to test are:\n"
+         "  rfid\n"\
+         "  wsn\n"\
+         "  power\n"\
+         "  dio\n"\
+         "  position2d\n"\
+         "  sonar\n"\
+         "  laser\n"\
+         "  ptz\n"\
+         "  gripper\n"\
+         "  camera\n"\
+         "  actarray\n"\
+         "  position2d-subscribe  (subscribe to position2d indefinitely)\n"\
+         "  gripper-subscribe     (subscribe to gripper indefinitely)\n"\
+         "");
+       exit(0);
+     }
    }
  
***************
*** 56,60 ****
    PlayerCc::PlayerClient client(host, port);
  
!   // Run the tests
    for (i = 1; i < argc; i++)
    {
--- 77,82 ----
    PlayerCc::PlayerClient client(host, port);
  
!   // Check each command line argument for the form --<interface>:<index>, and
!   // run the test for <interface> if recognized.
    for (i = 1; i < argc; i++)
    {
***************
*** 69,75 ****
  
  /*
!   // Test the ClientProxy and PlayerClient
  #ifdef HAVE_BOOST_SIGNALS
!   // we need both signals and threads
  #ifdef HAVE_BOOST_THREAD
      if(strcmp(device, "client") == 0 || strcmp(device, "all") == 0)
--- 91,97 ----
  
  /*
!     // Test the ClientProxy and PlayerClient
  #ifdef HAVE_BOOST_SIGNALS
!     // we need both signals and threads
  #ifdef HAVE_BOOST_THREAD
      if(strcmp(device, "client") == 0 || strcmp(device, "all") == 0)
***************
*** 79,209 ****
  */
  
!     // RFID device
!     if(strcmp(device, "rfid") == 0 || strcmp(device, "all") == 0)
!       test_rfid(&client, index);
!     // WSN device
!     if(strcmp(device, "wsn") == 0 || strcmp(device, "all") == 0)
!       test_wsn(&client, index);
! #if 0
!     // Power device - a simple one to start with
!     if(strcmp(device, "power") == 0 || strcmp(device, "all") == 0)
!       test_power(&client, index);
  
!     // DIO device
!     if(strcmp(device, "dio") == 0 || strcmp(device, "all") == 0)
!       test_dio(&client, index);
  
!     // Position device
!     if (strcmp(device, "motor") == 0 || strcmp(device, "all") == 0)
!       test_motor(&client, index);
!     if (strcmp(device, "position") == 0 || strcmp(device, "all") == 0)
!       test_position(&client, index);
!     if (strcmp(device, "position2d") == 0 || strcmp(device, "all") == 0)
!       test_position2d(&client, index);
!     if (strcmp(device, "position3d") == 0 || strcmp(device, "all") == 0)
!       test_position3d(&client, index);
!     // Position device - position control mode
!     // not many robots support this mode but Stage's position model does.
!     if (strcmp(device, "position_control") == 0 || strcmp(device, "all") == 0)
!       test_position_control(&client, index);
  
!     // Sonar device
!     if(strcmp(device, "sonar") == 0 || strcmp(device, "all") == 0)
!       test_sonar(&client, index);
  
!     // Name lookup
!     if(strcmp(device, "lookup") == 0 || strcmp(device, "all") == 0)
!       test_lookup(&client, index);
  
!     // Blobfinder device
!     if(strcmp(device, "blobfinder") == 0 || strcmp(device, "all") == 0)
!       test_blobfinder(&client, index);
  
!     // Laser device
!     if(strcmp(device, "laser") == 0 || strcmp(device, "all") == 0)
!       test_laser(&client, index);
  
!     // Fiducial finder device
!     if(strcmp(device, "fiducial") == 0 || strcmp(device, "all") == 0)
!       test_fiducial(&client, index);
  
!     // PTZ device
!     if(strcmp(device, "ptz") == 0 || strcmp(device, "all") == 0)
!       test_ptz(&client, index);
  
!     // Speech device
!     if(strcmp(device, "speech") == 0 || strcmp(device, "all") == 0)
!       test_speech(&client, index);
  
!     // Vision device
!     if(strcmp(device, "vision") == 0 || strcmp(device, "all") == 0)
!       test_vision(&client, index);
  
  
!     // GPS device
!     if(strcmp(device, "gps") == 0 || strcmp(device, "all") == 0)
!       test_gps(&client, index);
  
!     // Gripper device
!     if(strcmp(device, "gripper") == 0 || strcmp(device, "all") == 0)
!       test_gripper(&client, index);
  
!     // Ground truth device
!     if(strcmp(device, "truth") == 0 || strcmp(device, "all") == 0)
!       test_truth(&client, index);
  
!     // Laserbeacon device
!     if(strcmp(device, "laserbeacon") == 0 || strcmp(device, "all") == 0)
!       test_lbd(&client, index);
  
!     // Bumper
!     if(strcmp(device, "bumper") == 0 || strcmp(device, "all") == 0)
!       test_bumper(&client, index);
  
!     // WiFi
!     if(strcmp(device, "wifi") == 0 || strcmp(device, "all") == 0)
!       test_wifi(&client, index);
  
!     if(strcmp(device, "log") == 0 || strcmp(device, "all") == 0)
!       test_log(&client, index);
  
!     if(strcmp(device, "mcom") == 0 || strcmp(device, "all") == 0)
!       test_mcom(&client, index);
  
!     if(strcmp(device, "localize") == 0 || strcmp(device, "all") == 0)
!       test_localize(&client, index);
  
!     if(strcmp(device, "audiodsp") == 0 || strcmp(device, "all") == 0)
!       test_audiodsp(&client, index);
  
!     if(strcmp(device, "audiomixer") == 0 || strcmp(device, "all") == 0)
!       test_audiomixer(&client, index);
  
!     if(strcmp(device, "blinkenlight") == 0 || strcmp(device, "all") == 0)
!       test_blinkenlight(&client, index);
! #endif
  
!     if(strcmp(device, "camera") == 0 || strcmp(device, "all") == 0)
!       test_camera(&client, index);
  
! #if 0
!     // BPS device
!     /*
!     if(strcmp(device, "bps") == 0 || strcmp(device, "all") == 0)
!       test_bps(&client, index);
!      */
  
!     /*
!     // IDAR device
!     if(strcmp(device, "idar") == 0 || strcmp(device, "all") == 0)
!       test_idar(&client, index);
  
-     // IDAR turret device
-     if(strcmp(device, "idarturret") == 0 || strcmp(device, "all") == 0)
-       test_idarturret(&client, index);
-       */
- #endif
      free(arg);
!   }
  
    return 0;
--- 101,240 ----
  */
  
!     try {
!       if(strcmp(device, "rfid") == 0 || strcmp(device, "all") == 0)
!         test_rfid(&client, index);
!       if(strcmp(device, "wsn") == 0 || strcmp(device, "all") == 0)
!         test_wsn(&client, index);
!       if(strcmp(device, "power") == 0 || strcmp(device, "all") == 0)
!         test_power(&client, index);
!       if(strcmp(device, "dio") == 0 || strcmp(device, "all") == 0)
!         test_dio(&client, index);
!       /*
!       if (strcmp(device, "motor") == 0 || strcmp(device, "all") == 0)
!         test_motor(&client, index);
!       if (strcmp(device, "position") == 0 || strcmp(device, "all") == 0)
!         test_position(&client, index);
!       */
!       if (strcmp(device, "position2d") == 0 || strcmp(device, "all") == 0)
!         test_position2d(&client, index);
!       if (strcmp(device, "position2d-subscribe") == 0)
!         test_position2d_holdsubscribe(&client, index);
!       /*
!       if (strcmp(device, "position3d") == 0 || strcmp(device, "all") == 0)
!         test_position3d(&client, index);
!       // Position device - position control mode
!       // not many robots support this mode but Stage's position model does.
!       if (strcmp(device, "position_control") == 0 || strcmp(device, "all") == 
0)
!         test_position_control(&client, index);
!       */
  
!       if(strcmp(device, "sonar") == 0 || strcmp(device, "all") == 0)
!         test_sonar(&client, index);
  
!       /*
!       if(strcmp(device, "lookup") == 0 || strcmp(device, "all") == 0)
!         test_lookup(&client, index);
!       */
  
!       /*
!       if(strcmp(device, "blobfinder") == 0 || strcmp(device, "all") == 0)
!         test_blobfinder(&client, index);
!       */
  
!       if(strcmp(device, "laser") == 0 || strcmp(device, "all") == 0)
!         test_laser(&client, index);
  
!       /*
!       if(strcmp(device, "fiducial") == 0 || strcmp(device, "all") == 0)
!         test_fiducial(&client, index);
!       */
  
!       if(strcmp(device, "ptz") == 0 || strcmp(device, "all") == 0)
!         test_ptz(&client, index);
  
!       /*
!       if(strcmp(device, "speech") == 0 || strcmp(device, "all") == 0)
!         test_speech(&client, index);
  
!       if(strcmp(device, "vision") == 0 || strcmp(device, "all") == 0)
!         test_vision(&client, index);
!       */
  
!       /*
!       if(strcmp(device, "gps") == 0 || strcmp(device, "all") == 0)
!         test_gps(&client, index);
!       */
  
!       if(strcmp(device, "gripper") == 0 || strcmp(device, "all") == 0)
!         test_gripper(&client, index);
!       if(strcmp(device, "gripper-subscribe") == 0)
!         test_gripper_holdsubscribe(&client, index);
  
+       /*
+       if(strcmp(device, "truth") == 0 || strcmp(device, "all") == 0)
+         test_truth(&client, index);
+       */
  
!       /*
!       if(strcmp(device, "laserbeacon") == 0 || strcmp(device, "all") == 0)
!         test_lbd(&client, index);
!       */
  
!       if(strcmp(device, "bumper") == 0 || strcmp(device, "all") == 0)
!         test_bumper(&client, index);
  
!       /*
!       if(strcmp(device, "wifi") == 0 || strcmp(device, "all") == 0)
!         test_wifi(&client, index);
!       */
  
!       /*
!       if(strcmp(device, "log") == 0 || strcmp(device, "all") == 0)
!         test_log(&client, index);
!       */
  
!       /*
!       if(strcmp(device, "mcom") == 0 || strcmp(device, "all") == 0)
!         test_mcom(&client, index);
  
!       if(strcmp(device, "localize") == 0 || strcmp(device, "all") == 0)
!         test_localize(&client, index);
  
!       if(strcmp(device, "audiodsp") == 0 || strcmp(device, "all") == 0)
!         test_audiodsp(&client, index);
  
!       if(strcmp(device, "audiomixer") == 0 || strcmp(device, "all") == 0)
!         test_audiomixer(&client, index);
  
!       if(strcmp(device, "blinkenlight") == 0 || strcmp(device, "all") == 0)
!         test_blinkenlight(&client, index);
!       */
  
!       if(strcmp(device, "camera") == 0 || strcmp(device, "all") == 0)
!         test_camera(&client, index);
  
!       /*
!       if(strcmp(device, "bps") == 0 || strcmp(device, "all") == 0)
!         test_bps(&client, index);
!        */
  
!       /*
!       if(strcmp(device, "idar") == 0 || strcmp(device, "all") == 0)
!         test_idar(&client, index);
  
!       if(strcmp(device, "idarturret") == 0 || strcmp(device, "all") == 0)
!         test_idarturret(&client, index);
!       */
  
!       if(strcmp(device, "actarray") == 0 || strcmp(device, "all") == 0)
!         test_actarray(&client, index);
  
!     } catch(std::exception& e) {
!       FAIL();
!       std::cerr << "Caught exception: " << e.what() << std::endl;
!     }
  
      free(arg);
!   } 
  
    return 0;

Index: test_wifi.cc
===================================================================
RCS file: 
/cvsroot/playerstage/code/player/client_libs/libplayerc++/test/test_wifi.cc,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** test_wifi.cc        20 Sep 2005 13:17:08 -0000      1.1
--- test_wifi.cc        2 Feb 2007 17:12:04 -0000       1.2
***************
*** 5,9 ****
   */
  
- #include "playerclient.h"
  #include "test.h"
  #include <unistd.h>
--- 5,8 ----

Index: test_position.cc
===================================================================
RCS file: 
/cvsroot/playerstage/code/player/client_libs/libplayerc++/test/test_position.cc,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** test_position.cc    20 Sep 2005 13:17:08 -0000      1.1
--- test_position.cc    2 Feb 2007 17:12:04 -0000       1.2
***************
*** 5,9 ****
   */
  
- #include "playerclient.h"
  #include "test.h"
  #include <unistd.h>
--- 5,8 ----

Index: Makefile.am
===================================================================
RCS file: 
/cvsroot/playerstage/code/player/client_libs/libplayerc++/test/Makefile.am,v
retrieving revision 1.15
retrieving revision 1.16
diff -C2 -d -r1.15 -r1.16
*** Makefile.am 11 Apr 2006 15:40:31 -0000      1.15
--- Makefile.am 2 Feb 2007 17:12:04 -0000       1.16
***************
*** 27,64 ****
                 test.h \
                 test_camera.cc \
!              test_rfid.cc \
!              test_wsn.cc
! 
! #               test_gps.cc \
!                test_blobfinder.cc \
                 test_gripper.cc \
                 test_laser.cc \
-                test_lbd.cc \
-                test_motor.cc \
-                test_position.cc \
                 test_position2d.cc \
-                test_position3d.cc \
-                test_position_control.cc \
                 test_ptz.cc \
                 test_sonar.cc \
-                test_speech.cc \
-                test_truth.cc \
-                test_vision.cc \
                 test_power.cc \
                 test_dio.cc \
                 test_bumper.cc \
!                test_wifi.cc \
!                test_log.cc \
!                test_mcom.cc \
!                test_fiducialfinder.cc \
!                test_lookup.cc \
!                test_audiodsp.cc \
!                test_localize.cc \
!                test_audiomixer.cc \
!                test_blinkenlight.cc
  
-                #test_idar.cc \
-                #test_idarturret.cc
-                #test_misc.cc
-                #test_bps.cc
  
--- 27,67 ----
                 test.h \
                 test_camera.cc \
!                                                        test_rfid.cc \
!                                                        test_wsn.cc \
                 test_gripper.cc \
                 test_laser.cc \
                 test_position2d.cc \
                 test_ptz.cc \
                 test_sonar.cc \
                 test_power.cc \
                 test_dio.cc \
                 test_bumper.cc \
!                                                        
test_position2d_holdsub.cc \
!                                                        
test_gripper_holdsub.cc \
!                                                        test_actarray.cc
  
  
+ # These tests are broken and need to be fixed or removed:
+ #test_wifi.cc 
+ #test_log.cc 
+ #test_lbd.cc 
+ #test_fiducialfinder.cc 
+ #test_blobfinder.cc 
+ #test_gps.cc
+ #test_idar.cc
+ #test_idarturret.cc
+ #test_misc.cc
+ #test_bps.cc
+ #test_motor.cc 
+ #test_position.cc 
+ #test_position3d.cc 
+ #test_speech.cc 
+ #test_truth.cc 
+ #test_vision.cc 
+ #test_position_control.cc 
+ #test_mcom.cc 
+ #test_lookup.cc 
+ #test_audiodsp.cc 
+ #test_localize.cc 
+ #test_audiomixer.cc 
+ #test_blinkenlight.cc

Index: test_gps.cc
===================================================================
RCS file: 
/cvsroot/playerstage/code/player/client_libs/libplayerc++/test/test_gps.cc,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** test_gps.cc 20 Sep 2005 13:17:08 -0000      1.1
--- test_gps.cc 2 Feb 2007 17:12:04 -0000       1.2
***************
*** 5,9 ****
   */
  
- #include "playerclient.h"
  #include "test.h"
  
--- 5,8 ----

Index: test_position3d.cc
===================================================================
RCS file: 
/cvsroot/playerstage/code/player/client_libs/libplayerc++/test/test_position3d.cc,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** test_position3d.cc  20 Sep 2005 13:17:08 -0000      1.1
--- test_position3d.cc  2 Feb 2007 17:12:04 -0000       1.2
***************
*** 5,9 ****
   */
  
- #include "playerclient.h"
  #include "test.h"
  #include <unistd.h>
--- 5,8 ----

Index: test_audiomixer.cc
===================================================================
RCS file: 
/cvsroot/playerstage/code/player/client_libs/libplayerc++/test/test_audiomixer.cc,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** test_audiomixer.cc  20 Sep 2005 13:17:08 -0000      1.1
--- test_audiomixer.cc  2 Feb 2007 17:12:04 -0000       1.2
***************
*** 1,4 ****
  
- #include "playerclient.h"
  #include "test.h"
  #include <unistd.h>
--- 1,3 ----

Index: test_sonar.cc
===================================================================
RCS file: 
/cvsroot/playerstage/code/player/client_libs/libplayerc++/test/test_sonar.cc,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** test_sonar.cc       20 Sep 2005 13:17:08 -0000      1.1
--- test_sonar.cc       2 Feb 2007 17:12:04 -0000       1.2
***************
*** 5,9 ****
   */
  
- #include "playerclient.h"
  #include "test.h"
  #include <unistd.h>
--- 5,8 ----
***************
*** 12,43 ****
  test_sonar(PlayerClient* client, int index)
  {
!   unsigned char access;
!   SonarProxy sp(client,index,'c');
! 
!   printf("device [sonar] index [%d]\n", index);
  
!   TEST("subscribing (read)");
!   if((sp.ChangeAccess(PLAYER_READ_MODE,&access) < 0) ||
!      (access != PLAYER_READ_MODE))
    {
!     FAIL();
!     printf("DRIVER: %s\n", sp.driver_name);
!     return -1;
    }
-   PASS();
-   printf("DRIVER: %s\n", sp.driver_name);
  
!   // wait for P2OS to start up
!   for(int i=0; i < 20; i++)
!     client->Read();
  
!   TEST("getting sonar geometry");
!   if(sp.GetSonarGeom() < 0)
!   {
!     FAIL();
!     return(-1);
!   }
!   sleep(1);
!   PASS();
    for(int i=0;i<sp.pose_count;i++)
    {
--- 11,26 ----
  test_sonar(PlayerClient* client, int index)
  {
!   TEST("sonar");
!   SonarProxy sp(client,index);
  
!   // wait for P2OS to start up, throwing away data as fast as possible
!   for(int i=0; i < 60; i++)
    {
!     client->Read();
    }
  
!   sp.RequestGeom();
  
!   /*
    for(int i=0;i<sp.pose_count;i++)
    {
***************
*** 47,50 ****
--- 30,36 ----
             RTOD(sp.poses[i][2]));
    }
+   */
+ 
+   std::cout << "There are " << sp.GetCount() << " sonar sensors.\n";
  
    for(int t = 0; t < 3; t++)
***************
*** 52,96 ****
      TEST1("reading data (attempt %d)", t);
  
!     if(client->Read() < 0)
!     {
!       FAIL();
!       return(-1);
!     }
  
      PASS();
  
-     sp.Print();
-   }
- 
-   TEST("disabling sonars");
-   if(sp.SetSonarState(0) < 0)
-   {
-     FAIL();
-     return(-1);
-   }
-   sleep(1);
-   PASS();
- 
-   TEST("enabling sonars");
-   if(sp.SetSonarState(1) < 0)
-   {
-     FAIL();
-     return(-1);
-   }
-   sleep(1);
-   PASS();
- 
- 
-   TEST("unsubscribing");
-   if((sp.ChangeAccess(PLAYER_CLOSE_MODE,&access) < 0) ||
-      (access != PLAYER_CLOSE_MODE))
-   {
-     FAIL();
-     return -1;
    }
  
    PASS();
! 
!   return(0);
  }
  
--- 38,50 ----
      TEST1("reading data (attempt %d)", t);
  
!     client->Read();
  
      PASS();
+     std::cout << sp << std::endl;
  
    }
  
    PASS();
!   return 0;
  }
  

Index: test_localize.cc
===================================================================
RCS file: 
/cvsroot/playerstage/code/player/client_libs/libplayerc++/test/test_localize.cc,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** test_localize.cc    20 Sep 2005 13:17:08 -0000      1.1
--- test_localize.cc    2 Feb 2007 17:12:04 -0000       1.2
***************
*** 5,9 ****
   */
  
- #include "playerclient.h"
  #include "test.h"
  #include <unistd.h>
--- 5,8 ----

Index: test_lookup.cc
===================================================================
RCS file: 
/cvsroot/playerstage/code/player/client_libs/libplayerc++/test/test_lookup.cc,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** test_lookup.cc      20 Sep 2005 13:17:08 -0000      1.1
--- test_lookup.cc      2 Feb 2007 17:12:04 -0000       1.2
***************
*** 5,9 ****
   */
  
- #include "playerclient.h"
  #include "test.h"
  
--- 5,8 ----

Index: test_misc.cc
===================================================================
RCS file: 
/cvsroot/playerstage/code/player/client_libs/libplayerc++/test/test_misc.cc,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** test_misc.cc        20 Sep 2005 13:17:08 -0000      1.1
--- test_misc.cc        2 Feb 2007 17:12:04 -0000       1.2
***************
*** 5,9 ****
   */
  
- #include "playerclient.h"
  #include "test.h"
  #include <unistd.h>
--- 5,8 ----

Index: test_dio.cc
===================================================================
RCS file: 
/cvsroot/playerstage/code/player/client_libs/libplayerc++/test/test_dio.cc,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** test_dio.cc 20 Sep 2005 13:17:08 -0000      1.1
--- test_dio.cc 2 Feb 2007 17:12:04 -0000       1.2
***************
*** 5,30 ****
   */
  
- #include "playerclient.h"
  #include "test.h"
  #include <unistd.h>
  
  int
  test_dio(PlayerClient* client, int index)
  {
!   unsigned char access;
!   DIOProxy dp(client,index,'c');
! 
!   printf("device [dio] index [%d]\n", index);
! 
!   TEST("subscribing (read)");
!   if((dp.ChangeAccess(PLAYER_READ_MODE,&access) < 0) ||
!      (access != PLAYER_READ_MODE))
!   {
!     FAIL();
!     printf("DRIVER: %s\n", dp.driver_name);
!     return -1;
!   }
!   PASS();
!   printf("DRIVER: %s\n", dp.driver_name);
  
    for(int t = 0; t < 3; t++)
--- 5,18 ----
   */
  
  #include "test.h"
  #include <unistd.h>
  
+ using namespace PlayerCc;
+ 
  int
  test_dio(PlayerClient* client, int index)
  {
!   TEST("dio");
!   DioProxy dp(client,index);
  
    for(int t = 0; t < 3; t++)
***************
*** 32,52 ****
      TEST1("reading data (attempt %d)", t);
  
!     if(client->Read() < 0)
!     {
!       FAIL();
!       return(-1);
!     }
  
      PASS();
  
!     dp.Print();
!   }
! 
!   TEST("unsubscribing");
!   if((dp.ChangeAccess(PLAYER_CLOSE_MODE,&access) < 0) ||
!      (access != PLAYER_CLOSE_MODE))
!   {
!     FAIL();
!     return -1;
    }
  
--- 20,28 ----
      TEST1("reading data (attempt %d)", t);
  
!     client->Read();
  
      PASS();
  
!     std::cerr << dp << std::endl;
    }
  

Index: test_position2d.cc
===================================================================
RCS file: 
/cvsroot/playerstage/code/player/client_libs/libplayerc++/test/test_position2d.cc,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** test_position2d.cc  20 Sep 2005 13:17:08 -0000      1.1
--- test_position2d.cc  2 Feb 2007 17:12:04 -0000       1.2
***************
*** 5,33 ****
   */
  
- #include "playerclient.h"
  #include "test.h"
  #include <unistd.h>
  #include <math.h>
  
  int
  test_position2d(PlayerClient* client, int index)
  {
!   unsigned char access;
!   Position2DProxy p2d(client,index,'c');
! 
!   printf("device [position] index [%d]\n", index);
! 
!   TEST("subscribing (read/write)");
!   if((p2d.ChangeAccess(PLAYER_ALL_MODE,&access) < 0) ||
!      (access != PLAYER_ALL_MODE))
!   {
!     FAIL();
!     printf("DRIVER: %s\n", p2d.driver_name);
!     printf("access:%d\n", access);
!     return -1;
!   }
!   PASS();
! 
!   printf("DRIVER: %s\n", p2d.driver_name);
  
    // wait for P2OS to start up
--- 5,19 ----
   */
  
  #include "test.h"
  #include <unistd.h>
  #include <math.h>
  
+ using namespace PlayerCc;
+ 
  int
  test_position2d(PlayerClient* client, int index)
  {
!   TEST("position2d");
!   Position2dProxy p2d(client,index);
  
    // wait for P2OS to start up
***************
*** 39,51 ****
      TEST1("reading data (attempt %d)", t);
  
!     if(client->Read() < 0)
!     {
!       FAIL();
!       return(-1);
!     }
  
      PASS();
  
!     p2d.Print();
    }
  
--- 25,33 ----
      TEST1("reading data (attempt %d)", t);
  
!     client->Read();
  
      PASS();
  
!     std::cerr << p2d << std::endl;
    }
  
***************
*** 54,105 ****
    
    TEST("Setting odometry" );
!   if( p2d.SetOdometry(ox, oy, DTOR((double)oa)) < 0 )
!     {
!       FAIL();
!       //return(-1);
!     }
!   else
!     {
!       printf("\n - initial \t[%.3f %.3f %.3f]\n"
!            " - requested \t[%.3f %.3f %.3f]\n", 
!            p2d.Xpos(), p2d.Ypos(), RTOD(p2d.Yaw()), 
!            ox, oy, (double)oa);
!       
!       
!       for( int s=0; s<10; s++ )
!       {
!         client->Read();
!         printf( " - reading \t[%.3f %.3f %.3f]\r", 
!                 p2d.Xpos(), p2d.Ypos(), RTOD(p2d.Yaw()) );
!         fflush(stdout);
!       }
    
-       puts("");
-       
-       if((p2d.Xpos() != ox) || 
-          (p2d.Ypos() != oy) || 
-          ((int)rint(RTOD(p2d.Yaw())) != oa))
-       {
-         FAIL();
-         //return(-1);
-       }
-       else
-       PASS();
-     }
    
!   TEST("resetting odometry");
!   if(p2d.ResetOdometry() < 0)
    {
!     FAIL();
!     //return(-1);
    }
-   else
-     {
-       sleep(1);
-       PASS();
-     }
  
!   TEST("enabling motors");
!   if(p2d.SetMotorState(1) < 0)
    {
      FAIL();
--- 36,60 ----
    
    TEST("Setting odometry" );
!   p2d.SetOdometry(ox, oy, DTOR((double)oa));
! 
!   printf("\n - initial \t[%.3f %.3f %.3f]\n"
!    " - requested \t[%.3f %.3f %.3f]\n", 
!    p2d.GetXPos(), p2d.GetYPos(), RTOD(p2d.GetYaw()), 
!    ox, oy, (double)oa);
    
    
!   for( int s=0; s<10; s++ )
    {
!     client->Read();
!     printf( " - reading \t[%.3f %.3f %.3f]\r", 
!       p2d.GetXPos(), p2d.GetYPos(), RTOD(p2d.GetYaw()) );
!     fflush(stdout);
    }
  
!   puts("");
!   
!   if((p2d.GetXPos() != ox) || 
!      (p2d.GetYPos() != oy) || 
!      ((int)rint(RTOD(p2d.GetYaw())) != oa))
    {
      FAIL();
***************
*** 107,281 ****
    }
    else
      PASS();
  
    TEST("moving forward");
!   if(p2d.SetSpeed(0.1,0) < 0)
!     {
!       FAIL();
!       //return(-1);
!     }
!   else
!     {
!       sleep(3);
!       PASS();
!     }
    
    TEST("moving backward");
!   if(p2d.SetSpeed(-0.1,0) < 0)
!     {
!       FAIL();
!       //return(-1);
!     }
!   else
!     {
!       sleep(3);
!       PASS();
!     }
    
    TEST("moving left");
!   if(p2d.SetSpeed(0,0.1,0) < 0)
!     {
!       FAIL();
!       //return(-1);
!     }
!   else
!     {
!       sleep(3);
!       PASS();
!     }
    
    TEST("moving right");
!   if(p2d.SetSpeed(0,-0.1,0) < 0)
!     {
!       FAIL();
!       //return(-1);
!     }
!   else
!     {
!       sleep(3);
!       PASS();
!     }
    
    TEST("turning right");
!   if(p2d.SetSpeed(0,DTOR(-25.0)) < 0)
!     {
!       FAIL();
!       //return(-1);
!     }
!   else
!     {
!       sleep(3);
!       PASS();
!     }
  
    TEST("turning left");
!   if(p2d.SetSpeed(0,DTOR(25.0)) < 0)
!     {
!       FAIL();
!       //return(-1);
!     }
!   else
!     {
!       sleep(3);
!       PASS();
!     }
  
    TEST("moving left and anticlockwise (testing omnidrive)");
!   if( p2d.SetSpeed( 0, 0.1, DTOR(45.0) ) < 0 )
!     {
!       FAIL();
!       //return(-1);
!     }
!   else
!     {
!       sleep(3);
!       PASS();
!     }
    
    
    TEST("moving right and clockwise (testing omnidrive)");
!   if( p2d.SetSpeed( 0, -0.1, DTOR(-45) ) < 0 )
!     {
!       FAIL();
!       //return(-1);
!     }
!   else
!     {
!       sleep(3);
!       PASS();
!     }
    
    TEST("stopping");
!   if(p2d.SetSpeed(0,0) < 0)
!     {
!       FAIL();
!       //return(-1);
!     }
!   else
!     {
!       sleep(3);
!       PASS();
!     }
  
  
    TEST("disabling motors");
!   if(p2d.SetMotorState(0) < 0)
!   {
!     FAIL();
!     //return(-1);
!   }
!   else
!     {
!       sleep(1);
!       PASS();
!     }
    
    TEST("changing to separate velocity control");
!   if(p2d.SelectVelocityControl(1) < 0)
!   {
!     FAIL();
!     //return(-1);
!   }
!   else
!     { 
!       sleep(1);
!       PASS();
!     }
    
    TEST("changing to direct wheel velocity control");
!   if(p2d.SelectVelocityControl(0) < 0)
!   {
!     FAIL();
!     //return(-1);
!   }
!   else
!     {
        sleep(1);
        PASS();
!     }
    
    TEST("resetting odometry");
!   if(p2d.ResetOdometry() < 0)
!     {
!       FAIL();
!       //return(-1);
!     }
!   else
!     {
        sleep(1);
        PASS();
!     }
    
-   TEST("unsubscribing");
-   if((p2d.ChangeAccess(PLAYER_CLOSE_MODE,&access) < 0) ||
-      (access != PLAYER_CLOSE_MODE))
-     {
-       FAIL();
-       return -1;
-     }
- 
    PASS();
!   
!   return(0);
  }
  
--- 62,150 ----
    }
    else
+   {
      PASS();
+   }
+ 
+   TEST("resetting odometry");
+   p2d.ResetOdometry();
+   sleep(1);
+   PASS();
+ 
+   TEST("enabling motors");
+   p2d.SetMotorEnable(1);
+   PASS();
  
    TEST("moving forward");
!   p2d.SetSpeed(0.1,0);
!   sleep(3);
!   PASS();
    
    TEST("moving backward");
!   p2d.SetSpeed(-0.1,0);
!   sleep(3);
!   PASS();
    
    TEST("moving left");
!   p2d.SetSpeed(0,0.1,0);
!   sleep(3);
!   PASS();
    
    TEST("moving right");
!   p2d.SetSpeed(0,-0.1,0);
!   sleep(3);
!   PASS();
    
    TEST("turning right");
!   p2d.SetSpeed(0,DTOR(-25.0));
!   sleep(3);
!   PASS();
  
    TEST("turning left");
!   p2d.SetSpeed(0,DTOR(25.0));
!   sleep(3);
!   PASS();
  
    TEST("moving left and anticlockwise (testing omnidrive)");
!   p2d.SetSpeed( 0, 0.1, DTOR(45.0) );
!   sleep(3);
!   PASS();
    
    
    TEST("moving right and clockwise (testing omnidrive)");
!   p2d.SetSpeed( 0, -0.1, DTOR(-45) );
!   sleep(3);
!   PASS();
    
    TEST("stopping");
!   p2d.SetSpeed(0,0);
!   sleep(3);
!   PASS();
  
  
    TEST("disabling motors");
!   p2d.SetMotorEnable(0);
!   sleep(1);
!   PASS();
    
+   /*
    TEST("changing to separate velocity control");
!   p2d.SelectVelocityControl(1);
!   sleep(1);
!   PASS();
    
    TEST("changing to direct wheel velocity control");
!   p2d.SelectVelocityControl(0);
        sleep(1);
        PASS();
!   */
    
    TEST("resetting odometry");
!   p2d.ResetOdometry();
        sleep(1);
        PASS();
!     
    
    PASS();
!   return 0;
  }
  

Index: test_laser.cc
===================================================================
RCS file: 
/cvsroot/playerstage/code/player/client_libs/libplayerc++/test/test_laser.cc,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** test_laser.cc       20 Sep 2005 13:17:08 -0000      1.1
--- test_laser.cc       2 Feb 2007 17:12:04 -0000       1.2
***************
*** 5,9 ****
   */
  
- #include "playerclient.h"
  #include "test.h"
  #include <unistd.h>
--- 5,8 ----
***************
*** 15,35 ****
  test_laser(PlayerClient* client, int index)
  {
!   unsigned char access;
!   LaserProxy lp(client,index,'c');
!   int min, max;
!   int resolution, intensity, range_res;
! 
!   printf("device [laser] index [%d]\n", index);
! 
!   TEST("subscribing (read)");
!   if((lp.ChangeAccess(PLAYER_READ_MODE,&access) < 0) ||
!      (access != PLAYER_READ_MODE))
!   {
!     FAIL();
!     printf("DRIVER: %s\n", lp.driver_name);
!     return -1;
!   }
!   PASS();
!   printf("DRIVER: %s\n", lp.driver_name);
  
    // wait for the laser to warm up
--- 14,19 ----
  test_laser(PlayerClient* client, int index)
  {
!   TEST("laser");
!   LaserProxy lp(client,index);
  
    // wait for the laser to warm up
***************
*** 38,74 ****
  
    TEST("set configuration");
!   min = -90;
!   max = +90;
!   resolution = 100;
!   range_res = 1;
!   intensity = 1;
!   if(lp.Configure(DTOR(min), DTOR(max), resolution, range_res, intensity) >= 
0)
!     PASS();
!   else
!   {
!     FAIL();
!     return(-1);
!   }
  
    TEST("get configuration");
!   if(lp.GetConfigure() == 0)
!     PASS();
!   else
!   {
!     FAIL();
!     return(-1);
!   }
    
-   lp.PrintConfig();
- 
    TEST("check configuration sanity");
!   if((((int)rint(RTOD(lp.min_angle))) != min) ||
!      (((int)rint(RTOD(lp.max_angle))) != max))
    {
      FAIL();
      return(-1);
    }
!   else if((((int)rint(RTOD(lp.scan_res)*100.0)) != resolution) ||
!           (lp.intensity != intensity))
    {
      FAIL();
--- 22,44 ----
  
    TEST("set configuration");
!   int min = -90;
!   int max = +90;
!   int resolution = 100;
!   int range_res = 1;
!   bool intensity = true;
!   lp.Configure(DTOR(min), DTOR(max), resolution, range_res, intensity);
  
    TEST("get configuration");
!   lp.RequestConfigure();
    
    TEST("check configuration sanity");
!   if((((int)rint(RTOD(lp.GetMinAngle()))) != min) ||
!      (((int)rint(RTOD(lp.GetMaxAngle()))) != max))
    {
      FAIL();
      return(-1);
    }
!   else if((((int)rint(RTOD(lp.GetScanRes())*100.0)) != resolution) ||
!           (lp.GetRangeRes() != range_res))
    {
      FAIL();
***************
*** 82,106 ****
      TEST1("reading data (attempt %d)", t);
  
!     if(client->Read() < 0)
!     {
!       FAIL();
!       return(-1);
!     }
  
      PASS();
-     lp.Print();
    }
  
-   TEST("unsubscribing");
-   if((lp.ChangeAccess(PLAYER_CLOSE_MODE,&access) < 0) ||
-      (access != PLAYER_CLOSE_MODE))
-   {
-     FAIL();
-     return -1;
-   }
  
-   PASS();
  
!   return(0);
  }
  
--- 52,65 ----
      TEST1("reading data (attempt %d)", t);
  
!     client->Read();
  
+     std::cerr << "read laser data: " << std::endl << lp << std::endl;
      PASS();
    }
  
  
  
!   PASS();
!   return 0;
  }
  

Index: test_ptz.cc
===================================================================
RCS file: 
/cvsroot/playerstage/code/player/client_libs/libplayerc++/test/test_ptz.cc,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** test_ptz.cc 20 Sep 2005 13:17:08 -0000      1.1
--- test_ptz.cc 2 Feb 2007 17:12:04 -0000       1.2
***************
*** 5,111 ****
   */
  
- #include "playerclient.h"
  #include "test.h"
  #include <unistd.h>
  
  int
  test_ptz(PlayerClient* client, int index)
  {
!   unsigned char access;
!   PtzProxy zp(client,index,'c');
! 
!   printf("device [ptz] index [%d]\n", index);
  
!   TEST("subscribing (read/write)");
!   if((zp.ChangeAccess(PLAYER_ALL_MODE,&access) < 0) ||
!      (access != PLAYER_ALL_MODE))
!   {
!     FAIL();
!     printf("DRIVER: %s\n", zp.driver_name);
!     return -1;
!   }
!   PASS();
!   printf("DRIVER: %s\n", zp.driver_name);
  
!   for(int t = 0; t < 3; t++)
!   {
!     TEST1("reading data (attempt %d)", t);
  
!     if(client->Read() < 0)
!     {
!       FAIL();
!       return(-1);
      }
  
      PASS();
  
!     zp.Print();
!   }
! 
!   TEST("panning left");
!   if(zp.SetCam(DTOR(90),0,0) < 0)
!   {
!     FAIL();
!     return(-1);
!   }
!   sleep(3);
!   PASS();
  
!   TEST("panning right");
!   if(zp.SetCam(DTOR(-90),0,0) < 0)
!   {
!     FAIL();
!     return(-1);
!   }
!   sleep(3);
!   PASS();
  
!   TEST("tilting up");
!   if(zp.SetCam(0,DTOR(25),0) < 0)
!   {
!     FAIL();
!     return(-1);
!   }
!   sleep(3);
!   PASS();
  
!   TEST("tilting down");
!   if(zp.SetCam(0,DTOR(-25),0) < 0)
!   {
!     FAIL();
!     return(-1);
!   }
!   sleep(3);
!   PASS();
  
!   TEST("zooming in");
!   if(zp.SetCam(0,0,DTOR(10)) < 0)
!   {
!     FAIL();
!     return(-1);
!   }
!   sleep(3);
!   PASS();
  
-   TEST("zooming out");
-   if(zp.SetCam(0,0,DTOR(60)) < 0)
-   {
-     FAIL();
-     return(-1);
-   }
-   sleep(3);
-   PASS();
  
!   TEST("unsubscribing");
!   if((zp.ChangeAccess(PLAYER_CLOSE_MODE,&access) < 0) ||
!      (access != PLAYER_CLOSE_MODE))
!   {
      FAIL();
      return -1;
    }
  
    PASS();
! 
!   return(0);
  }
- 
--- 5,68 ----
   */
  
  #include "test.h"
  #include <unistd.h>
  
+ using namespace PlayerCc;
+ 
  int
  test_ptz(PlayerClient* client, int index)
  {
!   TEST("ptz");
!   try {
!     PtzProxy zp(client,index);
  
!     for(int t = 0; t < 3; t++)
!     {
!       TEST1("reading data (attempt %d)", t);
  
!       client->Read();
!       PASS();
  
!       std::cerr << zp << std::endl;
      }
  
+     TEST("panning left");
+     zp.SetCam(DTOR(90),0,0);
+     sleep(3);
      PASS();
  
!     TEST("panning right");
!     zp.SetCam(DTOR(-90),0,0);
!     sleep(3);
!     PASS();
  
!     TEST("tilting up");
!     zp.SetCam(0,DTOR(25),0);
!     sleep(3);
!     PASS();
  
!     TEST("tilting down");
!     zp.SetCam(0,DTOR(-25),0);
!     sleep(3);
!     PASS();
  
!     TEST("zooming in");
!     zp.SetCam(0,0,DTOR(10));
!     sleep(3);
!     PASS();
  
!     TEST("zooming out");
!     zp.SetCam(0,0,DTOR(60));
!     sleep(3);
!     PASS();
  
  
!   } catch(std::exception& e) {
      FAIL();
+     std::cerr << e.what() << std::endl;
      return -1;
    }
  
    PASS();
!   return 0;
  }

Index: test_audiodsp.cc
===================================================================
RCS file: 
/cvsroot/playerstage/code/player/client_libs/libplayerc++/test/test_audiodsp.cc,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** test_audiodsp.cc    20 Sep 2005 13:17:08 -0000      1.1
--- test_audiodsp.cc    2 Feb 2007 17:12:04 -0000       1.2
***************
*** 1,4 ****
  
- #include "playerclient.h"
  #include "test.h"
  #include <unistd.h>
--- 1,3 ----

Index: test_power.cc
===================================================================
RCS file: 
/cvsroot/playerstage/code/player/client_libs/libplayerc++/test/test_power.cc,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** test_power.cc       20 Sep 2005 13:17:08 -0000      1.1
--- test_power.cc       2 Feb 2007 17:12:04 -0000       1.2
***************
*** 5,9 ****
   */
  
- #include "playerclient.h"
  #include "test.h"
  #include <unistd.h>
--- 5,8 ----
***************
*** 12,30 ****
  test_power(PlayerClient* client, int index)
  {
!   unsigned char access;
!   PowerProxy pp(client,index,'c');
! 
!   printf("device [power] index [%d]\n", index);
! 
!   TEST("subscribing (read/write)");
!   if((pp.ChangeAccess(PLAYER_ALL_MODE,&access) < 0) ||
!      (access != PLAYER_ALL_MODE))
!   {
!     FAIL();
!     printf("DRIVER: %s\n", pp.driver_name);
!     return -1;
!   }
!   PASS();
!   printf("DRIVER: %s\n", pp.driver_name);
  
    // wait for P2OS to start up
--- 11,16 ----
  test_power(PlayerClient* client, int index)
  {
!   TEST("power");
!   PowerProxy pp(client,index);
  
    // wait for P2OS to start up
***************
*** 35,57 ****
    {
      TEST1("reading data (attempt %d)", t);
! 
!     if(client->Read() < 0)
!     {
!       FAIL();
!       return(-1);
!     }
! 
      PASS();
  
!     pp.Print();
    }
  
-   TEST("unsubscribing");
-   if((pp.ChangeAccess(PLAYER_CLOSE_MODE,&access) < 0) ||
-      (access != PLAYER_CLOSE_MODE))
-   {
-     FAIL();
-     return -1;
-   }
  
    PASS();
--- 21,30 ----
    {
      TEST1("reading data (attempt %d)", t);
!     client->Read();
      PASS();
  
!     std::cerr << pp << std::endl;
    }
  
  
    PASS();

Index: test_motor.cc
===================================================================
RCS file: 
/cvsroot/playerstage/code/player/client_libs/libplayerc++/test/test_motor.cc,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** test_motor.cc       20 Sep 2005 13:17:08 -0000      1.1
--- test_motor.cc       2 Feb 2007 17:12:04 -0000       1.2
***************
*** 5,9 ****
   */
  
- #include "playerclient.h"
  #include "test.h"
  #include <unistd.h>
--- 5,8 ----

Index: test_truth.cc
===================================================================
RCS file: 
/cvsroot/playerstage/code/player/client_libs/libplayerc++/test/test_truth.cc,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** test_truth.cc       20 Sep 2005 13:17:08 -0000      1.1
--- test_truth.cc       2 Feb 2007 17:12:04 -0000       1.2
***************
*** 5,9 ****
   */
  
- #include "playerclient.h"
  #include "test.h"
  
--- 5,8 ----

--- NEW FILE: test_actarray.cc ---
/*
 * $Id: test_actarray.cc,v 1.1 2007/02/02 17:12:04 gerkey Exp $
 *
 * a test for the C++ SonarProxy
 */

#include "test.h"
#include <unistd.h>

using namespace PlayerCc;

int
test_actarray(PlayerClient* client, int index)
{
  ActArrayProxy aap(client,index);

  // wait for P2OS to start up
  for(int i=0; i < 20; i++)
    client->Read();


  aap.RequestGeometry();
  aap.GetActuatorGeom(0);

  for(int t = 0; t < 3; t++)
  {
    TEST1("reading data (attempt %d)", t);
    client->Read();

    std::cerr << "got actarray data: " << std::endl << aap << std::endl;

    PASS();
  }

  const int wait_iters = 50;

  TEST("homing actuator #0");
  aap.MoveHome(0);
  for(int i = 0; i < wait_iters; ++i)
  {
    client->Read();
    if(i % 5 == 0)
      std::cerr << aap << std::endl;
  }
  PASS();

  TEST("moving #0 to 1.0");
  aap.MoveTo(0, 1.0);
  for(int i = 0; i < wait_iters; ++i)
  {
    client->Read();
    if(i % 5 == 0)
      std::cerr << aap << std::endl;
  }
  PASS();

  TEST("moving #0 to 0.0");
  aap.MoveTo(0, 0.0);
  for(int i = 0; i < wait_iters; ++i)
  {
    client->Read();
    if(i % 5 == 0)
      std::cerr << aap << std::endl;
  }
  PASS();

  TEST("moving #0 to 0.5");
  aap.MoveTo(0, 0.5);
  for(int i = 0; i < wait_iters; ++i)
  {
    client->Read();
    if(i % 5 == 0)
      std::cerr << aap << std::endl;
  }
  PASS();

  TEST("moving #0 at speed 0.25, then setting speed to 0");
  aap.MoveAtSpeed(0, 0.25);
  for(int i = 0; i < wait_iters; ++i)
  {
    client->Read();
    if(i % 5 == 0)
      std::cerr << aap << std::endl;
  }
  aap.MoveAtSpeed(0, 0.0);
  PASS();

  TEST("moving #0 at speed -0.3, then setting speed to 0");
  aap.MoveAtSpeed(0, -0.3);
  for(int i = 0; i < wait_iters; ++i)
  {
    client->Read();
    if(i % 5 == 0)
      std::cerr << aap << std::endl;
  }
  aap.MoveAtSpeed(0, 0.0);
  PASS();

  TEST("homing #0");
  aap.MoveHome(0);
  for(int i = 0; i < wait_iters; ++i)
  {
    client->Read();
    if(i % 5 == 0)
      std::cerr << aap << std::endl;
  }
  PASS();

  PASS();
  return(0);
}


                 

Index: test_blinkenlight.cc
===================================================================
RCS file: 
/cvsroot/playerstage/code/player/client_libs/libplayerc++/test/test_blinkenlight.cc,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** test_blinkenlight.cc        20 Sep 2005 13:17:08 -0000      1.1
--- test_blinkenlight.cc        2 Feb 2007 17:12:04 -0000       1.2
***************
*** 5,9 ****
   */
  
- #include "playerclient.h"
  #include "test.h"
  #include <unistd.h>
--- 5,8 ----

Index: test_gripper.cc
===================================================================
RCS file: 
/cvsroot/playerstage/code/player/client_libs/libplayerc++/test/test_gripper.cc,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** test_gripper.cc     20 Sep 2005 13:17:08 -0000      1.1
--- test_gripper.cc     2 Feb 2007 17:12:04 -0000       1.2
***************
*** 5,30 ****
   */
  
- #include "playerclient.h"
  #include "test.h"
  #include <unistd.h>
  
  int
  test_gripper(PlayerClient* client, int index)
  {
!   unsigned char access;
!   GripperProxy gp(client,index,'c');
! 
!   printf("device [gripper] index [%d]\n", index);
! 
!   TEST("subscribing (read/write)");
!   if((gp.ChangeAccess(PLAYER_ALL_MODE,&access) < 0) ||
!      (access != PLAYER_ALL_MODE))
!   {
!     FAIL();
!     printf("DRIVER: %s\n", gp.driver_name);
!     return -1;
!   }
!   PASS();
!   printf("DRIVER: %s\n", gp.driver_name);
  
    // wait for P2OS to start up
--- 5,17 ----
   */
  
  #include "test.h"
  #include <unistd.h>
  
+ using namespace PlayerCc;
+ 
  int
  test_gripper(PlayerClient* client, int index)
  {
!   GripperProxy gp(client,index);
  
    // wait for P2OS to start up
***************
*** 35,128 ****
    {
      TEST1("reading data (attempt %d)", t);
  
!     if(client->Read() < 0)
!     {
!       FAIL();
!       return(-1);
!     }
  
      PASS();
- 
-     gp.Print();
    }
  
!   if(use_stage)
!   {
!     TEST("gripper open");
!     if(gp.SetGrip(GRIPopen) < 0)
!     {
!       FAIL();
!       return(-1);
!     }
!     sleep(3);
!     PASS();
! 
!     TEST("gripper close");
!     if(gp.SetGrip(GRIPclose) < 0)
!     {
!       FAIL();
!       return(-1);
!     }
!     sleep(3);
!     PASS();
! 
!     TEST("gripper open");
!     if(gp.SetGrip(GRIPopen) < 0)
!     {
!       FAIL();
!       return(-1);
!     }
!     sleep(3);
!     PASS();
! 
!     TEST("gripper up");
!     if(gp.SetGrip(LIFTup) < 0)
!     {
!       FAIL();
!       return(-1);
!     }
!     sleep(3);
!     PASS();
  
!     TEST("gripper down");
!     if(gp.SetGrip(LIFTdown) < 0)
!     {
!       FAIL();
!       return(-1);
!     }
!     sleep(3);
!     PASS();
!   }
!   else
!   {
!     TEST("gripper deploy");
!     if(gp.SetGrip(GRIPdeploy) < 0)
!     {
!       FAIL();
!       return(-1);
!     }
!     sleep(3);
!     PASS();
  
!     TEST("gripper store");
!     if(gp.SetGrip(GRIPstore) < 0)
!     {
!       FAIL();
!       return(-1);
!     }
!     sleep(4);
!     PASS();
!   }
  
!   TEST("unsubscribing");
!   if((gp.ChangeAccess(PLAYER_CLOSE_MODE,&access) < 0) ||
!      (access != PLAYER_CLOSE_MODE))
!   {
!     FAIL();
!     return -1;
!   }
  
    PASS();
  
    return(0);
  }
--- 22,58 ----
    {
      TEST1("reading data (attempt %d)", t);
+     client->Read();
  
!     std::cerr << "got gripper data: " << std::endl << gp << std::endl;
  
      PASS();
    }
  
!   TEST("gripper open");
!   gp.Open();
!   sleep(5);
!   PASS();
  
!   TEST("gripper close");
!   gp.Close();
!   sleep(8);
!   PASS();
  
!   TEST("gripper open");
!   gp.Open();
!   sleep(5);
!   PASS();
  
!   TEST("gripper store object (only on some grippers, e.g. stage)");
!   gp.Store();
!   sleep(3);
!   PASS();
  
+   TEST("gripper retrieve object (only on some grippers, e.g. stage");
+   gp.Retrieve();
+   sleep(3);
    PASS();
  
+   PASS();
    return(0);
  }

Index: test_fiducialfinder.cc
===================================================================
RCS file: 
/cvsroot/playerstage/code/player/client_libs/libplayerc++/test/test_fiducialfinder.cc,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** test_fiducialfinder.cc      20 Sep 2005 13:17:08 -0000      1.1
--- test_fiducialfinder.cc      2 Feb 2007 17:12:04 -0000       1.2
***************
*** 5,9 ****
   */
  
- #include "playerclient.h"
  #include "test.h"
  #include <unistd.h>
--- 5,8 ----

Index: test_vision.cc
===================================================================
RCS file: 
/cvsroot/playerstage/code/player/client_libs/libplayerc++/test/test_vision.cc,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** test_vision.cc      20 Sep 2005 13:17:08 -0000      1.1
--- test_vision.cc      2 Feb 2007 17:12:04 -0000       1.2
***************
*** 5,9 ****
   */
  
- #include "playerclient.h"
  #include "test.h"
  #include <unistd.h>
--- 5,8 ----

Index: test_position_control.cc
===================================================================
RCS file: 
/cvsroot/playerstage/code/player/client_libs/libplayerc++/test/test_position_control.cc,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** test_position_control.cc    20 Sep 2005 13:17:08 -0000      1.1
--- test_position_control.cc    2 Feb 2007 17:12:04 -0000       1.2
***************
*** 5,9 ****
   */
  
- #include "playerclient.h"
  #include "test.h"
  #include <unistd.h>
--- 5,8 ----

Index: test_bps.cc
===================================================================
RCS file: 
/cvsroot/playerstage/code/player/client_libs/libplayerc++/test/test_bps.cc,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** test_bps.cc 20 Sep 2005 13:17:08 -0000      1.1
--- test_bps.cc 2 Feb 2007 17:12:04 -0000       1.2
***************
*** 5,9 ****
   */
  
- #include "playerclient.h"
  #include "test.h"
  #include <unistd.h>
--- 5,8 ----

Index: test_blobfinder.cc
===================================================================
RCS file: 
/cvsroot/playerstage/code/player/client_libs/libplayerc++/test/test_blobfinder.cc,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** test_blobfinder.cc  20 Sep 2005 13:17:08 -0000      1.1
--- test_blobfinder.cc  2 Feb 2007 17:12:04 -0000       1.2
***************
*** 5,9 ****
   */
  
- #include "playerclient.h"
  #include "test.h"
  #include <unistd.h>
--- 5,8 ----


-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier.
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Playerstage-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/playerstage-commit

Reply via email to