Revision: 7312
http://playerstage.svn.sourceforge.net/playerstage/?rev=7312&view=rev
Author: rtv
Date: 2009-01-30 03:47:38 +0000 (Fri, 30 Jan 2009)
Log Message:
-----------
added contact recharging between power packs. Removed charger object
Modified Paths:
--------------
code/stage/trunk/examples/ctrl/fasr.cc
code/stage/trunk/libstage/CMakeLists.txt
code/stage/trunk/libstage/canvas.cc
code/stage/trunk/libstage/charger.cc
code/stage/trunk/libstage/model.cc
code/stage/trunk/libstage/model_load.cc
code/stage/trunk/libstage/powerpack.cc
code/stage/trunk/libstage/stage.hh
code/stage/trunk/libstage/texture_manager.hh
code/stage/trunk/libstage/world.cc
code/stage/trunk/worlds/fasr.world
Added Paths:
-----------
code/stage/trunk/assets/mains.png
Added: code/stage/trunk/assets/mains.png
===================================================================
(Binary files differ)
Property changes on: code/stage/trunk/assets/mains.png
___________________________________________________________________
Added: svn:mime-type
+ image/png
Modified: code/stage/trunk/examples/ctrl/fasr.cc
===================================================================
--- code/stage/trunk/examples/ctrl/fasr.cc 2009-01-29 23:58:07 UTC (rev
7311)
+++ code/stage/trunk/examples/ctrl/fasr.cc 2009-01-30 03:47:38 UTC (rev
7312)
@@ -88,9 +88,9 @@
// inspect the laser data and decide what to do
int Robot::LaserUpdate( ModelLaser* laser, Robot* robot )
{
- if( laser->power_pack && laser->power_pack->charging )
- printf( "model %s power pack @%p is charging\n",
- laser->Token(), laser->power_pack );
+// if( laser->power_pack && laser->power_pack->charging )
+// printf( "model %s power pack @%p is charging\n",
+// laser->Token(), laser->power_pack );
// Get the data
uint32_t sample_count=0;
Modified: code/stage/trunk/libstage/CMakeLists.txt
===================================================================
--- code/stage/trunk/libstage/CMakeLists.txt 2009-01-29 23:58:07 UTC (rev
7311)
+++ code/stage/trunk/libstage/CMakeLists.txt 2009-01-30 03:47:38 UTC (rev
7312)
@@ -8,7 +8,6 @@
blockgroup.cc
camera.cc
canvas.cc
- charger.cc
file_manager.cc
file_manager.hh
gl.cc
Modified: code/stage/trunk/libstage/canvas.cc
===================================================================
--- code/stage/trunk/libstage/canvas.cc 2009-01-29 23:58:07 UTC (rev 7311)
+++ code/stage/trunk/libstage/canvas.cc 2009-01-30 03:47:38 UTC (rev 7312)
@@ -133,12 +133,22 @@
std::string fullpath = FileManager::findFile( "assets/stall.png" );
if ( fullpath == "" )
{
- PRINT_DEBUG( "Unable to load texture.\n" );
+ PRINT_DEBUG( "Unable to load stall texture.\n" );
}
GLuint stall_id = TextureManager::getInstance().loadTexture(
fullpath.c_str() );
TextureManager::getInstance()._stall_texture_id = stall_id;
+
+ fullpath = FileManager::findFile( "assets/mains.png" );
+ if ( fullpath == "" )
+ {
+ PRINT_DEBUG( "Unable to load mains texture.\n" );
+ }
+ GLuint mains_id = TextureManager::getInstance().loadTexture(
fullpath.c_str() );
+ TextureManager::getInstance()._mains_texture_id = mains_id;
+
+
//TODO merge this code into the textureManager?
int i, j;
for (i = 0; i < checkImageHeight; i++)
@@ -923,9 +933,6 @@
for( GList* it=selected_models; it; it=it->next )
((Model*)it->data)->DrawSelected();
- for( GList* it=world->chargers; it; it=it->next )
- ((Charger*)it->data)->Visualize();
-
// useful debug - puts a point at the origin of each model
//for( GList* it = world->World::children; it; it=it->next )
// ((Model*)it->data)->DrawOriginTree();
Modified: code/stage/trunk/libstage/charger.cc
===================================================================
--- code/stage/trunk/libstage/charger.cc 2009-01-29 23:58:07 UTC (rev
7311)
+++ code/stage/trunk/libstage/charger.cc 2009-01-30 03:47:38 UTC (rev
7312)
@@ -80,7 +80,7 @@
glPopMatrix();
// ?
- glPolygonMode( GL_FRONT, GL_FILL );
+ //glPolygonMode( GL_FRONT, GL_FILL );
}
void swap( double &a, double &b )
Modified: code/stage/trunk/libstage/model.cc
===================================================================
--- code/stage/trunk/libstage/model.cc 2009-01-29 23:58:07 UTC (rev 7311)
+++ code/stage/trunk/libstage/model.cc 2009-01-30 03:47:38 UTC (rev 7312)
@@ -234,7 +234,9 @@
type(type),
used(false),
velocity(),
- watts(0),
+ watts(0.0),
+ watts_give(0.0),
+ watts_take(0.0),
wf(NULL),
wf_entity(0),
world(world),
@@ -743,31 +745,27 @@
// this->world->sim_time, this->token, this->subs );
// f we're drawing current and a power pack has been installed
- if( power_pack )
+
+ PowerPack* pp = FindPowerPack();
+ if( pp && ( watts > 0 ))
{
- if( watts > 0 )
- {
- // consume energy stored in the power pack
- stg_joules_t consumed = watts * (world->interval_sim
* 1e-6);
- power_pack->stored -= consumed;
-
- /*
- printf ( "%s current %.2f
consumed %.6f ppack @ %p [ %.2f/%.2f (%.0f)\n",
- token,
- watts,
- consumed,
- power_pack,
- power_pack->stored,
- power_pack->capacity,
- power_pack->stored /
power_pack->capacity * 100.0 );
- */
- }
+ // consume energy stored in the power pack
+ stg_joules_t consumed = watts * (world->interval_sim * 1e-6);
+ pp->Subtract( consumed );
- // I own this power pack, see if the world wants to recharge it
*/
- if( power_pack->mod == this )
- world->TryCharge( power_pack, GetGlobalPose() );
+ /*
+ printf ( "%s current %.2f consumed %.6f ppack @
%p [ %.2f/%.2f (%.0f)\n",
+ token,
+ watts,
+ consumed,
+ power_pack,
+ power_pack->stored,
+ power_pack->capacity,
+ power_pack->stored / power_pack->capacity *
100.0 );
+ */
+
}
-
+
CallCallbacks( &hooks.update );
last_update = world->sim_time;
}
@@ -1051,7 +1049,9 @@
void Model::DrawStatus( Camera* cam )
{
-
+ // quick hack
+ if( power_pack && power_pack->stored < 0.0 )
+ DrawImage( TextureManager::getInstance()._mains_texture_id, cam, 0.85
);
if( say_string || power_pack )
{
@@ -1076,7 +1076,7 @@
//if( ! parent )
// glRectf( 0,0,1,1 );
- if( power_pack && (power_pack->mod == this) )
+ if( power_pack->stored > 0.0 )
power_pack->Visualize( cam );
if( say_string )
@@ -1204,6 +1204,8 @@
PushLocalCoords();
+ glPolygonMode( GL_FRONT, GL_FILL );
+
GLUquadric* quadric = gluNewQuadric();
glTranslatef(0,0,1); // jump up
Pose gpose = GetGlobalPose();
@@ -1606,17 +1608,37 @@
Model* Model::TestCollision()
{
//printf( "mod %s test collision...\n", token );
-
+
Model* hitmod = blockgroup.TestCollision();
if( hitmod == NULL )
for( GList* it = children; it; it=it->next )
{
- hitmod = ((Model*)it->data)->TestCollision();
- if( hitmod )
- break;
+ hitmod = ((Model*)it->data)->TestCollision();
+ if( hitmod )
+ break;
}
+ if( hitmod && (watts_take > 0.0) )
+ {
+ PowerPack* pp = FindPowerPack();
+
+ if( pp )
+ {
+ if( hitmod->FindPowerPack() && (hitmod->watts_give >
0.0) )
+ {
+ stg_watts_t rate = MIN( watts_take,
hitmod->watts_give );
+ stg_joules_t amount = rate *
(world->interval_sim * 1e-6);
+
+ // move some joules from him to me
+ hitmod->FindPowerPack()->TransferTo(
FindPowerPack(), amount );
+ }
+ else
+ pp->charging = false;
+ }
+ }
+
+
//printf( "mod %s test collision done.\n", token );
return hitmod;
}
@@ -1793,3 +1815,14 @@
world->dirty = true;
}
+
+PowerPack* Model::FindPowerPack()
+{
+ if( power_pack )
+ return power_pack;
+
+ if( parent )
+ return parent->FindPowerPack();
+
+ return NULL;
+}
Modified: code/stage/trunk/libstage/model_load.cc
===================================================================
--- code/stage/trunk/libstage/model_load.cc 2009-01-29 23:58:07 UTC (rev
7311)
+++ code/stage/trunk/libstage/model_load.cc 2009-01-30 03:47:38 UTC (rev
7312)
@@ -18,8 +18,9 @@
{
assert( wf );
assert( wf_entity );
-
+
PRINT_DEBUG1( "Model \"%s\" loading...", token );
+
if( wf->PropertyExists( wf_entity, "joules" ) )
{
@@ -33,17 +34,16 @@
the charge */
power_pack->capacity = power_pack->stored;
}
-
+
if( wf->PropertyExists( wf_entity, "joules_capacity" ) )
{
if( !power_pack )
power_pack = new PowerPack( this );
power_pack->capacity =
- wf->ReadFloat( wf_entity, "joules_stored",
power_pack->capacity );
-
+ wf->ReadFloat( wf_entity, "joules_stored",
power_pack->capacity );
}
-
+
/** if the capacity has been specified, limit the store to the capacity */
if( power_pack && (power_pack->stored > power_pack->capacity) )
{
@@ -53,26 +53,22 @@
power_pack->stored,
power_pack->capacity );
}
+
+ // use my own pack or an ancestor's for the other energy properties
+ PowerPack* pp = FindPowerPack();
- if( wf->PropertyExists( wf_entity, "watts" ) )
- {
- watts = wf->ReadFloat( wf_entity, "watts", watts );
-
- if( watts > 0 )
- {
- // find a power pack attached to me or an ancestor in
my tree
- while( (!power_pack) && parent )
- {
- power_pack = parent->power_pack;
- }
-
- if( power_pack == NULL )
- {
- PRINT_WARN2( "worldfile requests %.2f watts
for model %s, but can not find an energy source. Setting watts has no effect
unless you also specify a \"joules\" value for this model or an ancestor.",
watts, token );
- exit(-1);
- }
- }
- }
+ watts = wf->ReadFloat( wf_entity, "watts", watts );
+ if( (watts > 0) && !pp )
+ PRINT_WARN1( "Model %s: Setting \"watts\" has no effect unless
\"joules\" is specified for this model or a parent", token );
+
+ watts_give = wf->ReadFloat( wf_entity, "give_watts", watts_give );
+ if( (watts_give > 0.0) && !pp)
+ PRINT_WARN1( "Model %s: Setting \"watts_give\" has no effect unless
\"joules\" is specified for this model or a parent", token );
+
+ watts_take = wf->ReadFloat( wf_entity, "take_watts", watts_take );
+ if( (watts_take > 0.0) & !pp )
+ PRINT_WARN1( "Model %s: Setting \"watts_take\" has no effect unless
\"joules\" is specified for this model or a parent", token );
+
if( wf->PropertyExists( wf_entity, "debug" ) )
{
Modified: code/stage/trunk/libstage/powerpack.cc
===================================================================
--- code/stage/trunk/libstage/powerpack.cc 2009-01-29 23:58:07 UTC (rev
7311)
+++ code/stage/trunk/libstage/powerpack.cc 2009-01-30 03:47:38 UTC (rev
7312)
@@ -6,6 +6,7 @@
*/
#include "stage.hh"
+#include "texture_manager.hh"
using namespace Stg;
PowerPack::PowerPack( Model* mod ) :
@@ -25,52 +26,89 @@
{
const double height = 0.5;
const double width = 0.2;
-
+
double percent = stored/capacity * 100.0;
+
+ if( percent > 50 )
+ glColor4f( 0,1,0, 0.7 ); // green
+ else if( percent > 25 )
+ glColor4f( 1,0,1, 0.7 ); // magenta
+ else
+ glColor4f( 1,0,0, 0.7 ); // red
+
+ static char buf[6];
+ snprintf( buf, 6, "%.0f", percent );
+
+ glTranslatef( -width, 0.0, 0.0 );
+
+ glPolygonMode( GL_FRONT_AND_BACK, GL_FILL );
+
+ GLfloat fullness = height * (percent * 0.01);
+ glRectf( 0,0,width, fullness);
+
+ // outline the charge-o-meter
+ glTranslatef( 0,0,0.001 );
+ glPolygonMode( GL_FRONT_AND_BACK, GL_LINE );
+
+ glColor4f( 0,0,0,0.7 );
+
+ glRectf( 0,0,width, height );
+
+ glBegin( GL_LINES );
+ glVertex2f( 0, fullness );
+ glVertex2f( width, fullness );
+ glEnd();
+
+ if( charging )
+ {
+ glLineWidth( 6.0 );
+ glColor4f( 1,0,0,0.7 );
+
+ glRectf( 0,0,width, height );
+
+ glLineWidth( 1.0 );
+ }
- if( percent > 50 )
- glColor4f( 0,1,0, 0.7 ); // green
- else if( percent > 25 )
- glColor4f( 1,0,1, 0.7 ); // magenta
- else
- glColor4f( 1,0,0, 0.7 ); // red
-
- static char buf[6];
- snprintf( buf, 6, "%.0f", percent );
+ // draw the percentage
+ //gl_draw_string( -0.2, 0, 0, buf );
+
+ // ?
+ glPolygonMode( GL_FRONT_AND_BACK, GL_FILL );
+}
- glTranslatef( -width, 0.0, 0.0 );
- glPolygonMode( GL_FRONT_AND_BACK, GL_FILL );
+stg_joules_t PowerPack::RemainingCapacity()
+{
+ return( capacity - stored );
+}
- GLfloat fullness = height * (percent * 0.01);
- glRectf( 0,0,width, fullness);
+void PowerPack::Add( stg_joules_t j )
+{
+ stored += MIN( RemainingCapacity(), j );
+
+ charging = true;
+}
- // outline the charge-o-meter
- glTranslatef( 0,0,0.001 );
- glPolygonMode( GL_FRONT_AND_BACK, GL_LINE );
+void PowerPack::Subtract( stg_joules_t j )
+{
+ if( stored >= 0.0 )
+ stored -= MIN( stored, j );
+}
- glColor4f( 0,0,0,0.7 );
+void PowerPack::TransferTo( PowerPack* dest, stg_joules_t amount )
+{
+ // if stored is non-negative we can't transfer more than the stored
+ // amount. If it is negative, we have infinite energy stored
+ if( stored >= 0.0 )
+ amount = MIN( stored, amount );
- glRectf( 0,0,width, height );
+ // we can't transfer more than he can take
+ amount = MIN( amount, dest->RemainingCapacity() );
+
+ printf( "%s receives %.3f J from %s\n",
+ mod->Token(), amount, dest->mod->Token() );
- glBegin( GL_LINES );
- glVertex2f( 0, fullness );
- glVertex2f( width, fullness );
- glEnd();
-
- if( charging )
- {
- glLineWidth( 6.0 );
- glColor4f( 1,0,0,0.7 );
-
- glRectf( 0,0,width, height );
-
- glLineWidth( 1.0 );
- }
-
- // draw the percentage
- //gl_draw_string( -0.2, 0, 0, buf );
-
- // ?
- glPolygonMode( GL_FRONT_AND_BACK, GL_FILL );
+
+ Subtract( amount );
+ dest->Add( amount );
}
Modified: code/stage/trunk/libstage/stage.hh
===================================================================
--- code/stage/trunk/libstage/stage.hh 2009-01-29 23:58:07 UTC (rev 7311)
+++ code/stage/trunk/libstage/stage.hh 2009-01-30 03:47:38 UTC (rev 7312)
@@ -666,62 +666,7 @@
typedef bool (*stg_ray_test_func_t)(Model* candidate,
Model* finder,
const void* arg );
-
- // TODO - some of this needs to be implemented, the rest junked.
- /* // -------------------------------------------------------------- */
-
- /* // standard energy consumption of some devices in W. */
- /* // */
- /* // The MOTIONKG value is a hack to approximate cost of motion, as */
- /* // Stage does not yet have an acceleration model. */
- /* // */
- /* #define STG_ENERGY_COST_LASER 20.0 // 20 Watts! (LMS200 - from SICK web
site) */
- /* #define STG_ENERGY_COST_FIDUCIAL 10.0 // 10 Watts */
- /* #define STG_ENERGY_COST_RANGER 0.5 // 500mW (estimate) */
- /* #define STG_ENERGY_COST_MOTIONKG 10.0 // 10 Watts per KG when moving */
- /* #define STG_ENERGY_COST_BLOB 4.0 // 4W (estimate) */
-
- /* typedef struct */
- /* { */
- /* stg_joules_t joules; // current energy stored in Joules/1000 */
- /* stg_watts_t watts; // current power expenditure in mW (mJoules/sec) */
- /* int charging; // 1 if we are receiving energy, -1 if we are */
- /* // supplying energy, 0 if we are neither charging nor */
- /* // supplying energy. */
- /* stg_meters_t range; // the range that our charging probe hit a
charger */
- /* } stg_energy_data_t; */
-
- /* typedef struct */
- /* { */
- /* stg_joules_t capacity; // maximum energy we can store (we start fully
charged) */
- /* stg_meters_t probe_range; // the length of our recharge probe */
- /* //Pose probe_pose; // TODO - the origin of our probe */
-
- /* stg_watts_t give_rate; // give this many Watts to a probe that hits
me (possibly 0) */
-
- /* stg_watts_t trickle_rate; // this much energy is consumed or */
- /* // received by this device per second as a */
- /* // baseline trickle. Positive values mean */
- /* // that the device is just burning energy */
- /* // stayting alive, which is appropriate */
- /* // for most devices. Negative values mean */
- /* // that the device is receiving energy */
- /* // from the environment, simulating a */
- /* // solar cell or some other ambient energy */
- /* // collector */
-
- /* } stg_energy_config_t; */
-
-
- /* // BLINKENLIGHT
------------------------------------------------------------ */
-
- /* // a number of milliseconds, used for example as the blinkenlight
interval */
- /* #define STG_LIGHT_ON UINT_MAX */
- /* #define STG_LIGHT_OFF 0 */
-
- //typedef int stg_interval_ms_t;
-
// list iterator macros
#define LISTFUNCTION( LIST, TYPE, FUNC ) for( GList* it=LIST; it; it=it->next
) FUNC((TYPE)it->data);
#define LISTMETHOD( LIST, TYPE, METHOD ) for( GList* it=LIST; it; it=it->next
) ((TYPE)it->data)->METHOD();
@@ -860,22 +805,6 @@
class BlockGroup;
class PowerPack;
- /// %Charger class
- class Charger
- {
- World* world;
- stg_watts_t watts;
- stg_bounds3d_t volume;
-
- public:
- Charger( World* world );
- void ChargeIfContained( PowerPack* pp, Pose pose );
- bool Contains( Pose pose );
- void Charge( PowerPack* pp );
- void Visualize();
- void Load( Worldfile* wf, int entity );
- };
-
/// %World class
class World : public Ancestor
{
@@ -883,7 +812,6 @@
friend class Block;
//friend class StgTime;
friend class Canvas;
- friend class Charger;
private:
@@ -892,7 +820,6 @@
static void UpdateCb( World* world);
static unsigned int next_id; ///<initially zero, used to allocate unique
sequential world ids
- GList* chargers;
bool destroy;
bool dirty; ///< iff true, a gui redraw would be required
GHashTable* models_by_name; ///< the models that make up the world,
indexed by name
@@ -935,7 +862,6 @@
void LoadBlock( Worldfile* wf, int entity, GHashTable* entitytable );
void LoadBlockGroup( Worldfile* wf, int entity, GHashTable* entitytable );
void LoadPuck( Worldfile* wf, int entity, GHashTable* entitytable );
- void LoadCharger( Worldfile* wf, int entity );
SuperRegion* AddSuperRegion( const stg_point_int_t& coord );
SuperRegion* GetSuperRegion( const stg_point_int_t& coord );
@@ -1445,7 +1371,7 @@
/** Energy capacity */
stg_joules_t capacity;
- /** TRUE iff the device is receiving energy from a charger */
+ /** TRUE iff the device is receiving energy */
bool charging;
/** OpenGL visualization of the powerpack state */
@@ -1454,7 +1380,19 @@
/** Print human-readable status on stdout, prefixed with the
argument string */
void Print( char* prefix );
- };
+
+ /** Returns the energy capacity minus the current amount stored */
+ stg_joules_t RemainingCapacity();
+
+ /** Add to the energy store */
+ void Add( stg_joules_t j );
+
+ /** Subtract from the energy store */
+ void Subtract( stg_joules_t j );
+
+ /** Transfer some stored energy to another power pack */
+ void TransferTo( PowerPack* dest, stg_joules_t amount );
+};
class Visibility
{
@@ -1557,7 +1495,8 @@
friend class Block;
friend class Region;
friend class BlockGroup;
-
+ friend class PowerPack;
+
private:
/** the number of models instatiated - used to assign unique IDs */
static uint32_t count;
@@ -1584,7 +1523,7 @@
/** Default color of the model's blocks.*/
stg_color_t color;
-
+
/** This can be set to indicate that the model has new data that
may be of interest to users. This allows polling the model
instead of adding a data callback. */
@@ -1622,6 +1561,8 @@
global coordinate frame is the parent is NULL. */
Pose pose;
+ /** Optional attached PowerPack, defaults to NULL */
+ PowerPack* power_pack;
/** GData datalist can contain arbitrary named data items. Can be used
by derived model types to store properties, and for user code
@@ -1640,6 +1581,15 @@
bool used; ///< TRUE iff this model has been returned by
GetUnusedModelOfType()
Velocity velocity;
stg_watts_t watts;///< power consumed by this model
+
+ /** If >0, this model can transfer energy to models that have
+ watts_take >0 */
+ stg_watts_t watts_give;
+
+ /** If >0, this model can transfer energy from models that have
+ watts_give >0 */
+ stg_watts_t watts_take;
+
Worldfile* wf;
int wf_entity;
World* world; // pointer to the world in which this model exists
@@ -1649,8 +1599,6 @@
Visibility vis;
- /** Optional attached PowerPack, defaults to NULL */
- PowerPack* power_pack;
void Lock()
{
@@ -1801,8 +1749,10 @@
void DrawFlagList();
void DrawPose( Pose pose );
-
+
public:
+ PowerPack* FindPowerPack();
+
void RecordRenderPoint( GSList** head, GSList* link,
unsigned int* c1, unsigned int* c2 );
Modified: code/stage/trunk/libstage/texture_manager.hh
===================================================================
--- code/stage/trunk/libstage/texture_manager.hh 2009-01-29 23:58:07 UTC
(rev 7311)
+++ code/stage/trunk/libstage/texture_manager.hh 2009-01-30 03:47:38 UTC
(rev 7312)
@@ -28,6 +28,7 @@
//TODO figure out where to store standard textures
GLuint _stall_texture_id;
+ GLuint _mains_texture_id;
//TODO make this threadsafe
inline static TextureManager& getInstance( void ) {
Modified: code/stage/trunk/libstage/world.cc
===================================================================
--- code/stage/trunk/libstage/world.cc 2009-01-29 23:58:07 UTC (rev 7311)
+++ code/stage/trunk/libstage/world.cc 2009-01-30 03:47:38 UTC (rev 7312)
@@ -73,7 +73,6 @@
double ppm )
:
// private
- chargers( NULL ),
destroy( false ),
dirty( true ),
models_by_name( g_hash_table_new( g_str_hash, g_str_equal ) ),
@@ -338,8 +337,6 @@
LoadBlock( wf, entity, entitytable );
else if( strcmp( typestr, "puck" ) == 0 )
LoadPuck( wf, entity, entitytable );
- else if( strcmp( typestr, "charger" ) == 0 )
- LoadCharger( wf, entity );
else
LoadModel( wf, entity, entitytable );
}
@@ -362,16 +359,6 @@
putchar( '\n' );
}
-void World::LoadCharger( Worldfile* wf, int entity )
-{
- Charger* chg = new Charger( this );
-
- chargers = g_list_prepend( chargers, chg );
-
- chg->Load( wf, entity );
-}
-
-
// delete a model from the hash table
static void destroy_model( gpointer dummy1, Model* mod, gpointer dummy2 )
{
@@ -945,16 +932,5 @@
extent.z.max = MAX( extent.z.max, pt.z );
}
-void World::TryCharge( PowerPack* pack, Pose pose )
-{
- pack->charging = false;
- // see if the pose lies within any of the charging rectangles
- for( GList* it = chargers; it; it = it->next )
- {
- Charger* chg = (Charger*)it->data;
- chg->ChargeIfContained( pack, pose );
- }
-}
-
Modified: code/stage/trunk/worlds/fasr.world
===================================================================
--- code/stage/trunk/worlds/fasr.world 2009-01-29 23:58:07 UTC (rev 7311)
+++ code/stage/trunk/worlds/fasr.world 2009-01-30 03:47:38 UTC (rev 7312)
@@ -22,9 +22,9 @@
(
size [ 600.000 599.000 ]
- center [ 0.051 -0.204 ]
+ center [ 4.605 -2.392 ]
rotate [ 0 0 ]
- scale 33.822
+ scale 68.242
pcam_loc [ 0 -4.000 2.000 ]
pcam_angle [ 70.000 0 ]
@@ -45,18 +45,6 @@
bitmap "bitmaps/cave.png"
)
-charger
-(
- volume [ 5 6 -2 -3 0 0.1 ]
- watts 200
-)
-
-charger
-(
- volume [ 5 6 -4 -5 0 0.1 ]
- watts 200
-)
-
zone
(
color "green"
@@ -73,11 +61,6 @@
ctrl "sink"
)
-#puck( pose [ 0 0 0 0 ] )
-#puck( pose [ 1 0 0 0 ] )
-#puck( pose [ 2 0 0 0 ] )
-#puck( pose [ 3 0 0 0 ] )
-
define autorob pioneer2dx
(
sicklaser( samples 32 range_max 5 laser_return 2 watts 30 )
@@ -86,9 +69,44 @@
fiducial_return 1
)
-autorob( pose [-1.768 2.263 0 -147.323] fiducial( range_max 3 ) )
-#autorob( pose [4.116 6.107 0 -147.323] )
-autorob( pose [6.471 5.304 0 14.941] )
+define charging_bump model
+(
+ pose [0.210 0 -0.100 0 ]
+ size [0.050 0.100 0.100]
+ take_watts 300.0
+ color "orange"
+ obstacle_return 1
+)
+
+define charge_station model
+(
+ color "yellow"
+ size [ 0.100 0.500 0.400 ]
+ joules -1 # infinite storage
+ give_watts 500
+)
+
+charge_station
+(
+ pose [ 7.941 -3.001 0 0 ]
+)
+
+autorob
+(
+ pose [2.933 0.917 0 -147.323]
+ color "magenta"
+ joules 10000
+ joules_capacity 100000
+ charging_bump()
+)
+
+autorob
+(
+ pose [5.757 -3.528 0 14.941]
+ color "green"
+ charging_bump( take_watts 0 give_watts 300.0 )
+)
+
autorob( pose [5.937 4.858 0 -147.503] )
autorob( pose [7.574 6.269 0 -111.715] )
autorob( pose [5.664 5.938 0 107.666] )
@@ -103,7 +121,7 @@
autorob( pose [5.098 6.788 0 -61.295] )
autorob( pose [4.374 5.163 0 -147.713] )
autorob( pose [4.999 4.230 0 -125.236] )
-autorob( pose [-3.326 0.642 0 78.789] )
+autorob( pose [3.533 4.220 0 78.789] )
autorob( pose [5.440 5.317 0 -26.545] )
autorob( pose [7.518 6.973 0 163.239] )
autorob( pose [7.559 4.764 0 -139.066] )
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
------------------------------------------------------------------------------
This SF.net email is sponsored by:
SourcForge Community
SourceForge wants to tell your story.
http://p.sf.net/sfu/sf-spreadtheword
_______________________________________________
Playerstage-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/playerstage-commit