Revision: 8264
http://playerstage.svn.sourceforge.net/playerstage/?rev=8264&view=rev
Author: rtv
Date: 2009-09-26 01:28:12 +0000 (Sat, 26 Sep 2009)
Log Message:
-----------
replaced some c-strings with std::strings
Modified Paths:
--------------
code/stage/trunk/CMakeLists.txt
code/stage/trunk/INSTALL.txt
code/stage/trunk/RELEASE.txt
code/stage/trunk/examples/ctrl/CMakeLists.txt
code/stage/trunk/examples/ctrl/fasr.cc
code/stage/trunk/examples/ctrl/pioneer_flocking.cc
code/stage/trunk/examples/ctrl/wander.cc
code/stage/trunk/examples/ctrl/wander_pioneer.cc
code/stage/trunk/libstage/CMakeLists.txt
code/stage/trunk/libstage/ancestor.cc
code/stage/trunk/libstage/block.cc
code/stage/trunk/libstage/blockgroup.cc
code/stage/trunk/libstage/canvas.cc
code/stage/trunk/libstage/color.cc
code/stage/trunk/libstage/model.cc
code/stage/trunk/libstage/model_actuator.cc
code/stage/trunk/libstage/model_draw.cc
code/stage/trunk/libstage/model_load.cc
code/stage/trunk/libstage/model_position.cc
code/stage/trunk/libstage/stage.hh
code/stage/trunk/libstage/world.cc
code/stage/trunk/libstage/worldfile.cc
code/stage/trunk/libstage/worldfile.hh
code/stage/trunk/libstageplugin/p_driver.cc
code/stage/trunk/worlds/benchmark/expand_pioneer.cc
code/stage/trunk/worlds/benchmark/expand_swarm.cc
code/stage/trunk/worlds/fasr.world
code/stage/trunk/worlds/pioneer_flocking.world
Modified: code/stage/trunk/CMakeLists.txt
===================================================================
--- code/stage/trunk/CMakeLists.txt 2009-09-23 01:47:01 UTC (rev 8263)
+++ code/stage/trunk/CMakeLists.txt 2009-09-26 01:28:12 UTC (rev 8264)
@@ -31,7 +31,6 @@
# Determine the operating system in detail
INCLUDE (${PROJECT_CMAKE_DIR}/internal/FindOS.cmake)
-
# Enable -Wall by default unless on Win or Solaris
IF (NOT PROJECT_OS_WIN AND NOT PROJECT_OS_SOLARIS)
# Using -Wall on Windows causes MSVC to produce thousands of warnings in
its
Modified: code/stage/trunk/INSTALL.txt
===================================================================
--- code/stage/trunk/INSTALL.txt 2009-09-23 01:47:01 UTC (rev 8263)
+++ code/stage/trunk/INSTALL.txt 2009-09-26 01:28:12 UTC (rev 8264)
@@ -9,8 +9,9 @@
Dependencies
------------
-Building Stage requires the following libraries:
+Building Stage requires the following tools and libraries:
+- pkg-config
- FLTK 1.1.x
- OpenGL
- libpng
Modified: code/stage/trunk/RELEASE.txt
===================================================================
--- code/stage/trunk/RELEASE.txt 2009-09-23 01:47:01 UTC (rev 8263)
+++ code/stage/trunk/RELEASE.txt 2009-09-26 01:28:12 UTC (rev 8264)
@@ -1,3 +1,25 @@
+Version 3.2.0
+-------------
+
+This minor release fixes many bugs, has some performance improvements
+and some significant internal and API changes, including:
+
+* introduced an internal event queue, so that there is no longer any
+ atomic world update interval. Each model can have its update
+ interval specified individually
+* worldfile syntax checking improved: poses and sizes are checked for
+ correct vector length
+* pkg-config file for libstage now contains correct dependencies,
+ making it much easier to build things using libstage
+* controllers can now take an argument string from the worldfile and
+ command line
+* better powerpack model
+* cleaned up namespace quite a bit - controllers and simulators using
+ libstage may need some simple tweaks, but the design is cleaner and
+ more consistent.
+
+Richard Vaughan (rtv) [email protected] - 2009.9.12
+
Version 3.1.0
-------------
Modified: code/stage/trunk/examples/ctrl/CMakeLists.txt
===================================================================
--- code/stage/trunk/examples/ctrl/CMakeLists.txt 2009-09-23 01:47:01 UTC
(rev 8263)
+++ code/stage/trunk/examples/ctrl/CMakeLists.txt 2009-09-26 01:28:12 UTC
(rev 8264)
@@ -1,14 +1,13 @@
SET( PLUGINS
- # convoy
fasr
- # fasr2
lasernoise
sink
source
wander
+ wander_pioneer
pioneer_flocking
-# rasterize
+ rasterize
)
# need plaer's wavefront planning library for this one
Modified: code/stage/trunk/examples/ctrl/fasr.cc
===================================================================
--- code/stage/trunk/examples/ctrl/fasr.cc 2009-09-23 01:47:01 UTC (rev
8263)
+++ code/stage/trunk/examples/ctrl/fasr.cc 2009-09-26 01:28:12 UTC (rev
8264)
@@ -493,7 +493,7 @@
};
// Stage calls this when the model starts up
-extern "C" int Init( Model* mod, char* str )
+extern "C" int Init( Model* mod, CtrlArgs* args )
{
#if 1
// example using the model rasterizer
Modified: code/stage/trunk/examples/ctrl/pioneer_flocking.cc
===================================================================
--- code/stage/trunk/examples/ctrl/pioneer_flocking.cc 2009-09-23 01:47:01 UTC
(rev 8263)
+++ code/stage/trunk/examples/ctrl/pioneer_flocking.cc 2009-09-26 01:28:12 UTC
(rev 8264)
@@ -46,13 +46,13 @@
robot->position = (ModelPosition*)mod;
// subscribe to the ranger, which we use for navigating
- robot->ranger = (ModelRanger*)mod->GetModel( "ranger:0" );
+ robot->ranger = (ModelRanger*)mod->GetUnusedModelOfType( "ranger" );
assert( robot->ranger );
// ask Stage to call into our ranger update function
robot->ranger->AddUpdateCallback( (stg_model_callback_t)RangerUpdate, robot
);
- robot->fiducial = (ModelFiducial*)mod->GetModel( "fiducial:0" ) ;
+ robot->fiducial = (ModelFiducial*)mod->GetUnusedModelOfType( "fiducial" ) ;
assert( robot->fiducial );
robot->fiducial->AddUpdateCallback( (stg_model_callback_t)FiducialUpdate,
robot );
Modified: code/stage/trunk/examples/ctrl/wander.cc
===================================================================
--- code/stage/trunk/examples/ctrl/wander.cc 2009-09-23 01:47:01 UTC (rev
8263)
+++ code/stage/trunk/examples/ctrl/wander.cc 2009-09-26 01:28:12 UTC (rev
8264)
@@ -35,13 +35,12 @@
robot->randcount = 0;
robot->pos = (ModelPosition*)mod;
- robot->laser = (ModelLaser*)mod->GetModel( "laser:0" );
+ robot->laser = (ModelLaser*)mod->GetChild( "laser:0" );
robot->laser->AddUpdateCallback( (stg_model_callback_t)LaserUpdate, robot );
robot->laser->Subscribe(); // starts the laser updates
robot->pos->Subscribe(); // starts the position updates
-
-
+
return 0; //ok
}
Modified: code/stage/trunk/examples/ctrl/wander_pioneer.cc
===================================================================
--- code/stage/trunk/examples/ctrl/wander_pioneer.cc 2009-09-23 01:47:01 UTC
(rev 8263)
+++ code/stage/trunk/examples/ctrl/wander_pioneer.cc 2009-09-26 01:28:12 UTC
(rev 8264)
@@ -47,12 +47,12 @@
robot->position = (ModelPosition*)mod;
assert( robot->ranger );
- robot->ranger = (ModelRanger*)mod->GetModel( "ranger:0" );
+ robot->ranger = (ModelRanger*)mod->GetUnusedModelOfType( "ranger" );
assert( robot->ranger );
// ask Stage to call into our ranger update function whenever the ranger is
updated
robot->ranger->AddUpdateCallback( (stg_model_callback_t)RangerUpdate, robot
);
- robot->fiducial = (ModelFiducial*)mod->GetModel( "fiducial:0" ) ;
+ robot->fiducial = (ModelFiducial*)mod->GetUnusedModelOfType( "fiducial" ) ;
assert( robot->fiducial );
// ask Stage to call into our fiducial update function whenever the fiducial
is updated
robot->fiducial->AddUpdateCallback( (stg_model_callback_t)FiducialUpdate,
robot );
Modified: code/stage/trunk/libstage/CMakeLists.txt
===================================================================
--- code/stage/trunk/libstage/CMakeLists.txt 2009-09-23 01:47:01 UTC (rev
8263)
+++ code/stage/trunk/libstage/CMakeLists.txt 2009-09-26 01:28:12 UTC (rev
8264)
@@ -4,7 +4,6 @@
include_directories(${PROJECT_BINARY_DIR})
set( stageSrcs
- ancestor.cc
block.cc
blockgroup.cc
camera.cc
@@ -18,17 +17,17 @@
model_blinkenlight.cc
model_blobfinder.cc
model_callbacks.cc
+ model_camera.cc
model_draw.cc
- model_camera.cc
model_fiducial.cc
model_getset.cc
model_gripper.cc
model_laser.cc
+ model_lightindicator.cc
model_load.cc
model_position.cc
model_props.cc
model_ranger.cc
- model_lightindicator.cc
option.cc
powerpack.cc
region.cc
@@ -36,13 +35,14 @@
stage.hh
texture_manager.cc
typetable.cc
- vis_strip.cc
world.cc
worldfile.cc
- worldgui.cc
canvas.cc
options_dlg.cc
options_dlg.hh
+ vis_strip.cc
+ worldgui.cc
+ ancestor.cc
)
set_source_files_properties( ${stageSrcs} PROPERTIES COMPILE_FLAGS
"${FLTK_CFLAGS}" )
Modified: code/stage/trunk/libstage/ancestor.cc
===================================================================
--- code/stage/trunk/libstage/ancestor.cc 2009-09-23 01:47:01 UTC (rev
8263)
+++ code/stage/trunk/libstage/ancestor.cc 2009-09-26 01:28:12 UTC (rev
8264)
@@ -1,11 +1,13 @@
+#include <sstream> // for converting values to strings
+
#include "stage.hh"
using namespace Stg;
-//using names
+
Ancestor::Ancestor() :
children(),
debug( false ),
- token( NULL ),
+ token(),
access_mutex(),
child_type_counts()
{
@@ -29,31 +31,23 @@
}
// poke a name into the child
- static char* buf = new char[TOKEN_MAX]; // allocated once
+ std::ostringstream name;
// printf( "adding child of type %d token %s\n", mod->type, mod->Token() );
- std::string typestr = mod->type;
-
- if( token ) // if this object has a name, use it
- snprintf( buf, TOKEN_MAX, "%s.%s:%d",
- token,
- typestr.c_str(),
- child_type_counts[mod->type] );
- else
- snprintf( buf, TOKEN_MAX, "%s:%d",
- typestr.c_str(),
- child_type_counts[mod->type] );
-
- //printf( "%s generated a name for my child %s\n", token, buf );
-
- mod->SetToken( buf );
-
+ // if this object has a name, use it
+ if( token.size() )
+ name << this->token << '.';
+
+ name << mod->type << ':' << child_type_counts[mod->type];
+
+ // printf( "%s generated a name for my child %s\n", Token(),
name.str().c_str() );
+
+ mod->SetToken( name.str() );
+
children.push_back( mod );
-
- child_type_counts[mod->type]++;
-
- //delete[] buf; // no need to free the statically allocated buffer
+
+ child_type_counts[mod->type]++;
}
void Ancestor::RemoveChild( Model* mod )
Modified: code/stage/trunk/libstage/block.cc
===================================================================
--- code/stage/trunk/libstage/block.cc 2009-09-23 01:47:01 UTC (rev 8263)
+++ code/stage/trunk/libstage/block.cc 2009-09-26 01:28:12 UTC (rev 8264)
@@ -43,7 +43,7 @@
mpts(),
pt_count(0),
pts(),
- color(0),
+ color(),
inherit_color(true),
rendered_cells( new CellPtrVec ),
candidate_cells( new CellPtrVec )
@@ -408,39 +408,6 @@
glEnd();
}
-void Block::Draw( Model* mod )
-{
- // draw filled color polygons
- Color col = inherit_color ? mod->color : color;
-
- col.Print( "block color" );
-
- mod->PushColor( col );
- glEnable(GL_POLYGON_OFFSET_FILL);
- glPolygonOffset(1.0, 1.0);
- DrawSides();
- DrawTop();
- glDisable(GL_POLYGON_OFFSET_FILL);
-
- // draw the block outline in a darker version of the same color
- mod->PushColor( Color( col.r/2.0, col.g/2.0, col.b/2.0, col.a ));
-
- glPolygonMode( GL_FRONT_AND_BACK, GL_LINE );
- glDepthMask(GL_FALSE);
- DrawTop();
- DrawSides();
- glDepthMask(GL_TRUE);
- glPolygonMode( GL_FRONT_AND_BACK, GL_FILL );
-
- if( glow > 0.0 )
- {
-
- }
-
- mod->PopColor();
- mod->PopColor();
-}
-
void Block::DrawSolid()
{
DrawSides();
@@ -468,8 +435,8 @@
local_z.min = wf->ReadTupleLength( entity, "z", 0, 0.0 );
local_z.max = wf->ReadTupleLength( entity, "z", 1, 1.0 );
- const char* colorstr = wf->ReadString( entity, "color", NULL );
- if( colorstr )
+ const std::string& colorstr = wf->ReadString( entity, "color", "" );
+ if( colorstr != "" )
{
color = Color( colorstr );
inherit_color = false;
Modified: code/stage/trunk/libstage/blockgroup.cc
===================================================================
--- code/stage/trunk/libstage/blockgroup.cc 2009-09-23 01:47:01 UTC (rev
8263)
+++ code/stage/trunk/libstage/blockgroup.cc 2009-09-26 01:28:12 UTC (rev
8264)
@@ -248,19 +248,19 @@
AppendBlock( new Block( mod, wf, entity ));
}
-void BlockGroup::LoadBitmap( Model* mod, const char* bitmapfile, Worldfile* wf
)
+void BlockGroup::LoadBitmap( Model* mod, const std::string& bitmapfile,
Worldfile* wf )
{
PRINT_DEBUG1( "attempting to load bitmap \"%s\n", bitmapfile );
char full[_POSIX_PATH_MAX];
if( bitmapfile[0] == '/' )
- strcpy( full, bitmapfile );
+ strncpy( full, bitmapfile.c_str(), _POSIX_PATH_MAX );
else
{
char *tmp = strdup(wf->filename.c_str());
snprintf( full, _POSIX_PATH_MAX,
- "%s/%s", dirname(tmp), bitmapfile );
+ "%s/%s", dirname(tmp),
bitmapfile.c_str() );
free(tmp);
}
Modified: code/stage/trunk/libstage/canvas.cc
===================================================================
--- code/stage/trunk/libstage/canvas.cc 2009-09-23 01:47:01 UTC (rev 8263)
+++ code/stage/trunk/libstage/canvas.cc 2009-09-26 01:28:12 UTC (rev 8264)
@@ -66,7 +66,7 @@
starty( -1 ),
selected_models(),
last_selection( NULL ),
- interval( 20 ), // msec between redraws
+ interval( 40 ), // msec between redraws
// initialize Option objects
// showBlinken( "Blinkenlights", "show_blinkenlights", "", true, world ),
showBBoxes( "Debug/Bounding boxes", "show_boundingboxes", "^b", false, world
),
Modified: code/stage/trunk/libstage/color.cc
===================================================================
--- code/stage/trunk/libstage/color.cc 2009-09-23 01:47:01 UTC (rev 8263)
+++ code/stage/trunk/libstage/color.cc 2009-09-26 01:28:12 UTC (rev 8264)
@@ -21,15 +21,12 @@
fabs(a-other.a) > epsilon );
}
-Color::Color( const char *name) :
+Color::Color( const std::string& name) :
r(1), g(0), b(0), a(1)
{
- if( name == NULL ) // no string?
+ if( name == "" ) // empty string?
return; // red
- if( strcmp( name, "" ) == 0 ) // empty string?
- return; // red
-
static FILE *file = NULL;
static std::map<std::string,Color> table;
Modified: code/stage/trunk/libstage/model.cc
===================================================================
--- code/stage/trunk/libstage/model.cc 2009-09-23 01:47:01 UTC (rev 8263)
+++ code/stage/trunk/libstage/model.cc 2009-09-26 01:28:12 UTC (rev 8264)
@@ -274,7 +274,7 @@
props(),
rastervis(),
rebuild_displaylist(true),
- say_string(NULL),
+ say_string(),
stall(false),
subs(0),
thread_safe( false ),
@@ -282,7 +282,7 @@
trail_length(50),
trail_interval(5),
type(type),
- event_queue_num( -1 ),
+ event_queue_num( 0 ),
used(false),
velocity(),
watts(0.0),
@@ -296,10 +296,10 @@
//assert( modelsbyid );
assert( world );
- PRINT_DEBUG3( "Constructing model world: %s parent: %s type: %d ",
- world->Token(),
- parent ? parent->Token() : "(null)",
- type );
+ PRINT_DEBUG3( "Constructing model world: %s parent: %s type: %s \n",
+ world->Token(),
+ parent ? parent->Token() : "(null)",
+ type.c_str() );
modelsbyid[id] = this;
@@ -310,7 +310,7 @@
else
{
world->AddChild( this );
- // top level models are draggable in the GUI
+ // top level models are draggable in the GUI by default
gui.move = true;
}
@@ -323,7 +323,7 @@
AddVisualizer( &rastervis, false );
- PRINT_DEBUG2( "finished model %s @ %p", this->token, this );
+ PRINT_DEBUG2( "finished model %s @ %p", this->Token(), this );
}
Model::~Model( void )
@@ -355,8 +355,7 @@
// find the queue for update events: zero if thread safe, else we
// ask the world to assign us to a queue
- if( event_queue_num < 1 )
- event_queue_num = thread_safe ? world->GetEventQueue( this ) : 0;
+ event_queue_num = thread_safe ? world->GetEventQueue( this ) : 0;
CallCallbacks( &hooks.init );
@@ -366,7 +365,7 @@
void Model::InitRecursive()
{
- // init children first
+ // must init children first
FOR_EACH( it, children )
(*it)->InitRecursive();
@@ -541,11 +540,9 @@
}
-void Model::Say( const char* str )
+void Model::Say( const std::string& str )
{
- if( say_string )
- free( say_string );
- say_string = strdup( str );
+ say_string = str;
}
// returns true iff model [testmod] is an antecedent of this model
@@ -673,12 +670,12 @@
printf( "%s model ", prefix );
else
printf( "Model ");
-
+
printf( "%s:%s\n",
- // id,
- world->Token(),
- token );
-
+ // id,
+ world->Token(),
+ token.c_str() );
+
FOR_EACH( it, children )
(*it)->Print( prefix );
}
@@ -689,8 +686,8 @@
static char txt[256];
snprintf(txt, sizeof(txt), "%s @ [%.2f,%.2f,%.2f,%.2f]",
- token,
- gpose.x, gpose.y, gpose.z, gpose.a );
+ token.c_str(),
+ gpose.x, gpose.y, gpose.z, gpose.a );
return txt;
}
@@ -975,22 +972,6 @@
return( GetTotalMass() - mass);
}
-Model* Model::GetModel( const char* modelname ) const
-{
- // construct the full model name and look it up
- char* buf = new char[TOKEN_MAX];
- snprintf( buf, TOKEN_MAX, "%s.%s", this->token, modelname );
-
- Model* mod = world->GetModel( buf );
-
- if( mod == NULL )
- PRINT_WARN1( "Model %s not found", buf );
-
- delete[] buf;
-
- return mod;
-}
-
void Model::UnMap()
{
blockgroup.UnMap();
@@ -1047,6 +1028,23 @@
CallCallbacks( &this->friction );
}
+Model* Model::GetChild( const std::string& modelname ) const
+{
+ // construct the full model name and look it up
+ //char* buf = new char[TOKEN_MAX];
+ //snprintf( buf, TOKEN_MAX, "%s.%s", this->token, modelname );
+
+ std::string fullname = token + "." + modelname;
+
+ Model* mod = world->GetModel( fullname );
+
+ if( mod == NULL )
+ PRINT_WARN1( "Model %s not found", fullname.c_str() );
+
+ return mod;
+}
+
+
//***************************************************************
// Raster data visualizer
//
Modified: code/stage/trunk/libstage/model_actuator.cc
===================================================================
--- code/stage/trunk/libstage/model_actuator.cc 2009-09-23 01:47:01 UTC (rev
8263)
+++ code/stage/trunk/libstage/model_actuator.cc 2009-09-26 01:28:12 UTC (rev
8264)
@@ -87,28 +87,25 @@
void ModelActuator::Load( void )
{
- Model::Load();
- InitialPose = GetPose();
-
- // load steering mode
- if( wf->PropertyExists( wf_entity, "type" ) )
- {
- const char* type_str =
- wf->ReadString( wf_entity, "type", NULL );
-
- if( type_str )
- {
- if( strcmp( type_str, "linear" ) == 0 )
- actuator_type = TYPE_LINEAR;
- else if( strcmp( type_str, "rotational" ) == 0 )
- actuator_type = TYPE_ROTATIONAL;
- else
+ Model::Load();
+ InitialPose = GetPose();
+
+ // load steering mode
+ if( wf->PropertyExists( wf_entity, "type" ) )
+ {
+ const std::string& type_str =
+ wf->ReadString( wf_entity, "type", "linear" );
+
+ if( type_str == "linear" )
+ actuator_type = TYPE_LINEAR;
+ else if ( type_str == "rotational" )
+ actuator_type = TYPE_ROTATIONAL;
+ else
{
- PRINT_ERR1( "invalid actuator type specified:
\"%s\" - should be one of: \"linear\" or \"rotational\". Using \"linear\" as
default.", type_str );
+ PRINT_ERR1( "invalid actuator type specified: \"%s\"
- should be one of: \"linear\" or \"rotational\". Using \"linear\" as
default.", type_str.c_str() );
}
- }
- }
-
+ }
+
if (actuator_type == TYPE_LINEAR)
{
// if we are a linear actuator find the axis we operate in
Modified: code/stage/trunk/libstage/model_draw.cc
===================================================================
--- code/stage/trunk/libstage/model_draw.cc 2009-09-23 01:47:01 UTC (rev
8263)
+++ code/stage/trunk/libstage/model_draw.cc 2009-09-26 01:28:12 UTC (rev
8264)
@@ -19,7 +19,7 @@
char buf[64];
snprintf( buf, 63, "%s [%.2f %.2f %.2f %.2f]",
- token, gpose.x, gpose.y, gpose.z, rtod(gpose.a) );
+ token.c_str(), gpose.x, gpose.y, gpose.z,
rtod(gpose.a) );
PushColor( 0,0,0,1 ); // text color black
Gl::draw_string( 0.5,0.5,0.5, buf );
@@ -50,52 +50,52 @@
void Model::DrawTrailFootprint()
{
- double darkness = 0;
- double fade = 0.5 / (double)(trail_length+1);
+ double darkness = 0;
+ double fade = 0.5 / (double)(trail_length+1);
- PushColor( 0,0,0,1 ); // dummy pushL just saving the color
+ PushColor( 0,0,0,1 ); // dummy pushL just saving the color
- FOR_EACH( it, trail )
- {
- TrailItem& checkpoint = *it;
+ FOR_EACH( it, trail )
+ {
+ TrailItem& checkpoint = *it;
- glPushMatrix();
- Pose pz = checkpoint.pose;
+ glPushMatrix();
+ Pose pz = checkpoint.pose;
- Gl::pose_shift( pz );
- Gl::pose_shift( geom.pose );
+ Gl::pose_shift( pz );
+ Gl::pose_shift( geom.pose );
- darkness += fade;
- Color c = checkpoint.color;
- c.a = darkness;
- glColor4f( c.r, c.g, c.b, c.a );
+ darkness += fade;
+ Color c = checkpoint.color;
+ c.a = darkness;
+ glColor4f( c.r, c.g, c.b, c.a );
- blockgroup.DrawFootPrint( geom );
+ blockgroup.DrawFootPrint( geom );
- glPopMatrix();
+ glPopMatrix();
}
- PopColor();
+ PopColor();
}
void Model::DrawTrailBlocks()
{
double timescale = 0.0000001;
- FOR_EACH( it, trail )
- {
- TrailItem& checkpoint = *it;
+ FOR_EACH( it, trail )
+ {
+ TrailItem& checkpoint = *it;
- glPushMatrix();
- Pose pz = checkpoint.pose;
- pz.z = (world->sim_time - checkpoint.time) * timescale;
+ glPushMatrix();
+ Pose pz = checkpoint.pose;
+ pz.z = (world->sim_time - checkpoint.time) * timescale;
- Gl::pose_shift( pz );
- Gl::pose_shift( geom.pose );
+ Gl::pose_shift( pz );
+ Gl::pose_shift( geom.pose );
- DrawBlocks();
+ DrawBlocks();
- glPopMatrix();
+ glPopMatrix();
}
}
@@ -283,7 +283,7 @@
void Model::DrawStatus( Camera* cam )
{
- if( say_string || power_pack )
+ if( power_pack || !say_string.empty() )
{
float yaw, pitch;
pitch = - cam->pitch();
@@ -302,70 +302,70 @@
glRotatef( -pitch, 1,0,0 );
if( power_pack )
- power_pack->Visualize( cam );
+ power_pack->Visualize( cam );
- if( say_string )
- {
- glPolygonMode( GL_FRONT_AND_BACK, GL_FILL );
+ if( !say_string.empty() )
+ {
+ glPolygonMode( GL_FRONT_AND_BACK, GL_FILL );
+
+ //get raster positition, add gl_width, then project
back to world coords
+ glRasterPos3f( 0, 0, 0 );
+ GLfloat pos[ 4 ];
+ glGetFloatv(GL_CURRENT_RASTER_POSITION, pos);
+
+ GLboolean valid;
+ glGetBooleanv( GL_CURRENT_RASTER_POSITION_VALID,
&valid );
- //get raster positition, add gl_width, then project back to world
coords
- glRasterPos3f( 0, 0, 0 );
- GLfloat pos[ 4 ];
- glGetFloatv(GL_CURRENT_RASTER_POSITION, pos);
-
- GLboolean valid;
- glGetBooleanv( GL_CURRENT_RASTER_POSITION_VALID, &valid );
-
- if( valid )
- {
- //fl_font( FL_HELVETICA, 12 );
- float w = gl_width( this->say_string ); // scaled text width
- float h = gl_height(); // scaled text height
+ if( valid )
+ {
+ //fl_font( FL_HELVETICA, 12 );
+ float w = gl_width( this->say_string.c_str()
); // scaled text width
+ float h = gl_height(); // scaled text height
+
+ GLdouble wx, wy, wz;
+ GLint viewport[4];
+ glGetIntegerv(GL_VIEWPORT, viewport);
+
+ GLdouble modelview[16];
+ glGetDoublev(GL_MODELVIEW_MATRIX, modelview);
+
+ GLdouble projection[16];
+ glGetDoublev(GL_PROJECTION_MATRIX,
projection);
- GLdouble wx, wy, wz;
- GLint viewport[4];
- glGetIntegerv(GL_VIEWPORT, viewport);
+ //get width and height in world coords
+ gluUnProject( pos[0] + w, pos[1], pos[2],
modelview, projection, viewport, &wx, &wy, &wz );
+ w = wx;
+ gluUnProject( pos[0], pos[1] + h, pos[2],
modelview, projection, viewport, &wx, &wy, &wz );
+ h = wy;
- GLdouble modelview[16];
- glGetDoublev(GL_MODELVIEW_MATRIX, modelview);
+ // calculate speech bubble margin
+ const float m = h/10;
- GLdouble projection[16];
- glGetDoublev(GL_PROJECTION_MATRIX, projection);
+ // draw inside of bubble
+ PushColor( BUBBLE_FILL );
+ glPushAttrib( GL_POLYGON_BIT | GL_LINE_BIT );
+ glPolygonMode( GL_FRONT, GL_FILL );
+ glEnable( GL_POLYGON_OFFSET_FILL );
+ glPolygonOffset( 1.0, 1.0 );
+ Gl::draw_octagon( w, h, m );
+ glDisable( GL_POLYGON_OFFSET_FILL );
+ PopColor();
- //get width and height in world coords
- gluUnProject( pos[0] + w, pos[1], pos[2], modelview, projection,
viewport, &wx, &wy, &wz );
- w = wx;
- gluUnProject( pos[0], pos[1] + h, pos[2], modelview, projection,
viewport, &wx, &wy, &wz );
- h = wy;
+ // draw outline of bubble
+ PushColor( BUBBLE_BORDER );
+ glLineWidth( 1 );
+ glEnable( GL_LINE_SMOOTH );
+ glPolygonMode( GL_FRONT, GL_LINE );
+ Gl::draw_octagon( w, h, m );
+ glPopAttrib();
+ PopColor();
- // calculate speech bubble margin
- const float m = h/10;
-
- // draw inside of bubble
- PushColor( BUBBLE_FILL );
- glPushAttrib( GL_POLYGON_BIT | GL_LINE_BIT );
- glPolygonMode( GL_FRONT, GL_FILL );
- glEnable( GL_POLYGON_OFFSET_FILL );
- glPolygonOffset( 1.0, 1.0 );
- Gl::draw_octagon( w, h, m );
- glDisable( GL_POLYGON_OFFSET_FILL );
- PopColor();
-
- // draw outline of bubble
- PushColor( BUBBLE_BORDER );
- glLineWidth( 1 );
- glEnable( GL_LINE_SMOOTH );
- glPolygonMode( GL_FRONT, GL_LINE );
- Gl::draw_octagon( w, h, m );
- glPopAttrib();
- PopColor();
-
- PushColor( BUBBLE_TEXT );
- // draw text inside the bubble
- Gl::draw_string( m, 2.5*m, 0, this->say_string );
- PopColor();
- }
- }
+ PushColor( BUBBLE_TEXT );
+ // draw text inside the bubble
+ Gl::draw_string( m, 2.5*m, 0,
this->say_string.c_str() );
+ PopColor();
+ }
+ }
glPopMatrix();
}
@@ -375,14 +375,14 @@
}
// extern GLuint glowTex;
-// extern GLuint checkTex;
+ // extern GLuint checkTex;
-// if( parent == NULL )
-// {
-// glBlendFunc(GL_SRC_COLOR, GL_ONE );
-// DrawImage( glowTex, cam, 1.0 );
-// glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA );
-// }
+ // if( parent == NULL )
+ // {
+ // glBlendFunc(GL_SRC_COLOR, GL_ONE );
+ // DrawImage( glowTex, cam, 1.0 );
+ // glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA );
+ // }
}
void Model::DrawImage( uint32_t texture_id, Camera* cam, float alpha,
@@ -421,14 +421,14 @@
glBindTexture( GL_TEXTURE_2D, 0 );
glDisable(GL_TEXTURE_2D);
-// glPolygonMode( GL_FRONT, GL_LINE );
-// glColor3f( 0,0,1 );
-// glBegin(GL_QUADS);
-// glVertex3f(-0.25f, 0, -0.25f );
-// glVertex3f( 0.25f, 0, -0.25f );
-// glVertex3f( 0.25f, 0, 0.25f );
-// glVertex3f(-0.25f, 0, 0.25f );
-// glEnd();
+ // glPolygonMode( GL_FRONT, GL_LINE );
+ // glColor3f( 0,0,1 );
+ // glBegin(GL_QUADS);
+ // glVertex3f(-0.25f, 0, -0.25f );
+ // glVertex3f( 0.25f, 0, -0.25f );
+ // glVertex3f( 0.25f, 0, 0.25f );
+ // glVertex3f(-0.25f, 0, 0.25f );
+ // glEnd();
glPopMatrix();
}
Modified: code/stage/trunk/libstage/model_load.cc
===================================================================
--- code/stage/trunk/libstage/model_load.cc 2009-09-23 01:47:01 UTC (rev
8263)
+++ code/stage/trunk/libstage/model_load.cc 2009-09-26 01:28:12 UTC (rev
8264)
@@ -54,21 +54,21 @@
if( wf->PropertyExists( wf_entity, "debug" ) )
{
PRINT_WARN2( "debug property specified for model %d %s\n",
- wf_entity, this->token );
+ wf_entity, this->token.c_str()
);
this->debug = wf->ReadInt( wf_entity, "debug", this->debug );
}
if( wf->PropertyExists( wf_entity, "name" ) )
{
- char *name = (char*)wf->ReadString(wf_entity, "name", NULL );
- if( name )
+ const std::string& name = wf->ReadString(wf_entity, "name", token );
+ if( name != token )
{
//printf( "adding name %s to %s\n", name, this->token
);
- this->token = strdup( name );
- world->AddModel( this ); // add this name to the
world's table
+ this->token = name ;
+ world->AddModelName( this, name ); // add this name to
the world's table
}
else
- PRINT_ERR1( "Name blank for model %s. Check your
worldfile\n", this->token );
+ PRINT_ERR1( "Name blank for model %s. Check your
worldfile\n", this->token.c_str() );
}
//PRINT_WARN1( "%s::Load", token );
@@ -104,23 +104,22 @@
if( wf->PropertyExists( wf_entity, "color" ))
{
Color col( 1,0,0 ); // red;
- const char* colorstr = wf->ReadString( wf_entity, "color", NULL
);
- if( colorstr )
- {
- if( strcmp( colorstr, "random"
) == 0 )
- col = Color( drand48(),
drand48(), drand48() );
- else
- col = Color( colorstr );
- }
- this->SetColor( col );
- }
-
-
+ const std::string& colorstr = wf->ReadString( wf_entity,
"color", "" );
+ if( colorstr != "" )
+ {
+ if( colorstr == "random" )
+ col = Color( drand48(), drand48(), drand48() );
+ else
+ col = Color( colorstr );
+ }
+ this->SetColor( col );
+ }
+
if( wf->PropertyExists( wf_entity, "color_rgba" ))
{
if (wf->GetProperty(wf_entity,"color_rgba")->values.size() < 4)
{
- PRINT_ERR1( "model %s color_rgba requires 4 values\n", this->token );
+ PRINT_ERR1( "model %s color_rgba requires 4 values\n",
this->token.c_str() );
}
else
{
@@ -145,8 +144,9 @@
if( wf->PropertyExists( wf_entity, "bitmap" ) )
{
- const char* bitmapfile = wf->ReadString( wf_entity, "bitmap", NULL );
- assert( bitmapfile );
+ const std::string bitmapfile = wf->ReadString( wf_entity, "bitmap", "" );
+ if( bitmapfile == "" )
+ PRINT_WARN1( "model %s specified empty bitmap filename\n",
token.c_str() );
if( has_default_block )
{
@@ -206,13 +206,13 @@
if( CProperty* ctrlp = wf->GetProperty( wf_entity, "ctrl" ) )
{
- for( int index=0; index < ctrlp->values.size(); index++ )
+ for( unsigned int index=0; index < ctrlp->values.size();
index++ )
{
const char* lib = wf->GetPropertyValue( ctrlp, index );
if( !lib )
- printf( "Error - NULL library name specified
for model %s\n", token );
+ printf( "Error - NULL library name specified
for model %s\n", token.c_str() );
else
LoadControllerModule( lib );
}
@@ -220,7 +220,7 @@
if( wf->PropertyExists( wf_entity, "say" ))
- this->Say( wf->ReadString(wf_entity, "say", NULL ));
+ this->Say( wf->ReadString(wf_entity, "say", "" ));
trail_length = wf->ReadInt( wf_entity, "trail_length", trail_length );
trail_interval = wf->ReadInt( wf_entity, "trail_interval",
trail_interval );
@@ -234,9 +234,9 @@
MapWithChildren();
if( this->debug )
- printf( "Model \"%s\" is in debug mode\n", token );
+ printf( "Model \"%s\" is in debug mode\n", token.c_str() );
- PRINT_DEBUG1( "Model \"%s\" loading complete", token );
+ PRINT_DEBUG1( "Model \"%s\" loading complete", token.c_str() );
}
@@ -340,9 +340,6 @@
}
fflush(stdout);
-
- // as we now have a controller, the world needs to call our update function
- //StartUpdating();
}
Modified: code/stage/trunk/libstage/model_position.cc
===================================================================
--- code/stage/trunk/libstage/model_position.cc 2009-09-23 01:47:01 UTC (rev
8263)
+++ code/stage/trunk/libstage/model_position.cc 2009-09-26 01:28:12 UTC (rev
8264)
@@ -119,24 +119,20 @@
// load steering mode
if( wf->PropertyExists( wf_entity, "drive" ) )
{
- const char* mode_str =
- wf->ReadString( wf_entity, "drive", NULL );
+ const std::string& mode_str =
+ wf->ReadString( wf_entity, "drive", "diff" );
- if( mode_str )
- {
- if( strcmp( mode_str, "diff" ) == 0 )
- drive_mode = DRIVE_DIFFERENTIAL;
- else if( strcmp( mode_str, "omni" ) == 0 )
- drive_mode = DRIVE_OMNI;
- else if( strcmp( mode_str, "car" ) == 0 )
- drive_mode = DRIVE_CAR;
- else
- {
- PRINT_ERR1( "invalid position drive mode
specified: \"%s\" - should be one of: \"diff\", \"omni\" or \"car\". Using
\"diff\" as default.", mode_str );
- }
- }
- }
-
+ if( mode_str == "diff" )
+ drive_mode = DRIVE_DIFFERENTIAL;
+ else if( mode_str == "omni" )
+ drive_mode = DRIVE_OMNI;
+ else if( mode_str == "car" )
+ drive_mode = DRIVE_CAR;
+ else
+ PRINT_ERR1( "invalid position drive mode specified: \"%s\" -
should be one of: \"diff\", \"omni\" or \"car\". Using \"diff\" as default.",
mode_str.c_str() );
+
+ }
+
// load odometry if specified
if( wf->PropertyExists( wf_entity, "odom" ) )
{
@@ -144,7 +140,7 @@
" but this property is no
longer available."
" Use localization_origin
instead. See the position"
" entry in the manual or
src/model_position.c for details.",
- this->token );
+ this->token.c_str() );
}
// set the starting pose as my initial odom position. This could be
@@ -190,24 +186,18 @@
// choose a localization model
if( wf->PropertyExists( wf_entity, "localization" ) )
{
- const char* loc_str =
- wf->ReadString( wf_entity, "localization", NULL );
-
- if( loc_str )
- {
- if( strcmp( loc_str, "gps" ) == 0 )
- localization_mode = LOCALIZATION_GPS;
- else if( strcmp( loc_str, "odom" ) == 0 )
- localization_mode = LOCALIZATION_ODOM;
- else
- PRINT_ERR2( "unrecognized localization mode
\"%s\" for model \"%s\"."
- " Valid choices
are \"gps\" and \"odom\".",
- loc_str,
this->token );
- }
- else
- PRINT_ERR1( "no localization mode string specified for model
\"%s\"",
- this->token );
- }
+ const std::string& loc_str =
+ wf->ReadString( wf_entity, "localization", "gps" );
+
+ if( loc_str == "gps" )
+ localization_mode = LOCALIZATION_GPS;
+ else if( loc_str == "odom" )
+ localization_mode = LOCALIZATION_ODOM;
+ else
+ PRINT_ERR2( "unrecognized localization mode \"%s\" for model
\"%s\"."
+ " Valid choices are \"gps\"
and \"odom\".",
+ loc_str.c_str(),
this->token.c_str() );
+ }
}
void ModelPosition::Update( void )
@@ -400,7 +390,7 @@
default:
PRINT_ERR2( "unknown localization mode %d for model %s\n",
- localization_mode, this->token
);
+ localization_mode,
this->token.c_str() );
break;
}
@@ -654,9 +644,8 @@
ModelPosition::Waypoint::Waypoint()
+ : pose(), color()
{
- pose = Pose( 0,0,0,0 );
- color = 0;
};
Modified: code/stage/trunk/libstage/stage.hh
===================================================================
--- code/stage/trunk/libstage/stage.hh 2009-09-23 01:47:01 UTC (rev 8263)
+++ code/stage/trunk/libstage/stage.hh 2009-09-26 01:28:12 UTC (rev 8264)
@@ -218,7 +218,7 @@
/** Look up the color in the X11-style database. If the color is
not found in the database, a cheerful red color will be used
instead. */
- Color( const char* name );
+ Color( const std::string& name );
Color();
@@ -649,15 +649,15 @@
protected:
ModelPtrVec children;
bool debug;
- char* token;
+ std::string token;
pthread_mutex_t access_mutex; ///< Used by Lock() and Unlock() to
prevent parallel access to this model
void Load( Worldfile* wf, int section );
void Save( Worldfile* wf, int section );
public:
- /** The maximum length of a Stage model identifier string */
- static const uint32_t TOKEN_MAX = 64;
+ /* The maximum length of a Stage model identifier string */
+ //static const uint32_t TOKEN_MAX = 64;
/** get the children of the this element */
ModelPtrVec& GetChildren(){ return children;}
@@ -676,10 +676,13 @@
virtual Pose GetGlobalPose();
const char* Token()
- { return token; }
+ { return token.c_str(); }
- void SetToken( const char* str )
- { token = strdup( str ); } // minor memory leak
+ //const std::string& Token()
+ //{ return token; }
+
+ void SetToken( const std::string& str )
+ { token = str; }
void Lock(){ pthread_mutex_lock( &access_mutex ); }
void Unlock(){ pthread_mutex_unlock( &access_mutex ); }
@@ -941,6 +944,8 @@
virtual void AddModel( Model* mod );
virtual void RemoveModel( Model* mod );
+
+ void AddModelName( Model* mod, const std::string& name );
void AddPowerPack( PowerPack* pp );
void RemovePowerPack( PowerPack* pp );
@@ -994,8 +999,8 @@
public:
/** returns true when time to quit, false otherwise */
static bool UpdateAll();
-
- World( const char* token = "MyWorld",
+
+ World( const std::string& name = "MyWorld",
double ppm = DEFAULT_PPM );
virtual ~World();
@@ -1026,7 +1031,7 @@
/** Returns a pointer to the model identified by name, or NULL if
nonexistent */
- Model* GetModel( const char* name ) const;
+ Model* GetModel( const std::string& name ) const;
/** Return the 3D bounding box of the world, in meters */
const stg_bounds3d_t& GetExtent(){ return extent; };
@@ -1078,7 +1083,6 @@
/** draw the block in OpenGL as a solid single color */
void DrawSolid();
- void Draw( Model* mod );
/** draw the projection of the block onto the z=0 plane */
void DrawFootPrint();
@@ -1217,7 +1221,7 @@
/** Draw the projection of the block onto the z=0 plane. */
void DrawFootPrint( const Geom &geom);
- void LoadBitmap( Model* mod, const char* bitmapfile, Worldfile *wf );
+ void LoadBitmap( Model* mod, const std::string& bitmapfile, Worldfile *wf
);
void LoadBlock( Model* mod, Worldfile* wf, int entity );
void Rasterize( uint8_t* data,
@@ -1781,7 +1785,7 @@
} rastervis;
bool rebuild_displaylist; ///< iff true, regenerate block display list
before redraw
- char* say_string; ///< if non-null, this string is displayed in the
GUI
+ std::string say_string; ///< if non-null, this string is displayed
in the GUI
stg_bool_t stall;
int subs; ///< the number of subscriptions to this model
@@ -1815,7 +1819,7 @@
const std::string type;
/** The index into the world's vector of event queues. Initially
-1, to indicate that it is not on a list yet. */
- int event_queue_num;
+ unsigned int event_queue_num;
bool used; ///< TRUE iff this model has been returned by
GetUnusedModelOfType()
Velocity velocity;
stg_watts_t watts;///< power consumed by this model
@@ -1838,6 +1842,10 @@
const std::string& GetModelType() const {return type;}
std::string GetSayString(){return std::string(say_string);}
+ /** Returns a pointer to the model identified by name, or NULL if
+ it doesn't exist in this world. */
+ Model* GetChild( const std::string& name ) const;
+
class Visibility
{
public:
@@ -2011,7 +2019,7 @@
/** Destructor */
virtual ~Model();
- void Say( const char* str );
+ void Say( const std::string& str );
/** Attach a user supplied visualization to a model. */
void AddVisualizer( Visualizer* custom_visual, bool on_by_default );
@@ -2095,9 +2103,6 @@
model has no parent */
Model* Parent() const { return this->parent; }
- Model* GetModel( const char* name ) const;
- //int GuiMask(){ return this->gui_mask; };
-
/** Returns a pointer to the world that contains this model */
World* GetWorld() const { return this->world; }
Modified: code/stage/trunk/libstage/world.cc
===================================================================
--- code/stage/trunk/libstage/world.cc 2009-09-23 01:47:01 UTC (rev 8263)
+++ code/stage/trunk/libstage/world.cc 2009-09-26 01:28:12 UTC (rev 8264)
@@ -97,7 +97,7 @@
std::set<World*> World::world_set;
std::string World::ctrlargs;
-World::World( const char* token,
+World::World( const std::string& name,
double ppm )
:
// private
@@ -148,7 +148,7 @@
World::~World( void )
{
- PRINT_DEBUG2( "destroying world %d %s", id, token );
+ PRINT_DEBUG2( "destroying world %d %s", id, token.c_str() );
if( wf ) delete wf;
World::world_set.erase( this );
}
@@ -310,7 +310,7 @@
int entity = 0;
- this->token = (char*)
+ this->token =
wf->ReadString( entity, "name", this->token );
this->quit_time =
@@ -391,7 +391,7 @@
// todo - clean up regions & superregions?
- token = NULL;
+ token = "[unloaded]";
}
bool World::PastQuitTime()
@@ -549,11 +549,17 @@
return false;
}
-void World::AddModel( Model* mod )
+void World::AddModel( Model* mod )
{
models_by_name[mod->token] = mod;
}
+void World::AddModelName( Model* mod, const std::string& name )
+{
+ models_by_name[name] = mod;
+}
+
+
unsigned int World::GetEventQueue( Model* mod )
{
if( worker_threads < 1 )
@@ -561,16 +567,16 @@
return( (random() % worker_threads) + 1);
}
-Model* World::GetModel( const char* name ) const
+Model* World::GetModel( const std::string& name ) const
{
- PRINT_DEBUG1( "looking up model name %s in models_by_name", name );
+ PRINT_DEBUG1( "looking up model name %s in models_by_name", name.c_str() );
std::map<std::string,Model*>::const_iterator it =
models_by_name.find( name );
if( it == models_by_name.end() )
{
- PRINT_WARN1( "lookup of model name %s: no matching name", name );
+ PRINT_WARN1( "lookup of model name %s: no matching name", name.c_str() );
return NULL;
}
else
Modified: code/stage/trunk/libstage/worldfile.cc
===================================================================
--- code/stage/trunk/libstage/worldfile.cc 2009-09-23 01:47:01 UTC (rev
8263)
+++ code/stage/trunk/libstage/worldfile.cc 2009-09-26 01:28:12 UTC (rev
8264)
@@ -163,23 +163,23 @@
DumpProperties();
return false;
}
-
+
// Work out what the length units are
- const char *unit = ReadString(0, "unit_length", "m");
- if (strcmp(unit, "m") == 0)
+ const std::string& unitl = ReadString(0, "unit_length", "m");
+ if( unitl == "m")
this->unit_length = 1.0;
- else if (strcmp(unit, "cm") == 0)
+ else if( unitl == "cm")
this->unit_length = 0.01;
- else if (strcmp(unit, "mm") == 0)
+ else if( unitl == "mm")
this->unit_length = 0.001;
-
+
// Work out what the angle units are
- unit = ReadString(0, "unit_angle", "degrees");
- if (strcmp(unit, "degrees") == 0)
+ const std::string& unita = ReadString(0, "unit_angle", "degrees");
+ if( unita == "degrees")
this->unit_angle = M_PI / 180;
- else if (strcmp(unit, "radians") == 0)
+ else if( unita == "radians")
this->unit_angle = 1;
-
+
return true;
}
@@ -1376,7 +1376,7 @@
///////////////////////////////////////////////////////////////////////////
// Read a string
-const char *Worldfile::ReadString(int entity, const char *name, const char
*value)
+const std::string Worldfile::ReadString(int entity, const char *name, const
std::string& value)
{
CProperty* property = GetProperty(entity, name);
if (property == NULL )
@@ -1387,12 +1387,12 @@
///////////////////////////////////////////////////////////////////////////
// Write a string
-void Worldfile::WriteString(int entity, const char *name, const char *value)
+void Worldfile::WriteString(int entity, const char *name, const std::string
&value)
{
CProperty* property = GetProperty(entity, name);
if( property == NULL )
return;
- SetPropertyValue(property, 0, value);
+ SetPropertyValue(property, 0, value.c_str());
}
Modified: code/stage/trunk/libstage/worldfile.hh
===================================================================
--- code/stage/trunk/libstage/worldfile.hh 2009-09-23 01:47:01 UTC (rev
8263)
+++ code/stage/trunk/libstage/worldfile.hh 2009-09-26 01:28:12 UTC (rev
8264)
@@ -85,12 +85,12 @@
// Check for unused properties and print warnings
public: bool WarnUnused();
-
+
// Read a string
- public: const char *ReadString(int entity, const char *name, const char
*value);
+ public: const std::string ReadString(int entity, const char* name, const
std::string& value);
// Write a string
- public: void WriteString(int entity, const char *name, const char *value);
+ public: void WriteString(int entity, const char *name, const std::string&
value );
// Read an integer
public: int ReadInt(int entity, const char *name, int value);
Modified: code/stage/trunk/libstageplugin/p_driver.cc
===================================================================
--- code/stage/trunk/libstageplugin/p_driver.cc 2009-09-23 01:47:01 UTC (rev
8263)
+++ code/stage/trunk/libstageplugin/p_driver.cc 2009-09-26 01:28:12 UTC (rev
8264)
@@ -577,7 +577,6 @@
switch( interface->addr.interf )
{
case PLAYER_SIMULATION_CODE:
- //world->Update();
// one round of FLTK's update loop.
Fl::wait();
break;
Modified: code/stage/trunk/worlds/benchmark/expand_pioneer.cc
===================================================================
--- code/stage/trunk/worlds/benchmark/expand_pioneer.cc 2009-09-23 01:47:01 UTC
(rev 8263)
+++ code/stage/trunk/worlds/benchmark/expand_pioneer.cc 2009-09-26 01:28:12 UTC
(rev 8264)
@@ -39,14 +39,14 @@
assert( robot->position );
// subscribe to the ranger, which we use for navigating
- robot->ranger = (ModelRanger*)mod->GetModel( "ranger:0" );
+ robot->ranger = (ModelRanger*)mod->GetUnusedModelOfType( "ranger" );
assert( robot->ranger );
// ask Stage to call into our ranger update function
robot->ranger->AddUpdateCallback( (stg_model_callback_t)RangerUpdate, robot
);
// subscribe to the laser, though we don't use it for navigating
- //robot->laser = (ModelLaser*)mod->GetModel( "laser:0" );
+ //robot->laser = (ModelLaser*)mod->GetUnusedModelOfType( "laser" );
//assert( robot->laser );
// start the models updating
Modified: code/stage/trunk/worlds/benchmark/expand_swarm.cc
===================================================================
--- code/stage/trunk/worlds/benchmark/expand_swarm.cc 2009-09-23 01:47:01 UTC
(rev 8263)
+++ code/stage/trunk/worlds/benchmark/expand_swarm.cc 2009-09-26 01:28:12 UTC
(rev 8264)
@@ -37,7 +37,7 @@
robot->position = (ModelPosition*)mod;
// subscribe to the ranger, which we use for navigating
- robot->ranger = (ModelRanger*)mod->GetModel( "ranger:0" );
+ robot->ranger = (ModelRanger*)mod->GetUnusedModelOfType( "ranger" );
assert( robot->ranger );
@@ -45,7 +45,7 @@
robot->ranger->AddUpdateCallback( (stg_model_callback_t)RangerUpdate, robot
);
// subscribe to the laser, though we don't use it for navigating
- //robot->laser = (ModelLaser*)mod->GetModel( "laser:0" );
+ //robot->laser = (ModelLaser*)mod->GetUnusedModelofType( "laser" );
//assert( robot->laser );
// start the models updating
Modified: code/stage/trunk/worlds/fasr.world
===================================================================
--- code/stage/trunk/worlds/fasr.world 2009-09-23 01:47:01 UTC (rev 8263)
+++ code/stage/trunk/worlds/fasr.world 2009-09-26 01:28:12 UTC (rev 8264)
@@ -28,7 +28,7 @@
show_data 1
show_flags 1
- interval 50
+ # interval 50
)
# load an environment bitmap
Modified: code/stage/trunk/worlds/pioneer_flocking.world
===================================================================
--- code/stage/trunk/worlds/pioneer_flocking.world 2009-09-23 01:47:01 UTC
(rev 8263)
+++ code/stage/trunk/worlds/pioneer_flocking.world 2009-09-26 01:28:12 UTC
(rev 8264)
@@ -13,7 +13,7 @@
resolution 0.1
# this is very helpful if you have multiple CPUs - a good value is $(number of
CPU cores) -
-threads 2
+threads 8
# configure the GUI window
window
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
------------------------------------------------------------------------------
Come build with us! The BlackBerry® Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9-12, 2009. Register now!
http://p.sf.net/sfu/devconf
_______________________________________________
Playerstage-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/playerstage-commit