Skip to content

Patch tracker catchup #1

Closed
wants to merge 16 commits into from
+379 −162
View
4 CMakeLists.txt
@@ -40,9 +40,9 @@ ENDIF (NOT PROJECT_OS_WIN AND NOT PROJECT_OS_SOLARIS)
#####################################
# Build type cflags
-SET (CMAKE_CXX_FLAGS_RELEASE " -DNDEBUG ${WALL} " CACHE INTERNAL "C Flags for release" FORCE)
+SET (CMAKE_CXX_FLAGS_RELEASE " -O2 -DNDEBUG ${WALL} " CACHE INTERNAL "C Flags for release" FORCE)
SET (CMAKE_CXX_FLAGS_DEBUG " -ggdb ${WALL} " CACHE INTERNAL "C Flags for debug" FORCE)
-SET (CMAKE_CXX_FLAGS_PROFILE " -ggdb -pg ${WALL} " CACHE INTERNAL "C Flags for profile" FORCE)
+SET (CMAKE_CXX_FLAGS_PROFILE " -O2 -ggdb -pg ${WALL} " CACHE INTERNAL "C Flags for profile" FORCE)
#####################################
# Set the default build type
View
9 cmake/internal/FindOS.cmake
@@ -61,12 +61,13 @@ ENDIF (PROJECT_OS_LINUX)
IF(PROJECT_PROC_64BIT)
# Set the install path to lib64
- SET(PROJECT_LIB_DIR "lib64")
- SET(PROJECT_PLUGIN_DIR "lib64/${PROJECT_NAME}-${APIVERSION}")
+ SET(LIB_SUFFIX "64" CACHE STRING "Suffix for installation library directory")
ELSE (PROJECT_PROC_64BIT)
- SET(PROJECT_LIB_DIR "lib")
- SET(PROJECT_PLUGIN_DIR "lib/${PROJECT_NAME}-${APIVERSION}")
+ SET(LIB_SUFFIX "" CACHE STRING "Suffix for installation library directory")
ENDIF (PROJECT_PROC_64BIT)
+
+SET(PROJECT_LIB_DIR "lib${LIB_SUFFIX}")
+SET(PROJECT_PLUGIN_DIR "lib${LIB_SUFFIX}/${PROJECT_NAME}-${APIVERSION}")
MESSAGE(STATUS "Installing Libraries to ${CMAKE_INSTALL_PREFIX}/${PROJECT_LIB_DIR}")
MESSAGE(STATUS "Installing Plugins to ${CMAKE_INSTALL_PREFIX}/${PROJECT_PLUGIN_DIR}")
View
1 libstage/CMakeLists.txt
@@ -16,6 +16,7 @@ set( stageSrcs
model_actuator.cc
model_blinkenlight.cc
model_blobfinder.cc
+ model_bumper.cc
model_callbacks.cc
model_camera.cc
model_draw.cc
View
4 libstage/blockgroup.cc
@@ -250,6 +250,10 @@ void BlockGroup::CallDisplayList( Model* mod )
void BlockGroup::LoadBlock( Model* mod, Worldfile* wf, int entity )
{
AppendBlock( new Block( mod, wf, entity ));
+ //TJG - Calculating size after load. If we do not, and everything is initially stationary,
+ //some things like the fiducial finder won't work properly until the model moves, which would
+ //cause a size recalculation to occur.
+ CalcSize();
}
void BlockGroup::LoadBitmap( Model* mod, const std::string& bitmapfile, Worldfile* wf )
View
2 libstage/canvas.cc
@@ -685,7 +685,7 @@ void Canvas::DrawFloor()
glVertex2f( bounds.x.min, bounds.y.max );
glEnd();
- glEnd();
+ //glEnd();
}
void Canvas::DrawBlocks()
View
10 libstage/model.cc
@@ -649,7 +649,7 @@ void Model::Subscribe( void )
world->total_subs++;
world->dirty = true; // need redraw
- //printf( "subscribe to %s %d\n", token, subs );
+ //printf( "subscribe to %s %d\n", Token(), subs );
// if this is the first sub, call startup
if( subs == 1 )
@@ -662,7 +662,7 @@ void Model::Unsubscribe( void )
world->total_subs--;
world->dirty = true; // need redraw
- //printf( "unsubscribe from %s %d\n", token, subs );
+ //printf( "unsubscribe from %s %d\n", Token(), subs );
// if this is the last sub, call shutdown
if( subs == 0 )
@@ -901,7 +901,7 @@ void Model::UpdatePose( void )
return;
// convert usec to sec
- double interval( (double)interval_pose / 1e6 );
+ double interval( (double)world->sim_interval / 1e6 );
// find the change of pose due to our velocity vector
Pose p( velocity.x * interval,
@@ -972,6 +972,10 @@ Model* Model::GetUnusedModelOfType( const std::string& type )
this->used = true;
return this;
}
+ else if( (type == "power") && (power_pack) )
+ {
+ return this;
+ }
// this model is no use. try children recursively
FOR_EACH( it, children )
View
6 libstage/model_actuator.cc
@@ -78,6 +78,9 @@ ModelActuator::ModelActuator( World* world,
// sensible position defaults
this->SetVelocity( Velocity(0,0,0,0) );
this->SetBlobReturn(true);
+
+ // Allow the models to move
+ VelocityEnable();
}
@@ -192,6 +195,9 @@ void ModelActuator::Update( void )
CurrentPose.z - InitialPose.z,
CurrentPose.a - InitialPose.a );
+ cosa = cos(InitialPose.a);
+ sina = sin(InitialPose.a);
+
switch (actuator_type)
{
case TYPE_LINEAR:
View
19 libstage/model_getset.cc
@@ -118,17 +118,26 @@ void Model::SetGlobalPose( const Pose& gpose )
int Model::SetParent( Model* newparent)
{
+
+ Pose oldPose = GetGlobalPose();
+
// remove the model from its old parent (if it has one)
if( parent )
- EraseAll( this, parent->children );
+ parent->RemoveChild( this );
+ else
+ world->RemoveChild( this );
+ // link from the model to its new parent
+ this->parent = newparent;
if( newparent )
- newparent->children.push_back( this );
+ newparent->AddChild( this );
+ else
+ world->AddModel( this );
- // link from the model to its new parent
- this->parent = newparent;
+ CallCallbacks( CB_PARENT );
- CallCallbacks( CB_PARENT );
+ SetGlobalPose( oldPose ); // Needs to recalculate position due to change in parent
+
return 0; //ok
}
View
2 libstage/model_position.cc
@@ -389,7 +389,7 @@ void ModelPosition::Update( void )
case LOCALIZATION_ODOM:
{
// integrate our velocities to get an 'odometry' position estimate.
- double dt = interval / 1e6; // update interval convert to seconds
+ double dt = world->sim_interval / 1e6; // update interval convert to seconds
est_pose.a = normalize( est_pose.a + (vel.a * dt) * (1.0 +integration_error.a) );
View
50 libstage/stage.hh
@@ -2690,20 +2690,48 @@ namespace Stg
};
- // \todo BUMPER MODEL --------------------------------------------------------
- // typedef struct
- // {
- // Pose pose;
- // stg_meters_t length;
- // } stg_bumper_config_t;
- // typedef struct
- // {
- // Model* hit;
- // stg_point_t hit_point;
- // } stg_bumper_sample_t;
+ // BUMPER MODEL --------------------------------------------------------
+ typedef struct
+ {
+ Pose pose;
+ stg_meters_t length;
+ } stg_bumper_config_t;
+
+ typedef struct
+ {
+ Model* hit;
+ stg_point_t hit_point;
+ } stg_bumper_sample_t;
+ class ModelBumper : public Model
+ {
+ protected:
+
+ virtual void Startup(); // HH: OK
+ virtual void Shutdown(); // HH: OK
+ virtual void Update();
+ virtual void DataVisualize( Camera* cam );
+
+ public:
+ static const char* typestr;
+
+ // constructor
+ ModelBumper( World* world, Model* parent, const std::string& type ); // HH: OK
+ // destructor
+ virtual ~ModelBumper(); // HH: OK
+
+ virtual void Load(); // HH: OK
+ virtual void Print( char* prefix );
+
+ uint32_t bumper_count;
+ stg_bumper_config_t* bumpers;
+ stg_bumper_sample_t* samples;
+
+ private:
+ static Option showBumperData;
+ };
// FIDUCIAL MODEL --------------------------------------------------------
View
1 libstage/typetable.cc
@@ -24,6 +24,7 @@ void Stg::RegisterModels()
Register( "actuator", Creator<ModelActuator> );
Register( "blinkenlight", Creator<ModelBlinkenlight> );
Register( "blobfinder", Creator<ModelBlobfinder> );
+ Register( "bumper", Creator<ModelBumper> );
Register( "camera", Creator<ModelCamera> );
Register( "fiducial", Creator<ModelFiducial> );
Register( "gripper", Creator<ModelGripper> );
View
24 libstage/world.cc
@@ -552,20 +552,22 @@ void World::ConsumeQueue( unsigned int queue_num )
return;
//printf( "event queue len %d\n", (int)queue.size() );
-
+
// update everything on the event queue that happens at this time or earlier
- Event ev( queue.top() );
- while( ev.time <= sim_time )
+ do
{
- // printf( "@ %llu next event <%s %llu %s>\n", sim_time, ev.TypeStr( ev.type ), ev.time, ev.mod->Token() );
- queue.pop();
-
- if( ev.mod->subs > 0 ) // no subscriptions means the event is discarded
- ev.mod->Update(); // update the model
-
- // and move to the next
- ev = queue.top();
+ Event ev( queue.top() );
+ if( ev.time > sim_time ) break;
+ queue.pop();
+
+ //printf( "@ %llu next event ptr %p\n", sim_time, ev.mod );
+ //std::string modelType = ev.mod->GetModelType();
+ //printf( "@ %llu next event <%s %llu %s>\n", sim_time, modelType.c_str(), ev.time, ev.mod->Token() );
+
+ if( ev.mod->subs > 0 ) // no subscriptions means the event is discarded
+ ev.mod->Update(); // update the model
}
+ while( !queue.empty() );
}
bool World::Update()
View
4 libstageplugin/CMakeLists.txt
@@ -8,11 +8,13 @@ set( stagepluginSrcs
p_driver.cc
p_actarray.cc
p_blobfinder.cc
- p_gripper.cc
+ p_bumper.cc
+ p_gripper.cc
p_simulation.cc
p_laser.cc
p_fiducial.cc
p_position.cc
+ p_power.cc
p_sonar.cc
p_speech.cc
p_graphics.cc
View
159 libstageplugin/p_bumper.cc
@@ -32,104 +32,105 @@
@par Bumper interface
- PLAYER_BUMPER_DATA_STATE
- PLAYER_BUMPER_GET_GEOM
-*/
+ */
// CODE ----------------------------------------------------------------------
#include "p_driver.h"
+using namespace Stg;
//
// BUMPER INTERFACE
//
-extern "C" {
-int bumper_init( stg_model_t* mod );
-}
-
InterfaceBumper::InterfaceBumper( player_devaddr_t id,
- StgDriver* driver,
- ConfigFile* cf,
- int section )
- : InterfaceModel( id, driver, cf, section, bumper_init )
+ StgDriver* driver,
+ ConfigFile* cf,
+ int section )
+: InterfaceModel( id, driver, cf, section, "bumper" )
{
}
void InterfaceBumper::Publish( void )
{
-
- size_t len = mod->data_len;
- stg_bumper_sample_t* sdata = (stg_bumper_sample_t*)mod->data;
-
- player_bumper_data_t pdata;
- memset( &pdata, 0, sizeof(pdata) );
-
- if( len > 0 )
- {
- size_t bcount = len / sizeof(stg_bumper_sample_t);
-
- // limit the number of samples to Player's maximum
- if( bcount > PLAYER_BUMPER_MAX_SAMPLES )
- bcount = PLAYER_BUMPER_MAX_SAMPLES;
-
- pdata.bumpers_count = bcount;
-
- for( int i=0; i<(int)bcount; i++ )
- pdata.bumpers[i] = sdata[i].hit ? 1 : 0;
- }
-
- this->driver->Publish( this->addr, NULL,
- PLAYER_MSGTYPE_DATA,
- PLAYER_BUMPER_DATA_STATE,
- &pdata, sizeof(pdata), NULL);
+
+ ModelBumper* mod = (ModelBumper*)this->mod;
+
+ player_bumper_data_t bumper;
+ memset( &bumper, 0, sizeof(bumper) );
+
+ stg_bumper_sample_t* sdata = (stg_bumper_sample_t*)mod->samples;
+
+ size_t count = mod->bumper_count;
+
+ if( count > 0 )
+ {
+ {
+ bumper.bumpers_count = count;
+ bumper.bumpers = new uint8_t[count];
+
+ for( unsigned int i=0; i<count; i++ )
+ bumper.bumpers[i] = sdata[i].hit ? 1 : 0;
+ }
+ }
+
+ this->driver->Publish( this->addr,
+ PLAYER_MSGTYPE_DATA,
+ PLAYER_SONAR_DATA_RANGES,
+ &bumper, sizeof(bumper), NULL);
+
+ if( bumper.bumpers )
+ delete[] bumper.bumpers;
}
-int InterfaceBumper::ProcessMessage( MessageQueue* resp_queue,
- player_msghdr_t* hdr,
- void* data )
+int InterfaceBumper::ProcessMessage( QueuePointer & resp_queue,
+ player_msghdr_t* hdr,
+ void* data )
{
- if( Message::MatchMessage(hdr, PLAYER_MSGTYPE_REQ,
- PLAYER_BUMPER_GET_GEOM,
- this->addr) )
- {
- size_t cfglen = mod->cfg_len;
- stg_bumper_config_t* cfgs = (stg_bumper_config_t*)mod->cfg;
- assert( cfgs );
-
- size_t bcount = cfglen / sizeof(stg_bumper_config_t);
-
- // convert the bumper data into Player-format bumper poses
- player_bumper_geom_t pgeom;
- memset( &pgeom, 0, sizeof(pgeom) );
-
- // limit the number of samples to Player's maximum
- if( bcount > PLAYER_BUMPER_MAX_SAMPLES )
- bcount = PLAYER_BUMPER_MAX_SAMPLES;
-
- pgeom.bumper_def_count = bcount;
-
- for( int i=0; i<(int)bcount; i++ )
+ if( Message::MatchMessage(hdr, PLAYER_MSGTYPE_REQ,
+ PLAYER_BUMPER_REQ_GET_GEOM,
+ this->addr) )
+ {
+ ModelBumper* mod = (ModelBumper*)this->mod;
+
+ size_t bcount = mod->bumper_count;
+
+ // convert the bumper data into Player-format bumper poses
+ player_bumper_geom_t pgeom;
+ memset( &pgeom, 0, sizeof(pgeom) );
+
+ // limit the number of samples to Player's maximum
+ if( bcount > 64 )
+ bcount = 64;
+
+ pgeom.bumper_def_count = bcount;
+
+ for( int i=0; i<(int)bcount; i++ )
+ {
+ // fill in the geometry data formatted player-like
+ pgeom.bumper_def[i].pose.px = mod->bumpers[i].pose.x;
+ pgeom.bumper_def[i].pose.py = mod->bumpers[i].pose.y;
+ pgeom.bumper_def[i].pose.pz = mod->bumpers[i].pose.z;
+ pgeom.bumper_def[i].pose.proll = 0;
+ pgeom.bumper_def[i].pose.ppitch = 0;
+ pgeom.bumper_def[i].pose.pyaw = mod->bumpers[i].pose.a;
+ pgeom.bumper_def[i].length = mod->bumpers[i].length;
+ pgeom.bumper_def[i].radius = 0;
+ }
+
+ this->driver->Publish( this->addr, resp_queue,
+ PLAYER_MSGTYPE_RESP_ACK,
+ PLAYER_BUMPER_REQ_GET_GEOM,
+ (void*)&pgeom, sizeof(pgeom), NULL );
+
+ return 0; // ok
+ }
+ else
{
- // fill in the geometry data formatted player-like
- pgeom.bumper_def[i].pose.px = cfgs[i].pose.x;
- pgeom.bumper_def[i].pose.py = cfgs[i].pose.y;
- pgeom.bumper_def[i].pose.pa = cfgs[i].pose.a;
- pgeom.bumper_def[i].length = cfgs[i].length;
- pgeom.bumper_def[i].radius = 0;
+ // Don't know how to handle this message.
+ PRINT_WARN2( "stg_bumper doesn't support msg with type/subtype %d/%d",
+ hdr->type, hdr->subtype);
+ return(-1);
}
-
- this->driver->Publish( this->addr, resp_queue,
- PLAYER_MSGTYPE_RESP_ACK,
- PLAYER_BUMPER_GET_GEOM,
- (void*)&pgeom, sizeof(pgeom), NULL );
-
- return 0; // ok
- }
- else
- {
- // Don't know how to handle this message.
- PRINT_WARN2( "stg_bumper doesn't support msg with type/subtype %d/%d",
- hdr->type, hdr->subtype);
- return(-1);
- }
}
View
34 libstageplugin/p_driver.cc
@@ -167,7 +167,8 @@ extern bool player_quiet_startup;
extern bool player_quit;
// init static vars
-WorldGui* StgDriver::world = NULL;
+World* StgDriver::world = NULL;
+bool StgDriver::usegui = true;
//int update_request = 0;
@@ -228,7 +229,7 @@ InterfaceModel::InterfaceModel( player_devaddr_t addr,
ConfigFile* cf,
int section,
const std::string& type )
- : Interface( addr, driver, cf, section )
+ : Interface( addr, driver, cf, section ), mod( NULL ), subscribed( false )
{
char* model_name = (char*)cf->ReadString(section, "model", NULL );
@@ -260,6 +261,24 @@ InterfaceModel::InterfaceModel( player_devaddr_t addr,
printf( "\"%s\"\n", this->mod->Token() );
}
+void InterfaceModel::Subscribe()
+{
+ if( !subscribed && this->mod )
+ {
+ this->mod->Subscribe();
+ subscribed = true;
+ }
+}
+
+void InterfaceModel::Unsubscribe()
+{
+ if( subscribed )
+ {
+ this->mod->Unsubscribe();
+ subscribed = false;
+ }
+}
+
// Constructor. Retrieve options from the configuration file and do any
// pre-Setup() setup.
@@ -376,9 +395,9 @@ StgDriver::StgDriver(ConfigFile* cf, int section)
// ifsrc = new InterfaceWifi( player_addr, this, cf, section );
// break;
-// case PLAYER_POWER_CODE:
-// ifsrc = new InterfacePower( player_addr, this, cf, section );
-// break;
+ case PLAYER_POWER_CODE:
+ ifsrc = new InterfacePower( player_addr, this, cf, section );
+ break;
// case PLAYER_PTZ_CODE:
// ifsrc = new InterfacePtz( player_addr, this, cf, section );
@@ -578,7 +597,10 @@ void StgDriver::Update(void)
{
case PLAYER_SIMULATION_CODE:
// one round of FLTK's update loop.
- Fl::wait();
+ if (StgDriver::usegui)
+ Fl::wait();
+ else
+ StgDriver::world->Update();
break;
default:
View
17 libstageplugin/p_driver.h
@@ -38,7 +38,8 @@ class StgDriver : public Driver
virtual void Update();
/// all player devices share the same Stage world (for now)
- static Stg::WorldGui* world;
+ static Stg::World* world;
+ static bool usegui;
/// find the device record with this Player id
Interface* LookupDevice( player_devaddr_t addr );
@@ -104,12 +105,16 @@ class InterfaceModel
int section,
const std::string& type );
- Stg::Model* mod;
+ virtual ~InterfaceModel( void ){ Unsubscribe(); };
+
+ virtual void Subscribe( void );
+ virtual void Unsubscribe( void );
- virtual ~InterfaceModel( void ){ /* TODO: clean up*/ };
+ protected:
+ Stg::Model* mod;
- virtual void Subscribe( void ){ this->mod->Subscribe(); };
- virtual void Unsubscribe( void ){ this->mod->Unsubscribe(); };
+ private:
+ bool subscribed;
};
@@ -274,7 +279,7 @@ class InterfaceBumper : public InterfaceModel
virtual ~InterfaceBumper( void ){ /* TODO: clean up*/ };
virtual int ProcessMessage( QueuePointer & resp_queue,
- player_msghdr * hdr,
+ player_msghdr_t * hdr,
void * data );
virtual void Publish( void );
};
View
24 libstageplugin/p_graphics.cc
@@ -211,6 +211,11 @@ int InterfaceGraphics2d::ProcessMessage(QueuePointer & resp_queue,
PLAYER_GRAPHICS2D_CMD_POINTS, this->addr)
|| Message::MatchMessage(hdr, PLAYER_MSGTYPE_CMD,
PLAYER_GRAPHICS2D_CMD_POLYLINE, this->addr)
+// Draw Multiline is new in Player 3.1, this ifdef allows Stage to build against older versions of Player
+#if defined PLAYER_GRAPHICS2D_CMD_MULTILINE
+ || Message::MatchMessage(hdr, PLAYER_MSGTYPE_CMD,
+ PLAYER_GRAPHICS2D_CMD_MULTILINE, this->addr)
+#endif
|| Message::MatchMessage(hdr, PLAYER_MSGTYPE_CMD,
PLAYER_GRAPHICS2D_CMD_POLYGON, this->addr)) {
Message msg(*hdr, data);
@@ -250,6 +255,25 @@ void PlayerGraphics2dVis::RenderItem(Message & item) {
glEnd();
}
break;
+// Draw Multiline is new in Player 3.1, this ifdef allows Stage to build against older versions of Player
+#if defined PLAYER_GRAPHICS2D_CMD_MULTILINE
+ case PLAYER_GRAPHICS2D_CMD_MULTILINE: {
+ player_graphics2d_cmd_multiline_t
+ & data =
+ *reinterpret_cast<player_graphics2d_cmd_multiline_t*> (item.GetPayload());
+ glPlayerColour(data.color);
+ glBegin(GL_LINES);
+ for (unsigned ii = 0; ii < data.points_count; ++ii)
+ glVertex3f(data.points[ii].px, data.points[ii].py, 0);
+ glEnd();
+ }
+ break;
+
+#endif
+
+
+
+
case PLAYER_GRAPHICS2D_CMD_POLYGON: {
player_graphics2d_cmd_polygon_t
& data =
View
52 libstageplugin/p_power.cc
@@ -25,72 +25,64 @@
* Date: 10 December 2004
* CVS: $Id$
*/
-
-
-#include "p_driver.h"
+// DOCUMENTATION ------------------------------------------------------------
/** @addtogroup player
@par Power interface
- PLAYER_POWER_DATA_STATE
*/
-extern "C" {
- int energy_init( stg_model_t* mod );
-}
+// CODE ----------------------------------------------------------------------
+
+#include "p_driver.h"
+using namespace Stg;
InterfacePower::InterfacePower( player_devaddr_t addr,
StgDriver* driver,
ConfigFile* cf,
int section )
- : InterfaceModel( addr, driver, cf, section, energy_init )
+ : InterfaceModel( addr, driver, cf, section, "power" )
{
// nothing to see here. move along.
}
-
void InterfacePower::Publish( void )
{
- size_t len = mod->data_len;
- stg_energy_data_t* data = (stg_energy_data_t*)mod->data;
-
- stg_energy_config_t* cfg = (stg_energy_config_t*)mod->cfg;
-
+ Model* mod = this->mod;
+ PowerPack* pp = mod->FindPowerPack();
+
+ // don't publish anything if there is no power pack
+ if(! pp )
+ return;
+
// translate stage data to player data packet
player_power_data_t pen;
pen.valid = 0;
- pen.valid |= PLAYER_POWER_MASK_VOLTS;
- pen.joules = data->stored;
+ pen.valid |= PLAYER_POWER_MASK_JOULES;
+ pen.joules = pp->GetStored();
pen.valid |= PLAYER_POWER_MASK_CHARGING;
- pen.charging = data->charging;
+ pen.charging = pp->GetCharging();
pen.valid |= PLAYER_POWER_MASK_PERCENT;
- pen.percent = 100.0 * data->stored / cfg->capacity;
+ pen.percent = pp->ProportionRemaining();
//printf( "player power data: valid %d joules %.2f watts %.2f percent %.2f charging %d\n",
// pen.valid, pen.joules, pen.watts, pen.percent, pen.charging );
- this->driver->Publish(this->addr, NULL,
+ this->driver->Publish(this->addr,
PLAYER_MSGTYPE_DATA,
PLAYER_POWER_DATA_STATE,
(void*)&pen, sizeof(pen), NULL);
}
-int InterfacePower::ProcessMessage(MessageQueue* resp_queue,
- player_msghdr_t* hdr,
- void* data)
+int InterfacePower::ProcessMessage(QueuePointer &resp_queue,
+ player_msghdr_t* hdr,
+ void* data)
{
- // Is it a request to set the laser's config?
-// if(Message::MatchMessage(hdr, PLAYER_MSGTYPE_REQ,
-// PLAYER_LASER_REQ_SET_CONFIG,
-// this->addr))
-// {
-
-// }
-
// Don't know how to handle this message.
- PRINT_WARN2( "stage laser doesn't support message %d:%d.",
+ PRINT_WARN2( "stg_power doesn't support msg with type %d subtype %d",
hdr->type, hdr->subtype);
return(-1);
}
View
3 libstageplugin/p_simulation.cc
@@ -79,6 +79,7 @@ InterfaceSimulation::InterfaceSimulation( player_devaddr_t addr,
Stg::Init( &player_argc, &player_argv );
const char* worldfile_name = cf->ReadString(section, "worldfile", NULL );
+ StgDriver::usegui = cf->ReadBool(section, "usegui", 1 );
if( worldfile_name == NULL )
{
@@ -114,7 +115,7 @@ InterfaceSimulation::InterfaceSimulation( player_devaddr_t addr,
// worldfile
// if the initial size is to large this crashes on some systems
- StgDriver::world = new WorldGui( 400, 300, "Player/Stage" );
+ StgDriver::world = ( StgDriver::usegui ? new WorldGui( 400, 300, worldfile_name ) : new World(worldfile_name));
assert(StgDriver::world);
puts("");
View
2 stage.pc.in
@@ -10,5 +10,5 @@ Version: @VERSION@
# add the incantations to the flags and libs lines below
Requires:
-Libs: -L${prefix}/@PROJECT_LIB_DIR@ -lstage @FLTK_LDFLAGS_PKGCONFIG@
+Libs: -L${prefix}/@PROJECT_LIB_DIR@ -lstage @FLTK_LDFLAGS@
Cflags: -I${prefix}/include/Stage-@APIVERSION@ @FLTK_CFLAGS@
View
114 worlds/fiducial.world
@@ -0,0 +1,114 @@
+# fiducial_z_ignore_test.world - basic worldfile illustrating the use of fiducials with the
+# ignore_fiducial_zloc flag set to 1.
+# The purpose of this flag on the fiducial finder is to change the behaviour of the fiducial finder
+# where the robots being detected are shorter than the robot equipped with the fiducial finder.
+# The default behaviour is for the fiducial finder to operate as normal. When the ignore_fiducial_zloc
+# flag on the fiducial finder is set to 1, the finder will pick up robots of any height. Standard
+# raytracing rules apply on the way to the robots.
+#
+# The red robot can see the green robot and the blue robot.
+# The blue robot can only see the red robot.
+#
+# Authors: Tyler Gunn, University of Manitoba (tyler@egunn.com)
+# $Id$
+
+include "pioneer.inc"
+include "sick.inc"
+include "irobot.inc"
+
+# time to pause (in GUI mode) or quit (in headless mode (-g)) the simulation
+quit_time 3600 # 1 hour of simulated time
+
+paused 0
+
+resolution 0.02
+
+# configure the GUI window
+window
+(
+ size [ 635.000 666.000 ] # in pixels
+ scale 142.334
+ # pixels per meteri
+ center [ -5.480 0.998 ]
+ rotate [ 26.000 16.500 ]
+
+ show_data 1 # 1=on 0=off
+)
+
+
+# This model represents the walls
+model
+(
+ # sombre, sensible, artistic
+ color "gray30"
+
+ # most maps will need a bounding box
+ boundary 1
+
+ gui_nose 0
+ gui_grid 0
+ gui_move 0
+ gui_outline 0
+ gripper_return 0
+ fiducial_return 0
+ laser_return 1
+
+ # Returns a hit in the "walls" digit
+ obstacle_return 1
+
+ size [16.000 16.000 0.800]
+ pose [0 0 0 0]
+ bitmap "bitmaps/cave.png"
+ name "Walls"
+)
+
+# This robot's fiducial finder can see the short robot.
+pioneer2dx
+(
+ # can refer to the robot by this name
+ name "r1"
+ pose [ -4.744 1.401 0 153.862 ]
+
+#fiducial (
+# alwayson 1
+# range_min 0.0
+# range_max 4.0
+# range_max_id 4.0
+# fiducial_key 1
+# ignore_fiducial_zloc 1
+# size [ 0.100 0.100 0.001 ]
+# )
+
+ fiducial_key 1
+ fiducial_return 1
+
+ obstacle_return 1
+)
+
+# This robot uses the standard fiducial settings, and thus it cannot see the short robot.
+pioneer2dx
+(
+ # can refer to the robot by this name
+ name "r2"
+ pose [ -6.260 0.313 0 79.378 ]
+ color "blue"
+
+ fiducial (
+ alwayson 1
+ range_min 0.0
+ range_max 4.0
+ range_max_id 4.0
+ fiducial_key 1
+ #ignore_fiducial_zloc 1
+ size [ 0.100 0.100 0.001 ]
+ )
+
+ fiducial_key 1
+ fiducial_return 2
+
+ obstacle_return 1
+)
+
+
+
+
Something went wrong with that request. Please try again.