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

Modified Files:
        Makefile.am test.c 
Added Files:
        test_imu.c 
Log Message:
Added support for IMU.


--- NEW FILE: test_imu.c ---
/***************************************************************************
 * Desc: Tests for the IMU device
 * Author: Radu Bogdan Rusu
 * Date: 08th of September 2006
 **************************************************************************/

#include "test.h"
#include "playerc.h"

// Basic IMU test
int test_imu (playerc_client_t *client, int index)
{
  int t, i, j;
  void *rdevice;
  playerc_imu_t *device;

  printf ("device [imu] index [%d]\n", index);

  device = playerc_imu_create (client, index);

  TEST ("subscribing (read)");
  if (playerc_imu_subscribe (device, PLAYER_OPEN_MODE) == 0)
    PASS ();
  else
    FAIL ();

  for (t = 0; t < 10; t++)
  {
    TEST1 ("reading data (attempt %d)", t);

    do
      rdevice = playerc_client_read (client);
    while (rdevice == client);
    
    if (rdevice == device)
    {
      PASS ();
      printf ("roll  : [%f]\n"
              "pitch : [%f]\n"
              "yaw   : [%f]\n", 
            device->pose.proll, device->pose.ppitch, device->pose.pyaw);
    }
    else
    {
      FAIL ();
      break;
    }
  }

  TEST ("resetting the orientation (global reset)...");
  if (playerc_imu_reset_orientation (device, 2) < 0)
    FAIL ();
  else
  {
    sleep (3);
    PASS ();
  }
  
  for (t = 0; t < 10; t++)
  {
    TEST1 ("reading data (attempt %d)", t);

    do
      rdevice = playerc_client_read (client);
    while (rdevice == client);
    
    if (rdevice == device)
    {
      PASS ();
      printf ("roll  : [%f]\n"
              "pitch : [%f]\n"
              "yaw   : [%f]\n", 
            device->pose.proll, device->pose.ppitch, device->pose.pyaw);
    }
    else
    {
      FAIL ();
      break;
    }
  }
  
  TEST("unsubscribing");
  if (playerc_imu_unsubscribe (device) == 0)
    PASS ();
  else
    FAIL ();
  
  playerc_imu_destroy (device);
  
  return 0;
}

Index: test.c
===================================================================
RCS file: /cvsroot/playerstage/code/player/client_libs/libplayerc/test/test.c,v
retrieving revision 1.45
retrieving revision 1.46
diff -C2 -d -r1.45 -r1.46
*** test.c      11 Apr 2006 15:40:31 -0000      1.45
--- test.c      11 Sep 2006 19:57:37 -0000      1.46
***************
*** 140,144 ****
          test_rfid(client, client->devinfos[i].addr.index);
          break;
!       
        // simulation device
        case PLAYER_SIMULATION_CODE:
--- 140,149 ----
          test_rfid(client, client->devinfos[i].addr.index);
          break;
! 
!         // imu device
!       case PLAYER_IMU_CODE:
!         test_imu (client, client->devinfos[i].addr.index);
!       break;
!                       
        // simulation device
        case PLAYER_SIMULATION_CODE:

Index: Makefile.am
===================================================================
RCS file: 
/cvsroot/playerstage/code/player/client_libs/libplayerc/test/Makefile.am,v
retrieving revision 1.41
retrieving revision 1.42
diff -C2 -d -r1.41 -r1.42
*** Makefile.am 11 Apr 2006 15:40:31 -0000      1.41
--- Makefile.am 11 Sep 2006 19:57:37 -0000      1.42
***************
*** 29,33 ****
        test_sonar.c \
        test_rfid.c \
!       test_wsn.c
  
  #test_camera.c \
--- 29,34 ----
        test_sonar.c \
        test_rfid.c \
!       test_wsn.c \
!       test_imu.c
  
  #test_camera.c \


-------------------------------------------------------------------------
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