Revision: 7529
http://playerstage.svn.sourceforge.net/playerstage/?rev=7529&view=rev
Author: rtv
Date: 2009-03-18 03:00:08 +0000 (Wed, 18 Mar 2009)
Log Message:
-----------
added basic time support to websim
Modified Paths:
--------------
code/stage/trunk/examples/ctrl/wander.cc
code/stage/trunk/webstage/webstage.cc
code/stage/trunk/worlds/fasr.world
Modified: code/stage/trunk/examples/ctrl/wander.cc
===================================================================
--- code/stage/trunk/examples/ctrl/wander.cc 2009-03-18 02:58:32 UTC (rev
7528)
+++ code/stage/trunk/examples/ctrl/wander.cc 2009-03-18 03:00:08 UTC (rev
7529)
@@ -42,7 +42,6 @@
// get the data
uint32_t sample_count=0;
stg_laser_sample_t* scan = robot->laser->GetSamples( &sample_count );
-
if( ! scan )
return 0;
Modified: code/stage/trunk/webstage/webstage.cc
===================================================================
--- code/stage/trunk/webstage/webstage.cc 2009-03-18 02:58:32 UTC (rev
7528)
+++ code/stage/trunk/webstage/webstage.cc 2009-03-18 03:00:08 UTC (rev
7529)
@@ -28,7 +28,7 @@
virtual ~WebStage()
{}
- void Push( std::string name )
+ void Push( const std::string& name )
{
Stg::Model* mod = world->GetModel( name.c_str() );
if( mod )
@@ -104,6 +104,7 @@
}
virtual bool GetModelPVA(const std::string& name,
+
websim::Time& t,
websim::Pose& p,
websim::Velocity& v,
websim::Acceleration& a,
@@ -111,6 +112,8 @@
{
//printf( "get model name:%s\n", name.c_str() );
+ t = GetTime();
+
Model* mod = world->GetModel( name.c_str() );
if( mod )
{
@@ -133,8 +136,17 @@
return true;
}
+ virtual websim::Time GetTime()
+ {
+ stg_usec_t stgtime = world->SimTimeNow();
- static void UpdatePuppetCb( std::string name, WebSim::Puppet* pup, void* arg
)
+ websim::Time t;
+ t.sec = stgtime / 1e6;
+ t.usec = stgtime - (t.sec * 1e6);
+ return t;
+ }
+
+ static void UpdatePuppetCb( const std::string& name, WebSim::Puppet* pup,
void* arg )
{
WebStage* ws = (WebStage*)arg;
ws->Push( pup->name );
@@ -155,7 +167,8 @@
int ch=0, optindex=0;
bool usegui = true;
-
+ bool usefedfile = false;
+
while ((ch = getopt_long(argc, argv, "gh:p:f:", longopts, &optindex)) != -1)
{
switch( ch )
@@ -175,6 +188,7 @@
break;
case 'f':
fedfilename = optarg;
+ usefedfile = true;
break;
case '?':
break;
@@ -199,22 +213,19 @@
world->Load( worldfilename );
WebStage ws( world, host, port );
- ws.LoadFederationFile( fedfilename );
+
+ if( usefedfile )
+ ws.LoadFederationFile( fedfilename );
puts( "entering main loop" );
-// ws.Go();
-// ws.Wait();
-
-// puts( "through the sync" );
-
-
//close program once time has completed
bool quit = false;
while( ! quit )
{
// todo? check for changes?
// send my updates
+
ws.ForEachPuppet( WebStage::UpdatePuppetCb, (void*)&ws );
//puts( "pushes done" );
Modified: code/stage/trunk/worlds/fasr.world
===================================================================
--- code/stage/trunk/worlds/fasr.world 2009-03-18 02:58:32 UTC (rev 7528)
+++ code/stage/trunk/worlds/fasr.world 2009-03-18 03:00:08 UTC (rev 7529)
@@ -13,8 +13,8 @@
resolution 0.02
# threads may speed things up here depending on available CPU cores & workload
- threadpool 0
-# threadpool 16
+# threadpool 8
+ threadpool 16
# configure the GUI window
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