Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

fixed alwayson and model property bugs. Fixed stage.pc to include GL …

…and FLTK libraries.
  • Loading branch information...
commit c5247e1e64286c61cf2bd3fa1f5bf15e3f4f152e 1 parent c8c98f6
rtv authored
View
8 CMakeLists.txt
@@ -57,10 +57,6 @@ MESSAGE( STATUS "Build type ${CMAKE_BUILD_TYPE}" )
ENABLE_TESTING()
-# Create the pkgconfig file
-CONFIGURE_FILE (${CMAKE_CURRENT_SOURCE_DIR}/stage.pc.in ${CMAKE_CURRENT_BINARY_DIR}/stage.pc @ONLY)
-INSTALL (FILES ${CMAKE_CURRENT_BINARY_DIR}/stage.pc DESTINATION lib/pkgconfig/)
-
SET(RGBFILE ${CMAKE_INSTALL_PREFIX}/share/stage/rgb.txt )
# Create the config.h file
@@ -189,6 +185,10 @@ ENDIF( WEBSIM_FOUND )
# 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)
+# Create the pkgconfig file
+CONFIGURE_FILE (${CMAKE_CURRENT_SOURCE_DIR}/stage.pc.in ${CMAKE_CURRENT_BINARY_DIR}/stage.pc @ONLY)
+INSTALL (FILES ${CMAKE_CURRENT_BINARY_DIR}/stage.pc DESTINATION lib/pkgconfig/)
+
MESSAGE( STATUS "Installation path CMAKE_INSTALL_PREFIX=${CMAKE_INSTALL_PREFIX}" )
# all targets need these include directories
View
2  examples/ctrl/fasr.cc
@@ -495,7 +495,7 @@ class Robot
// Stage calls this when the model starts up
extern "C" int Init( Model* mod )
{
-#if 0
+#if 1
// example using the model rasterizer
if( strcmp( mod->Token(), "r0" ) == 0 )
{
View
4 libstage/block.cc
@@ -134,7 +134,7 @@ void Block::SetZ( double min, double max )
mod->blockgroup.BuildDisplayList( mod );
}
-Color Block::GetColor()
+const Color& Block::GetColor()
{
return( inherit_color ? mod->color : color );
}
@@ -248,7 +248,7 @@ void Block::InvalidateModelPointCache()
void Block::GenerateCandidateCells()
{
candidate_cells->clear();
-
+
if( mpts.size() == 0 )
{
// no valid cache of model coord points, so generate them
View
5 libstage/model.cc
@@ -189,6 +189,8 @@ Model::Model( World* world,
Model* parent,
const std::string& type ) :
Ancestor(),
+ access_mutex(),
+ alwayson(false),
blockgroup(),
blocks_dl(0),
boundary(false),
@@ -303,6 +305,9 @@ void Model::Init()
event_queue_num = thread_safe ? world->GetEventQueue( this ) : 0;
CallCallbacks( &hooks.init );
+
+ if( alwayson )
+ Subscribe();
}
void Model::InitRecursive()
View
8 libstage/model_load.cc
@@ -227,15 +227,11 @@ void Model::Load()
trail_length = wf->ReadInt( wf_entity, "trail_length", trail_length );
trail_interval = wf->ReadInt( wf_entity, "trail_interval", trail_interval );
+ this->alwayson = wf->ReadInt( wf_entity, "alwayson", alwayson );
+
// call any type-specific load callbacks
this->CallCallbacks( &hooks.load );
- // MUST BE THE LAST THING LOADED
- if( wf->PropertyExists( wf_entity, "alwayson" ))
- {
- if( wf->ReadInt( wf_entity, "alwayson", 0) > 0 )
- Subscribe();
- }
MapWithChildren();
View
7 libstage/model_props.cc
@@ -82,8 +82,10 @@ int Model::SetProperty( const char* key,
return 1; // error code
}
+ //printf( "setting property %s %p\n", key, data );
+
// otherwise it's an arbitary property and we store the pointer
- //g_datalist_set_data( &this->props, key, (void*)data );
+ //g_datalist_set_data( &this->props, key, (void*)data );
props[key] = data;
return 0; // ok
@@ -130,6 +132,8 @@ bool Model::GetPropertyStr( const char* key, char** c, char* defaultval ) const
{
char* cp = (char*)GetProperty( key );
+ //printf( "got model %s property string %s=%s\n", token, key, cp );
+
if( cp )
{
*c = cp;
@@ -154,6 +158,7 @@ void Model::SetPropertyFloat( const char* key, float f )
void Model::SetPropertyStr( const char* key, const char* str )
{
+ //printf( "set model %s string %s=%s\n", token, key, str );
SetProperty( key, (void*)strdup(str) );
}
View
28 libstage/stage.hh
@@ -1037,7 +1037,7 @@ namespace Stg
Model* GetModel( const char* name ) const;
/** Return the 3D bounding box of the world, in meters */
- stg_bounds3d_t GetExtent(){ return extent; };
+ const stg_bounds3d_t& GetExtent(){ return extent; };
/** Return the number of times the world has been updated. */
uint64_t GetUpdateCount() { return updates; }
@@ -1121,9 +1121,9 @@ namespace Stg
std::vector<stg_point_t>& Points()
{ return pts; };
- void AddToCellArray( CellPtrVec* blocks );
- void RemoveFromCellArray( CellPtrVec* blocks );
- void GenerateCandidateCells();
+ inline void AddToCellArray( CellPtrVec* blocks );
+ inline void RemoveFromCellArray( CellPtrVec* blocks );
+ inline void GenerateCandidateCells();
void AppendTouchingModels( ModelPtrSet& touchers );
@@ -1132,7 +1132,7 @@ namespace Stg
void SwitchToTestedCells();
void Load( Worldfile* wf, int entity );
Model* GetModel(){ return mod; };
- Color GetColor();
+ const Color& GetColor();
void Rasterize( uint8_t* data,
unsigned int width, unsigned int height,
stg_meters_t cellwidth, stg_meters_t cellheight );
@@ -1203,8 +1203,8 @@ namespace Stg
~BlockGroup();
uint32_t GetCount(){ return blocks.size(); };
- Size GetSize(){ return size; };
- stg_point3_t GetOffset(){ return offset; };
+ const Size& GetSize(){ return size; };
+ const stg_point3_t& GetOffset(){ return offset; };
/** establish the min and max of all the blocks, so we can scale this
group later */
@@ -1670,6 +1670,11 @@ namespace Stg
protected:
pthread_mutex_t access_mutex;
+
+ /** If true, the model always has at least one subscription, so
+ always runs. Defaults to false. */
+ bool alwayson;
+
BlockGroup blockgroup;
/** OpenGL display list identifier for the blockgroup */
int blocks_dl;
@@ -1764,7 +1769,7 @@ namespace Stg
by derived model types to store properties, and for user code
to associate arbitrary items with a model. */
//GData* props;
- std::map<const char*,const void*> props;
+ std::map<std::string,const void*> props;
/** Visualize the most recent rasterization operation performed by this model */
class RasterVis : public Visualizer
@@ -1841,8 +1846,11 @@ namespace Stg
const std::string& GetModelType() const {return type;}
std::string GetSayString(){return std::string(say_string);}
Visibility vis;
- //stg_usec_t GetSimInterval(){ return world->interval_sim; }
-
+
+ stg_usec_t GetUpdateInterval(){ return interval; }
+ stg_usec_t GetEnergyInterval(){ return interval_energy; }
+ stg_usec_t GetPoseInterval(){ return interval_pose; }
+
/** Render the model's blocks as an occupancy grid into the
preallocated array of width by height pixels */
void Rasterize( uint8_t* data,
View
6 stage.pc.in
@@ -3,6 +3,6 @@ prefix=@CMAKE_INSTALL_PREFIX@
Name: stage
Description: Stage robot simulation program, C++ library and Player plugin - part of the Player/Stage Project
Version: @VERSION@
-Requires: gthread-2.0 >= 2.4
-Libs: -L${prefix}/lib -lstage
-Cflags: -I${prefix}/include/Stage-@APIVERSION@
+Requires:
+Libs: -L${prefix}/lib -lstage @FLTK_LDFLAGS@
+Cflags: -I${prefix}/include/Stage-@APIVERSION@ @FLTK_CFLAGS@
View
15 todo.txt
@@ -7,19 +7,19 @@ simple.world
------------
linux 8.89
OS X 7.75
+ 11.05 (rev 8210)
fasr.world
----------
linux 16.36
-OS X 16.20 (rev 7949)
+OS X 16.20 (rev 7949)
+ 19.94 (rev 8210 - new event queue is slower but more powerful and elegant)
-** 3.1.0 RELEASE *
+** 3.2.0 RELEASE *
- visualizer option state in worldfile
- blinkenlights vs lightindicator - resolve and fix interfaces
- - ranger transducer geometry correct?
- - feature freeze around July 1
- scan SF for patches
- fix world files
- docs for new models
@@ -54,3 +54,10 @@ DONE
* 3d collision detection broken - e.g. fancypioneer2dx
* energy model & recharging
* runtime update rate UI
+
+** 3.1.0 RELEASE *
+ - feature freeze around July 1
+ - scan SF for patches
+ - fix world files
+ - docs for new models
+ - push docs to SF
View
4 worlds/fasr.world
@@ -9,11 +9,9 @@ include "sick.inc"
speedup 10
paused 1
-# time to pause (in GUI mode) or quit (in headless mode) the simulation
-
+# time at which to pause (in GUI mode) or quit (in headless mode) the simulation
quit_time 3600 # 1 hour of simulated time
-
resolution 0.02
threads 0
View
3  worlds/simple.world
@@ -46,7 +46,8 @@ pioneer2dx
sicklaser(
# ctrl "lasernoise" # uncomment this line to run a laser noise generator
- )
+ )
+
ctrl "wander"
Please sign in to comment.
Something went wrong with that request. Please try again.