Revision: 7479
http://playerstage.svn.sourceforge.net/playerstage/?rev=7479&view=rev
Author: rtv
Date: 2009-03-13 21:48:20 +0000 (Fri, 13 Mar 2009)
Log Message:
-----------
added some exit checking
Modified Paths:
--------------
code/stage/trunk/libstage/model_getset.cc
code/stage/trunk/libstage/model_load.cc
code/stage/trunk/libstage/stage.hh
code/stage/trunk/libstage/world.cc
code/stage/trunk/libstage/worldgui.cc
code/stage/trunk/webstage/webstage.cc
code/stage/trunk/webstage/world.fed
code/stage/trunk/worlds/fasr.world
Modified: code/stage/trunk/libstage/model_getset.cc
===================================================================
--- code/stage/trunk/libstage/model_getset.cc 2009-03-13 20:42:17 UTC (rev
7478)
+++ code/stage/trunk/libstage/model_getset.cc 2009-03-13 21:48:20 UTC (rev
7479)
@@ -235,4 +235,3 @@
CallCallbacks( &this->pose );
}
-
Modified: code/stage/trunk/libstage/model_load.cc
===================================================================
--- code/stage/trunk/libstage/model_load.cc 2009-03-13 20:42:17 UTC (rev
7478)
+++ code/stage/trunk/libstage/model_load.cc 2009-03-13 21:48:20 UTC (rev
7479)
@@ -299,6 +299,8 @@
{
printf( "Libtool error: %s. Something is wrong with your plugin.
Quitting\n",
lt_dlerror() ); // report the error from libtool
+ puts( "libtool error #1" );
+ fflush( stdout );
exit(-1);
}
}
@@ -308,6 +310,8 @@
lt_dlerror() ); // report the error from libtool
PRINT_ERR1( "Failed to open \"%s\". Check that it can be found by
searching the directories in your STAGEPATH environment variable, or the
current directory if STAGEPATH is not set.]\n", lib );
+ puts( "libtool error #2" );
+ fflush( stdout );
exit(-1);
}
Modified: code/stage/trunk/libstage/stage.hh
===================================================================
--- code/stage/trunk/libstage/stage.hh 2009-03-13 20:42:17 UTC (rev 7478)
+++ code/stage/trunk/libstage/stage.hh 2009-03-13 21:48:20 UTC (rev 7479)
@@ -869,6 +869,7 @@
/** hint that the world needs to be redrawn if a GUI is attached */
void NeedRedraw(){ dirty = true; };
+ Model* CreateModel( Model* parent, const char* typestr );
void LoadModel( Worldfile* wf, int entity, GHashTable* entitytable );
void LoadBlock( Worldfile* wf, int entity, GHashTable* entitytable );
void LoadBlockGroup( Worldfile* wf, int entity, GHashTable* entitytable );
Modified: code/stage/trunk/libstage/world.cc
===================================================================
--- code/stage/trunk/libstage/world.cc 2009-03-13 20:42:17 UTC (rev 7478)
+++ code/stage/trunk/libstage/world.cc 2009-03-13 21:48:20 UTC (rev 7479)
@@ -204,35 +204,23 @@
-
-void World::LoadModel( Worldfile* wf, int entity, GHashTable* entitytable )
-{
- int parent_entity = wf->GetEntityParent( entity );
+Model* World::CreateModel( Model* parent, const char* typestr )
+{
+ Model* mod = NULL; // new model to return
- PRINT_DEBUG2( "wf entity %d parent entity %d\n",
- entity, parent_entity );
-
- Model *mod, *parent;
-
- parent = (Model*)g_hash_table_lookup( entitytable,
- (gpointer)parent_entity );
-
// find the creator function pointer in the hash table. use the
// vanilla model if the type is NULL.
stg_creator_t creator = NULL;
//printf( "creating model of type %s\n", typestr );
- char *typestr = (char*)wf->GetEntityType(entity);
-
- if( typestr ) // look up the string in the typetable
- for( int i=0; i<MODEL_TYPE_COUNT; i++ )
- if( strcmp( typestr, typetable[i].token ) == 0 )
- {
- creator = typetable[i].creator;
- break;
- }
-
+ for( int i=0; i<MODEL_TYPE_COUNT; i++ )
+ if( strcmp( typestr, typetable[i].token ) == 0 )
+ {
+ creator = typetable[i].creator;
+ break;
+ }
+
// if we found a creator function, call it
if( creator )
{
@@ -242,15 +230,34 @@
else
{
PRINT_ERR1( "Unknown model type %s in world file.",
- typestr );
+ typestr );
exit( 1 );
}
//printf( "created model %s\n", mod->Token() );
+ return mod;
+}
+
+
+void World::LoadModel( Worldfile* wf, int entity, GHashTable* entitytable )
+{
+ int parent_entity = wf->GetEntityParent( entity );
+
+ PRINT_DEBUG2( "wf entity %d parent entity %d\n",
+ entity, parent_entity );
+
+ Model* parent = (Model*)g_hash_table_lookup( entitytable,
+
(gpointer)parent_entity );
+
+ char *typestr = (char*)wf->GetEntityType(entity);
+ assert(typestr);
+
+ Model* mod = CreateModel( parent, typestr );
+
// configure the model with properties from the world file
mod->Load(wf, entity );
-
+
// record the model we created for this worlfile entry
g_hash_table_insert( entitytable, (gpointer)entity, mod );
Modified: code/stage/trunk/libstage/worldgui.cc
===================================================================
--- code/stage/trunk/libstage/worldgui.cc 2009-03-13 20:42:17 UTC (rev
7478)
+++ code/stage/trunk/libstage/worldgui.cc 2009-03-13 21:48:20 UTC (rev
7479)
@@ -473,6 +473,7 @@
return;
}
+ puts( "User closed window" );
exit(0);
}
@@ -540,6 +541,7 @@
bool done = worldGui->closeWindowQuery();
if (done) {
+ puts( "User exited via menu" );
exit(0);
}
}
Modified: code/stage/trunk/webstage/webstage.cc
===================================================================
--- code/stage/trunk/webstage/webstage.cc 2009-03-13 20:42:17 UTC (rev
7478)
+++ code/stage/trunk/webstage/webstage.cc 2009-03-13 21:48:20 UTC (rev
7479)
@@ -63,13 +63,22 @@
std::string& error)
{
printf( "create model name:%s type:%s\n", name.c_str(), type.c_str()
);
+
+ Model* mod = world->CreateModel( NULL, type.c_str() ); // top level
models only for now
+
+ // rename the model and store it by the new name
+ mod->SetToken( name.c_str() );
+ world->AddModel( mod );
+
+
+ printf( "done." );
return true;
}
virtual bool DeleteModel(const std::string& name,
std::string& error)
{
- printf( "deletee model name:%s \n", name.c_str() );
+ printf( "delete model name:%s \n", name.c_str() );
return true;
}
@@ -79,7 +88,7 @@
const
websim::Acceleration& a,
std::string& error)
{
- printf( "set model PVA name:%s\n", name.c_str() );
+ //printf( "set model PVA name:%s\n", name.c_str() );
Model* mod = world->GetModel( name.c_str() );
if( mod )
@@ -101,7 +110,7 @@
websim::Acceleration& a,
std::string& error)
{
- printf( "get model name:%s\n", name.c_str() );
+ //printf( "get model name:%s\n", name.c_str() );
Model* mod = world->GetModel( name.c_str() );
if( mod )
@@ -124,6 +133,13 @@
return true;
}
+
+
+ static void UpdatePuppetCb( std::string name, WebSim::Puppet* pup, void* arg
)
+ {
+ WebStage* ws = (WebStage*)arg;
+ ws->Push( pup->name );
+ }
};
@@ -177,46 +193,27 @@
port,
fedfilename.c_str(),
worldfilename );
-
- //websim::Pose p( 0,0,0,0,0,0 );
- // websim::Velocity v( 0,0,0,0,0,0 );
- // websim::Acceleration a( 0,0,0,0,0,0 );
World* world = ( usegui ?
new WorldGui( 400, 300,
worldfilename ) :
new World( worldfilename ) );
world->Load( worldfilename );
- WebStage mws( world, fedfilename, host, port );
+ WebStage ws( world, fedfilename, host, port );
- if( usegui == true )
+ //close program once time has completed
+ bool quit = false;
+ while( ! quit )
{
- //don't close the window once time has finished
- while( true )
- {
- World::UpdateAll();
-
- // TODO - for all puppets....
- if( port == 8000 )
- {
- mws.Push( "monkey" );
- mws.Push( "punky" );
- mws.Push( "chunky" );
- }
+ ws.ForEachPuppet( WebStage::UpdatePuppetCb, (void*)&ws );
- mws.Update();
- }
- }
- else
- {
- //close program once time has completed
- bool quit = false;
- while( quit == false )
- {
- quit = World::UpdateAll();
- // TODO - push changes
- // mws.SetPuppetPVA( "monkey", p, v, a );
- mws.Update();
- }
+ // update Stage
+ //quit = world->Update();
+ world->Update();
+
+ ws.Update();
}
+
+ printf( "Webstage done.\n" );
+ return 0;
}
Modified: code/stage/trunk/webstage/world.fed
===================================================================
--- code/stage/trunk/webstage/world.fed 2009-03-13 20:42:17 UTC (rev 7478)
+++ code/stage/trunk/webstage/world.fed 2009-03-13 21:48:20 UTC (rev 7479)
@@ -4,9 +4,22 @@
localhost:8001=slave
[master]
-monkey=slave:pioneer2dx
-chunky=slave:pioneer2dx
-punky=slave:pioneer2dx
+position:0=slave:position
+position:1=slave:position
+position:2=slave:position
+position:3=slave:position
+position:4=slave:position
+position:5=slave:position
+position:6=slave:position
+position:7=slave:position
+position:8=slave:position
+position:9=slave:position
+position:10=slave:position
+position:11=slave:position
+position:12=slave:position
+position:13=slave:position
+position:14=slave:position
+position:15=slave:position
Modified: code/stage/trunk/worlds/fasr.world
===================================================================
--- code/stage/trunk/worlds/fasr.world 2009-03-13 20:42:17 UTC (rev 7478)
+++ code/stage/trunk/worlds/fasr.world 2009-03-13 21:48:20 UTC (rev 7479)
@@ -14,7 +14,7 @@
# threads may speed things up here depending on available CPU cores & workload
# threadpool 0
- threadpool 0
+ threadpool 16
# configure the GUI window
@@ -121,40 +121,56 @@
obstacle_return 0
)
-puck( pose [ 1.175 2.283 0 0 ] )
-puck( pose [ 0.875 3.139 0 0 ] )
-puck( pose [ 1.043 2.825 0 0 ] )
-puck( pose [ 1.349 2.734 0 0 ] )
-puck( pose [ 2.625 3.068 0 0 ] )
-puck( pose [ 0.447 2.689 0 0 ] )
-puck( pose [ 0.143 3.308 0 0 ] )
-puck( pose [ 0.334 3.441 0 0 ] )
-puck( pose [ 1.439 3.218 0 0 ] )
-puck( pose [ 0.747 2.741 0 0 ] )
-puck( pose [ 0.955 2.086 0 0 ] )
-puck( pose [ 1.781 2.593 0 0 ] )
-puck( pose [ 1.068 2.476 0 0 ] )
+#puck( pose [ 1.175 2.283 0 0 ] )
+#puck( pose [ 0.875 3.139 0 0 ] )
+#puck( pose [ 1.043 2.825 0 0 ] )
+#puck( pose [ 1.349 2.734 0 0 ] )
+#puck( pose [ 2.625 3.068 0 0 ] )
+#puck( pose [ 0.447 2.689 0 0 ] )
+#puck( pose [ 0.143 3.308 0 0 ] )
+#puck( pose [ 0.334 3.441 0 0 ] )
+#puck( pose [ 1.439 3.218 0 0 ] )
+#puck( pose [ 0.747 2.741 0 0 ] )
+#puck( pose [ 0.955 2.086 0 0 ] )
+#puck( pose [ 1.781 2.593 0 0 ] )
+#puck( pose [ 1.068 2.476 0 0 ] )
-puck( pose [ 0.488 3.190 0 0 ] )
-puck( pose [ 1.708 3.198 0 0 ] )
-puck( pose [ 1.440 2.416 0 0 ] )
-puck( pose [ 1.140 3.045 0 0 ] )
-puck( pose [ 0.682 2.969 0 0 ] )
-puck( pose [ 2.205 3.268 0 0 ] )
-puck( pose [ 1.990 2.312 0 0 ] )
-puck( pose [ 0.646 3.486 0 0 ] )
-puck( pose [ 1.670 2.907 0 0 ] )
-puck( pose [ 2.091 2.830 0 0 ] )
-puck( pose [ -0.103 2.564 0 0 ] )
-puck( pose [ 1.950 3.462 0 0 ] )
-puck( pose [ 2.668 2.674 0 0 ] )
-puck( pose [ 0.549 2.367 0 0 ] )
-puck( pose [ 0.162 2.983 0 0 ] )
-puck( pose [ 1.067 3.367 0 0 ] )
-puck( pose [ 1.412 3.604 0 0 ] )
+#puck( pose [ 0.488 3.190 0 0 ] )
+#puck( pose [ 1.708 3.198 0 0 ] )
+#puck( pose [ 1.440 2.416 0 0 ] )
+#puck( pose [ 1.140 3.045 0 0 ] )
+#puck( pose [ 0.682 2.969 0 0 ] )
+#puck( pose [ 2.205 3.268 0 0 ] )
+#puck( pose [ 1.990 2.312 0 0 ] )
+#puck( pose [ 0.646 3.486 0 0 ] )
+#puck( pose [ 1.670 2.907 0 0 ] )
+#puck( pose [ 2.091 2.830 0 0 ] )
+#puck( pose [ -0.103 2.564 0 0 ] )
+#puck( pose [ 1.950 3.462 0 0 ] )
+#puck( pose [ 2.668 2.674 0 0 ] )
+#puck( pose [ 0.549 2.367 0 0 ] )
+#puck( pose [ 0.162 2.983 0 0 ] )
+#puck( pose [ 1.067 3.367 0 0 ] )
+#puck( pose [ 1.412 3.604 0 0 ] )
autorob( pose [5.418 7.478 0 -163.478] joules 300000 )
+autorob( pose [7.574 6.269 0 -111.715] joules 100000 )
+autorob( pose [5.615 6.185 0 107.666] joules 200000 )
+autorob( pose [7.028 6.502 0 -128.279] joules 400000 )
+autorob( pose [5.750 4.137 0 -97.047] joules 100000 )
+autorob( pose [4.909 6.097 0 -44.366] joules 200000 )
+autorob( pose [6.898 4.775 0 -117.576] joules 300000 )
+autorob( pose [7.394 5.595 0 129.497] joules 400000 )
+autorob( pose [6.468 6.708 0 170.743] joules 100000 )
+autorob( pose [6.451 4.189 0 -61.453] joules 200000 )
+autorob( pose [5.060 6.868 0 -61.295] joules 300000 )
+autorob( pose [4.161 5.544 0 -147.713] joules 400000 )
+autorob( pose [4.911 4.552 0 -125.236] joules 100000 )
+autorob( pose [3.985 6.474 0 -158.025] joules 200000 )
+autorob( pose [5.440 5.317 0 -26.545] joules 300000 )
+autorob( pose [6.362 5.632 0 163.239] joules 400000 )
+
#autorob( pose [7.559 4.764 0 -139.066] )
#autorob( pose [5.471 7.446 0 77.301] )
#autorob( pose [7.122 4.175 0 -31.440] )
@@ -170,7 +186,3 @@
#autorob( pose [3.944 4.674 0 -103.060] )
#autorob( pose [4.634 6.897 0 -103.060] )
-
-autorob( name "monkey" pose [5.418 7.478 0 -163.478] joules 300000 )
-autorob( name "chunky" pose [6.418 7.478 0 -163.478] joules 300000 )
-autorob( name "punky" pose [7.418 7.478 0 -163.478] joules 300000 )
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
------------------------------------------------------------------------------
Apps built with the Adobe(R) Flex(R) framework and Flex Builder(TM) are
powering Web 2.0 with engaging, cross-platform capabilities. Quickly and
easily build your RIAs with Flex Builder, the Eclipse(TM)based development
software that enables intelligent coding and step-through debugging.
Download the free 60 day trial. http://p.sf.net/sfu/www-adobe-com
_______________________________________________
Playerstage-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/playerstage-commit