Revision: 7896
http://playerstage.svn.sourceforge.net/playerstage/?rev=7896&view=rev
Author: rtv
Date: 2009-06-25 01:03:24 +0000 (Thu, 25 Jun 2009)
Log Message:
-----------
fixed std::remove bug in Linux
Modified Paths:
--------------
code/stage/trunk/CMakeLists.txt
code/stage/trunk/examples/ctrl/CMakeLists.txt
code/stage/trunk/libstage/ancestor.cc
code/stage/trunk/libstage/model.cc
code/stage/trunk/libstage/stage.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/worlds/simple.world
Modified: code/stage/trunk/CMakeLists.txt
===================================================================
--- code/stage/trunk/CMakeLists.txt 2009-06-24 23:57:57 UTC (rev 7895)
+++ code/stage/trunk/CMakeLists.txt 2009-06-25 01:03:24 UTC (rev 7896)
@@ -53,8 +53,8 @@
${CMAKE_CURRENT_SOURCE_DIR}/config.h
@ONLY)
# Enable -Wall by default
-SET (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall")
-SET (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall")
+SET (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -O2 -Wall")
+SET (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O2 -Wall")
message( STATUS "Checking for libtool" )
find_path( LTDL_INCLUDE_DIR ltdl.h DOC "Libtool include dir" )
@@ -190,7 +190,7 @@
# SET(APPLE_LIBRARIES
"-Wl,-dylib_file,/System/Library/Frameworks/OpenGL.framework/Versions/A/Libraries/libGL.dylib:/System/Library/Frameworks/OpenGL.framework/Versions/A/Libraries/libGL.dylib")
#ENDIF (APPLE)
-MESSAGE( STATUS "Installation directory
CMAKE_INSTALL_PREFIX=${CMAKE_INSTALL_PREFIX}" )
+MESSAGE( STATUS "Installation path
CMAKE_INSTALL_PREFIX=${CMAKE_INSTALL_PREFIX}" )
# all targets need these include directories
include_directories( .
Modified: code/stage/trunk/examples/ctrl/CMakeLists.txt
===================================================================
--- code/stage/trunk/examples/ctrl/CMakeLists.txt 2009-06-24 23:57:57 UTC
(rev 7895)
+++ code/stage/trunk/examples/ctrl/CMakeLists.txt 2009-06-25 01:03:24 UTC
(rev 7896)
@@ -5,7 +5,7 @@
sink
source
wander
-# sort
+ rasterize
)
# need plaer's wavefront planning library for this one
Modified: code/stage/trunk/libstage/ancestor.cc
===================================================================
--- code/stage/trunk/libstage/ancestor.cc 2009-06-24 23:57:57 UTC (rev
7895)
+++ code/stage/trunk/libstage/ancestor.cc 2009-06-25 01:03:24 UTC (rev
7896)
@@ -1,5 +1,6 @@
#include "stage.hh"
using namespace Stg;
+//using names
Ancestor::Ancestor() :
children(),
@@ -47,7 +48,7 @@
void Ancestor::RemoveChild( Model* mod )
{
child_type_counts[mod->type]--;
-
+
children.erase( std::remove( children.begin(), children.end(), mod ) );
}
Modified: code/stage/trunk/libstage/model.cc
===================================================================
--- code/stage/trunk/libstage/model.cc 2009-06-24 23:57:57 UTC (rev 7895)
+++ code/stage/trunk/libstage/model.cc 2009-06-25 01:03:24 UTC (rev 7896)
@@ -1036,10 +1036,10 @@
void Model::Rasterize( uint8_t* data,
- unsigned int width,
- unsigned int height,
- stg_meters_t
cellwidth,
- stg_meters_t
cellheight )
+ unsigned int width,
+ unsigned int height,
+ stg_meters_t cellwidth,
+ stg_meters_t cellheight )
{
rastervis.ClearPts();
blockgroup.Rasterize( data, width, height, cellwidth, cellheight );
Modified: code/stage/trunk/libstage/stage.cc
===================================================================
--- code/stage/trunk/libstage/stage.cc 2009-06-24 23:57:57 UTC (rev 7895)
+++ code/stage/trunk/libstage/stage.cc 2009-06-25 01:03:24 UTC (rev 7896)
@@ -13,6 +13,11 @@
stg_typetable_entry_t Stg::typetable[MODEL_TYPE_COUNT];
+const char* Stg::Version()
+{
+ return VERSION;
+}
+
void Stg::Init( int* argc, char** argv[] )
{
PRINT_DEBUG( "Stg::Init()" );
Modified: code/stage/trunk/libstage/stage.hh
===================================================================
--- code/stage/trunk/libstage/stage.hh 2009-06-24 23:57:57 UTC (rev 7895)
+++ code/stage/trunk/libstage/stage.hh 2009-06-25 01:03:24 UTC (rev 7896)
@@ -47,6 +47,7 @@
#include <list>
#include <map>
#include <set>
+#include <algorithm>
// we use GLib's data structures extensively. Gradually we're moving
// to C++ STL types. May be able to lose this dependency one day.
@@ -60,7 +61,7 @@
#include <FL/Fl_Window.H>
#include <FL/fl_draw.H>
#include <FL/gl.h> // FLTK takes care of platform-specific GL stuff
-// except GLU for some reason
+// except GLU & GLUT
#ifdef __APPLE__
#include <OpenGL/glu.h>
#include <GLUT/glut.h>
@@ -90,6 +91,10 @@
/** returns true iff Stg::Init() has been called. */
bool InitDone();
+ /** returns a human readable string indicating the libstage version
+ number. */
+ const char* Version();
+
/** Create unique identifying numbers for each type of model, and a
count of the number of types. */
typedef enum {
@@ -109,7 +114,6 @@
// types
} stg_model_type_t;
-
/// Copyright string
const char COPYRIGHT[] =
"Copyright Richard Vaughan and contributors 2000-2009";
@@ -979,8 +983,15 @@
void CallUpdateCallbacks(); ///< Call all calbacks in cb_list,
removing any that return true;
+ bool paused; ///< the world only updates when this is false
+
public:
+ void Start(){ paused = false; };
+ void Stop(){ paused = true; };
+ void TogglePause(){ paused = !paused; };
+ bool Paused(){ return( paused ); };
+
std::vector<stg_point_int_t> rt_cells;
std::vector<stg_point_int_t> rt_candidate_cells;
@@ -1483,7 +1494,6 @@
OptionsDlg* oDlg;
unsigned int steps;
bool pause_time;
- bool paused; ///< the world only updates when this is false
stg_usec_t real_time_of_last_update;
void UpdateOptions();
@@ -1538,11 +1548,6 @@
void DrawBoundingBoxTree();
- void Start(){ paused = false; };
- void Stop(){ paused = true; };
- void TogglePause(){ paused = !paused; };
- bool Paused(){ return( paused ); };
-
Canvas* GetCanvas( void ) { return canvas; }
/** show the window - need to call this if you don't Load(). */
Modified: code/stage/trunk/libstage/world.cc
===================================================================
--- code/stage/trunk/libstage/world.cc 2009-06-24 23:57:57 UTC (rev 7895)
+++ code/stage/trunk/libstage/world.cc 2009-06-25 01:03:24 UTC (rev 7896)
@@ -78,7 +78,6 @@
thread_mutex( g_mutex_new() ),
threadpool( NULL ),
total_subs( 0 ),
- //update_jobs_pending(0),
velocity_list( NULL ),
worker_threads( 0 ),
worker_threads_done( g_cond_new() ),
@@ -98,7 +97,8 @@
reentrant_update_list(),
nonreentrant_update_list(),
updates( 0 ),
- wf( NULL )
+ wf( NULL ),
+ paused( false )
{
if( ! Stg::InitDone() )
{
@@ -281,6 +281,9 @@
this->token = (char*)
wf->ReadString( entity, "name", token );
+ this->paused =
+ wf->ReadInt( entity, "paused", this->paused );
+
this->interval_sim = (stg_usec_t)thousand *
wf->ReadInt( entity, "interval_sim",
(int)(this->interval_sim/thousand) );
@@ -489,6 +492,9 @@
return true;
}
+ if( paused )
+ return false;
+
dirty = true; // need redraw
// upate all positions first
@@ -1068,7 +1074,7 @@
{
LogEntry( sim_time, mod);
- printf( "log entry count %lu\n", LogEntry::Count() );
+ printf( "log entry count %d\n", LogEntry::Count() );
//LogEntry::Print();
}
Modified: code/stage/trunk/libstage/worldgui.cc
===================================================================
--- code/stage/trunk/libstage/worldgui.cc 2009-06-24 23:57:57 UTC (rev
7895)
+++ code/stage/trunk/libstage/worldgui.cc 2009-06-25 01:03:24 UTC (rev
7896)
@@ -187,7 +187,6 @@
mbar( new Fl_Menu_Bar(0,0, W, 30)),
oDlg( NULL ),
pause_time( false ),
- paused( false ),
real_time_of_last_update( RealTimeNow() )
{
for( unsigned int i=0; i<INTERVAL_LOG_LEN; i++ )
@@ -266,9 +265,6 @@
int world_section = 0; // use the top-level section for some parms
// that traditionally live there
- this->paused =
- wf->ReadInt( world_section, "paused", this->paused );
-
this->interval_real = (stg_usec_t)thousand *
wf->ReadInt( world_section, "interval_real",
(int)(this->interval_real/thousand) );
Modified: code/stage/trunk/webstage/webstage.cc
===================================================================
--- code/stage/trunk/webstage/webstage.cc 2009-06-24 23:57:57 UTC (rev
7895)
+++ code/stage/trunk/webstage/webstage.cc 2009-06-25 01:03:24 UTC (rev
7896)
@@ -20,19 +20,38 @@
public:
WebStage( Stg::World* world,
- const std::string& host, const unsigned short
port ) :
- websim::WebSim( host, port ),
- world(world)
+ const std::string& host, const unsigned short port ) :
+ websim::WebSim( host, port ),
+ world(world)
{
}
virtual ~WebStage()
{}
+
+ virtual std::string IdentificationString()
+ { return "WebStage"; }
+
+ virtual std::string VersionString()
+ { return Stg::Version(); }
+ virtual bool ClockStart()
+ {
+ world->Start();
+ return true;
+ }
+
+ virtual bool ClockStop()
+ {
+ world->Stop();
+ return true;
+ }
+
void Push( const std::string& name )
{
- Stg::Model* mod = world->GetModel( name.c_str() );
- if( mod )
+ Stg::Model* mod = world->GetModel( name.c_str() );
+
+ if( mod )
{
websim::Pose p;
websim::Velocity v;
@@ -93,7 +112,7 @@
virtual bool GetModelChildren(const std::string& model,
std::vector<std::string>& children)
{
- GList* c;
+ std::vector<Model*> c;
if(model == "")
{
@@ -113,10 +132,12 @@
}
- for(;c;c = c->next){
-
- children.push_back(std::string(((Model*)c->data)->Token()));
- }
+ for( std::vector<Model*>::iterator it = c.begin();
+ it != c.end();
+ it++ )
+ {
+ children.push_back(std::string((*it)->Token()));
+ }
return true;
Modified: code/stage/trunk/worlds/simple.world
===================================================================
--- code/stage/trunk/worlds/simple.world 2009-06-24 23:57:57 UTC (rev
7895)
+++ code/stage/trunk/worlds/simple.world 2009-06-25 01:03:24 UTC (rev
7896)
@@ -35,6 +35,9 @@
size [16.000 16.000 0.800]
pose [0 0 0 0]
bitmap "bitmaps/cave.png"
+
+ # runs the <stage_source>/examples/ctrl/rasterize.cc example
+ # ctrl "rasterize"
)
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
------------------------------------------------------------------------------
_______________________________________________
Playerstage-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/playerstage-commit