Update of /cvsroot/playerstage/code/player/utils/playerv
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10759/utils/playerv

Modified Files:
        playerv.c 
Log Message:
fixed push/pull, and vfh

Index: playerv.c
===================================================================
RCS file: /cvsroot/playerstage/code/player/utils/playerv/playerv.c,v
retrieving revision 1.53
retrieving revision 1.54
diff -C2 -d -r1.53 -r1.54
*** playerv.c   1 Dec 2007 21:15:03 -0000       1.53
--- playerv.c   7 Dec 2007 01:50:15 -0000       1.54
***************
*** 42,46 ****
  in your PATH, then playerv should also be.  Command-line usage is:
  @verbatim
! $ playerv [-h <hostname>] [-p <port>] [-pull <0|1>] [--<device>:<index>] 
[--<device>:<index>] ...
  @endverbatim
  For example, to connect to Player on localhost at the default port
--- 42,46 ----
  in your PATH, then playerv should also be.  Command-line usage is:
  @verbatim
! $ playerv [-h <hostname>] [-p <port>] [-rate <Hz>] [--<device>:<index>] 
[--<device>:<index>] ...
  @endverbatim
  For example, to connect to Player on localhost at the default port
***************
*** 55,61 ****
  @endverbatim
  
! If pull is set to 1, it will set the server's replace rule to true, and only
! deliver data when a read is requested.  This is sometimes useful on slow
! connections or with slow computers that cannot keep up.
  
  When playerv starts, a window will pop up.  Click and drag with the left
--- 55,61 ----
  @endverbatim
  
! If rate is a positive value, playerv attempts to poll the server for data
! at the requested rate, in Hz.  If rate is 0, then playerv switches to PUSH
! mode, in which the server pushes all data, when it's ready.  The default rate 
is 5Hz.
  
  When playerv starts, a window will pop up.  Click and drag with the left
***************
*** 142,146 ****
    printf("\nPlayerViewer %s, ", VERSION);
    printf("a visualization tool for the Player robot device server.\n");
!   printf("Usage  : playerv [-h <hostname>] [-p <port>] [-pull <0|1>]\n");
    printf("                 [--<device>:<index>] [--<device>:<index>] ... \n");
    printf("Example: playerv -p 6665 --position:0 --sonar:0\n");
--- 142,146 ----
    printf("\nPlayerViewer %s, ", VERSION);
    printf("a visualization tool for the Player robot device server.\n");
!   printf("Usage  : playerv [-h <hostname>] [-p <port>] [-rate <Hz>]\n");
    printf("                 [--<device>:<index>] [--<device>:<index>] ... \n");
    printf("Example: playerv -p 6665 --position:0 --sonar:0\n");
***************
*** 159,165 ****
    int port;
    int i;
-   int rate;
    int count;
!   int pull;
    char section[256];
    int device_count;
--- 159,164 ----
    int port;
    int i;
    int count;
!   double rate;
    char section[256];
    int device_count;
***************
*** 188,192 ****
  
    // Pick out some important program options
-   rate = opt_get_int(opt, "gui", "rate", 10);
    host = opt_get_string(opt, "", "host", NULL);
    if (!host)
--- 187,190 ----
***************
*** 197,201 ****
      port = opt_get_int(opt, "", "p", 6665);
  
!   pull = opt_get_int(opt, "", "pull", 1);
  
    // Connect to the server
--- 195,201 ----
      port = opt_get_int(opt, "", "p", 6665);
  
!   rate = opt_get_double(opt, "", "rate", 5.0);
!   if(rate < 0.0)
!     rate = 0.0;
  
    // Connect to the server
***************
*** 209,213 ****
    }
  
!   if (0 == pull)
    {
      printf("Setting delivery mode to PLAYER_DATAMODE_PUSH\n", host, port);
--- 209,213 ----
    }
  
!   if(rate == 0.0)
    {
      printf("Setting delivery mode to PLAYER_DATAMODE_PUSH\n", host, port);
***************
*** 314,318 ****
  
    // start out timer if in pull mode
!   if (0 != pull)
      gettimeofday(&tv, NULL);
    
--- 314,318 ----
  
    // start out timer if in pull mode
!   if(rate > 0.0)
      gettimeofday(&tv, NULL);
    
***************
*** 322,326 ****
      rtk_app_main_loop(app);
  
!     if (0 == pull)  // if we're in push mode
      {
        // see if there's data
--- 322,326 ----
      rtk_app_main_loop(app);
  
!     if(rate == 0.0)  // if we're in push mode
      {
        // see if there's data
***************
*** 338,344 ****
      else // we're in pull mode
      {
!       // we only want to request new data at roughly 20 Hz
        gettimeofday(&tc, NULL);
!       if (((tc.tv_sec - tv.tv_sec)*1e6 + tc.tv_usec - tv.tv_usec) > 50000)
        {
          tv = tc;
--- 338,344 ----
      else // we're in pull mode
      {
!       // we only want to request new data at the target rate
        gettimeofday(&tc, NULL);
!       if(((tc.tv_sec - tv.tv_sec) + (tc.tv_usec - tv.tv_usec)/1e6) > 1.0/rate)
        {
          tv = tc;


-------------------------------------------------------------------------
SF.Net email is sponsored by:
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php
_______________________________________________
Playerstage-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/playerstage-commit

Reply via email to