Revision: 6456
          http://playerstage.svn.sourceforge.net/playerstage/?rev=6456&view=rev
Author:   rtv
Date:     2008-05-23 11:59:01 -0700 (Fri, 23 May 2008)

Log Message:
-----------
added -g flag to disable GUI from cmdline

Modified Paths:
--------------
    code/stage/trunk/examples/ctrl/fasr.cc
    code/stage/trunk/libstage/main.cc
    code/stage/trunk/libstage/stage.cc
    code/stage/trunk/worlds/fasr.world

Modified: code/stage/trunk/examples/ctrl/fasr.cc
===================================================================
--- code/stage/trunk/examples/ctrl/fasr.cc      2008-05-23 14:31:55 UTC (rev 
6455)
+++ code/stage/trunk/examples/ctrl/fasr.cc      2008-05-23 18:59:01 UTC (rev 
6456)
@@ -52,7 +52,6 @@
   robot->work_get = 0;
   robot->work_put = 0;
   
-  //robot->flag = new StgFlag( stg_color_pack( 1,1,0,0.5 ), 3 );
   robot->pos = (StgModelPosition*)mod;
 
   robot->laser = (StgModelLaser*)mod->GetModel( "laser:0" );

Modified: code/stage/trunk/libstage/main.cc
===================================================================
--- code/stage/trunk/libstage/main.cc   2008-05-23 14:31:55 UTC (rev 6455)
+++ code/stage/trunk/libstage/main.cc   2008-05-23 18:59:01 UTC (rev 6456)
@@ -4,31 +4,56 @@
    Here is where I describe the Stage standalone program.
 */
 
+#include <getopt.h>
 
-//#include "config.h"
 #include "stage_internal.hh"
 
 const char* PACKAGE = "Stage";
 const char* VERSION = "3.dev";
 
+/* options descriptor */
+static struct option longopts[] = {
+  { "gui",  no_argument,   NULL,  'g' },
+  //  { "fast",  no_argument,   NULL,  'f' },
+  { NULL, 0, NULL, 0 }
+};
+
+
 int main( int argc, char* argv[] )
 {
-  printf( "%s %s\n", PACKAGE, VERSION );
-  
-  if( argc < 2 )
+  printf( "%s %s ", PACKAGE, VERSION );
+
+  int ch=0, optindex=0;
+  bool usegui = true;
+
+  while ((ch = getopt_long(argc, argv, "gf", longopts, &optindex)) != -1)
     {
-      printf( "Usage: %s <worldfile>", PACKAGE );
-      exit(0);
+      switch( ch )
+       {
+       case 0: // long option given
+         printf( "option %s given", longopts[optindex].name );
+         break;
+       case 'g': 
+         usegui = false; 
+         printf( "[GUI disabled]" ); 
+         break;
+       case '?':  
+         break;
+       default:
+         printf("unhandled option %c\n", ch );
+       }
     }
+
+  puts("");// end the first start-up line
   
   // initialize libstage
   Stg::Init( &argc, &argv );
   
-  StgWorldGui world(800, 700, argv[0]);
+  StgWorld* world = usegui ? new StgWorldGui(800, 700, argv[0]) : new 
StgWorld();
   
-  world.Load( argv[1] );
+  world->Load( argv[argc-1] );
   
-  while( ! world.TestQuit() )
-    world.RealTimeUpdate();
+  while( ! world->TestQuit() )
+    world->RealTimeUpdate();
 }
 

Modified: code/stage/trunk/libstage/stage.cc
===================================================================
--- code/stage/trunk/libstage/stage.cc  2008-05-23 14:31:55 UTC (rev 6455)
+++ code/stage/trunk/libstage/stage.cc  2008-05-23 18:59:01 UTC (rev 6456)
@@ -427,7 +427,6 @@
   int y, x;
   for(y = 0; y < img_height; y++)
     {
-      puts("");
       for(x = 0; x < img_width; x++)
        {
          // skip blank (white) pixels

Modified: code/stage/trunk/worlds/fasr.world
===================================================================
--- code/stage/trunk/worlds/fasr.world  2008-05-23 14:31:55 UTC (rev 6455)
+++ code/stage/trunk/worlds/fasr.world  2008-05-23 18:59:01 UTC (rev 6456)
@@ -5,21 +5,18 @@
 # defines Pioneer-like robots
 include "pioneer.inc"
 
-
 # defines 'map' object used for floorplans
 include "map.inc"
 
-
 # defines sick laser
 include "sick.inc"
 
-
 # set the resolution of the underlying raytrace model in meters
 resolution 0.02
 
 interval_sim 100  # simulation timestep in milliseconds
-interval_real 0  # real-time interval between simulation updates in 
milliseconds 
-paused 1
+interval_real 10  # real-time interval between simulation updates in 
milliseconds 
+paused 0
 
 # configure the GUI window
 window


This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Playerstage-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/playerstage-commit

Reply via email to