Stg::World Class Reference

World class More...

#include <stage.hh>

Inherits Stg::Ancestor.

Inherited by Stg::WorldGui.

List of all members.


Classes

struct  eqstr

Public Member Functions

virtual void AddModel (Model *mod)
void AddPowerPack (PowerPack *pp)
SuperRegionAddSuperRegion (const stg_point_int_t &coord)
void AddUpdateCallback (stg_world_callback_t cb, void *user)
void CancelQuit ()
void CancelQuitAll ()
void ChargeListAdd (Model *mod)
void ChargeListRemove (Model *mod)
void ClearRays ()
virtual std::string ClockString (void)
ModelCreateModel (Model *parent, const char *typestr)
SuperRegionCreateSuperRegion (stg_point_int_t origin)
void DestroySuperRegion (SuperRegion *sr)
void ExpireSuperRegion (SuperRegion *sr)
void Extend (stg_point3_t pt)
void ForEachCellInLine (const stg_point_int_t &pt1, const stg_point_int_t &pt2, CellPtrVec &cells)
CellGetCell (const stg_point_int_t &glob)
stg_bounds3d_t GetExtent ()
ModelGetGround ()
ModelGetModel (const char *name)
stg_usec_t GetSimInterval ()
SuperRegionGetSuperRegion (const stg_point_int_t &coord)
SuperRegionGetSuperRegionCached (int32_t x, int32_t y)
SuperRegionGetSuperRegionCached (const stg_point_int_t &coord)
long unsigned int GetUpdateCount ()
WorldfileGetWorldFile ()
virtual bool IsGUI ()
virtual void Load (const char *worldfile_path)
void LoadBlock (Worldfile *wf, int entity)
void LoadBlockGroup (Worldfile *wf, int entity)
void LoadModel (Worldfile *wf, int entity)
void Log (Model *mod)
stg_point_int_t MetersToPixels (const stg_point_t &pt)
int32_t MetersToPixels (stg_meters_t x)
void NeedRedraw ()
bool PastQuitTime ()
bool Paused ()
virtual void PopColor ()
virtual void PushColor (double r, double g, double b, double a)
virtual void PushColor (Color col)
void Quit ()
void QuitAll ()
void Raytrace (const Pose &pose, const stg_meters_t range, const stg_radians_t fov, const stg_ray_test_func_t func, const Model *finder, const void *arg, stg_raytrace_result_t *samples, const uint32_t sample_count, const bool ztest)
stg_raytrace_result_t Raytrace (const Pose &pose, const stg_meters_t range, const stg_ray_test_func_t func, const Model *finder, const void *arg, const bool ztest)
stg_raytrace_result_t Raytrace (const Ray &ray)
stg_usec_t RealTimeNow (void)
stg_usec_t RealTimeSinceStart (void)
virtual ModelRecentlySelectedModel ()
void RecordRay (double x1, double y1, double x2, double y2)
void RegisterOption (Option *opt)
 Register an Option for pickup by the GUI.
virtual void Reload ()
virtual void RemoveModel (Model *mod)
void RemovePowerPack (PowerPack *pp)
int RemoveUpdateCallback (stg_world_callback_t cb, void *user)
double Resolution ()
virtual bool Save (const char *filename)
void ShowClock (bool enable)
 Control printing time to stdout.
stg_usec_t SimTimeNow (void)
virtual void Start ()
virtual void Stop ()
bool TestQuit ()
virtual void TogglePause ()
void TryCharge (PowerPack *pp, const Pose &pose)
virtual void UnLoad ()
virtual bool Update (void)
int UpdateListAdd (Model *mod)
void UpdateListRemove (Model *mod)
void VelocityListAdd (Model *mod)
void VelocityListRemove (Model *mod)
 World (const char *token="MyWorld", stg_msec_t interval_sim=DEFAULT_INTERVAL_SIM, double ppm=DEFAULT_PPM)
virtual ~World ()

Static Public Member Functions

static void * update_thread_entry (std::pair< World *, int > *info)
static bool UpdateAll ()

Public Attributes

Modelground
bool paused
 the world only updates when this is false or steps > 0
PointIntVec rt_candidate_cells
PointIntVec rt_cells
unsigned int steps

Static Public Attributes

static std::vector< std::string > args
static const stg_msec_t DEFAULT_INTERVAL_SIM = 100
 duration of sim timestep
static const int DEFAULT_PPM = 50

Protected Member Functions

void CallUpdateCallbacks ()
 Call all calbacks in cb_list, removing any that return true;.

Protected Attributes

std::list< std::pair
< stg_world_callback_t, void * > > 
cb_list
 List of callback functions and arguments.
stg_bounds3d_t extent
 Describes the 3D volume of the world.
bool graphics
 true iff we have a GUI
stg_usec_t interval_sim
 temporal resolution: microseconds that elapse between simulated time steps
std::set< Option * > option_table
 GUI options (toggles) registered by models.
std::list< PowerPack * > powerpack_list
 List of all the powerpacks attached to models in the world.
std::list< float * > ray_list
 List of rays traced for debug visualization.
stg_usec_t sim_time
 the current sim time in this world in microseconds
SuperRegionsr_cached
 The last superregion looked up by this world.
std::map< stg_point_int_t,
SuperRegion * > 
superregions
std::vector< ModelPtrVecupdate_lists
long unsigned int updates
 the number of simulated time steps executed so far
Worldfilewf
 If set, points to the worldfile used to create this world.

Detailed Description

World class

Constructor & Destructor Documentation

World::World ( const char *  token = "MyWorld",
stg_msec_t  interval_sim = DEFAULT_INTERVAL_SIM,
double  ppm = DEFAULT_PPM 
)

World::~World ( void   )  [virtual]


Member Function Documentation

void World::AddModel ( Model mod  )  [virtual]

void World::AddPowerPack ( PowerPack pp  ) 

SuperRegion * World::AddSuperRegion ( const stg_point_int_t coord  ) 

void World::AddUpdateCallback ( stg_world_callback_t  cb,
void *  user 
)

Attach a callback function, to be called with the argument at the end of a complete update step

void World::CallUpdateCallbacks (  )  [protected]

Call all calbacks in cb_list, removing any that return true;.

void Stg::World::CancelQuit (  )  [inline]

void Stg::World::CancelQuitAll (  )  [inline]

void World::ChargeListAdd ( Model mod  ) 

void World::ChargeListRemove ( Model mod  ) 

void World::ClearRays (  ) 

std::string World::ClockString ( void   )  [virtual]

Get human readable string that describes the current simulation time.

Reimplemented in Stg::WorldGui.

Model * World::CreateModel ( Model parent,
const char *  typestr 
)

SuperRegion * World::CreateSuperRegion ( stg_point_int_t  origin  ) 

void World::DestroySuperRegion ( SuperRegion sr  ) 

void Stg::World::ExpireSuperRegion ( SuperRegion sr  ) 

void World::Extend ( stg_point3_t  pt  ) 

Enlarge the bounding volume to include this point

void Stg::World::ForEachCellInLine ( const stg_point_int_t pt1,
const stg_point_int_t pt2,
CellPtrVec cells 
)

add a Cell pointer to the vector for each cell on the line from pt1 to pt2 inclusive

Cell * World::GetCell ( const stg_point_int_t glob  )  [inline]

stg_bounds3d_t Stg::World::GetExtent (  )  [inline]

Return the 3D bounding box of the world, in meters

Model* Stg::World::GetGround (  )  [inline]

Return the floor model

Model * World::GetModel ( const char *  name  ) 

Returns a pointer to the model identified by name, or NULL if nonexistent

stg_usec_t Stg::World::GetSimInterval (  )  [inline]

SuperRegion * World::GetSuperRegion ( const stg_point_int_t coord  )  [inline]

SuperRegion * World::GetSuperRegionCached ( int32_t  x,
int32_t  y 
) [inline]

SuperRegion * World::GetSuperRegionCached ( const stg_point_int_t coord  )  [inline]

long unsigned int Stg::World::GetUpdateCount (  )  [inline]

Return the number of times the world has been updated.

Worldfile* Stg::World::GetWorldFile (  )  [inline]

virtual bool Stg::World::IsGUI (  )  [inline, virtual]

Reimplemented in Stg::WorldGui.

void World::Load ( const char *  worldfile_path  )  [virtual]

Reimplemented in Stg::WorldGui.

void World::LoadBlock ( Worldfile wf,
int  entity 
)

void Stg::World::LoadBlockGroup ( Worldfile wf,
int  entity 
)

void World::LoadModel ( Worldfile wf,
int  entity 
)

void World::Log ( Model mod  ) 

Log the state of a Model

stg_point_int_t Stg::World::MetersToPixels ( const stg_point_t pt  )  [inline]

int32_t Stg::World::MetersToPixels ( stg_meters_t  x  )  [inline]

convert a distance in meters to a distance in world occupancy grid pixels

void Stg::World::NeedRedraw (  )  [inline]

hint that the world needs to be redrawn if a GUI is attached

bool World::PastQuitTime (  ) 

Returns true iff the current time is greater than the time we should quit

bool Stg::World::Paused (  )  [inline]

virtual void Stg::World::PopColor (  )  [inline, virtual]

Reimplemented in Stg::WorldGui.

virtual void Stg::World::PushColor ( double  r,
double  g,
double  b,
double  a 
) [inline, virtual]

Reimplemented in Stg::WorldGui.

virtual void Stg::World::PushColor ( Color  col  )  [inline, virtual]

Reimplemented in Stg::WorldGui.

void Stg::World::Quit (  )  [inline]

void Stg::World::QuitAll (  )  [inline]

void World::Raytrace ( const Pose pose,
const stg_meters_t  range,
const stg_radians_t  fov,
const stg_ray_test_func_t  func,
const Model finder,
const void *  arg,
stg_raytrace_result_t samples,
const uint32_t  sample_count,
const bool  ztest 
)

stg_raytrace_result_t World::Raytrace ( const Pose pose,
const stg_meters_t  range,
const stg_ray_test_func_t  func,
const Model finder,
const void *  arg,
const bool  ztest 
)

stg_raytrace_result_t World::Raytrace ( const Ray ray  ) 

trace a ray.

stg_usec_t World::RealTimeNow ( void   )  [inline]

stg_usec_t World::RealTimeSinceStart ( void   )  [inline]

virtual Model* Stg::World::RecentlySelectedModel (  )  [inline, virtual]

Reimplemented in Stg::WorldGui.

void World::RecordRay ( double  x1,
double  y1,
double  x2,
double  y2 
)

store rays traced for debugging purposes

void World::RegisterOption ( Option opt  ) 

Register an Option for pickup by the GUI.

void World::Reload ( void   )  [virtual]

void World::RemoveModel ( Model mod  )  [virtual]

void World::RemovePowerPack ( PowerPack pp  ) 

int World::RemoveUpdateCallback ( stg_world_callback_t  cb,
void *  user 
)

Remove a callback function. Any argument data passed to AddUpdateCallback is not automatically freed.

double Stg::World::Resolution (  )  [inline]

Get the resolution in pixels-per-metre of the underlying discrete raytracing model

bool World::Save ( const char *  filename  )  [virtual]

Reimplemented in Stg::WorldGui.

void Stg::World::ShowClock ( bool  enable  )  [inline]

Control printing time to stdout.

stg_usec_t World::SimTimeNow ( void   ) 

virtual void Stg::World::Start (  )  [inline, virtual]

Reimplemented in Stg::WorldGui.

virtual void Stg::World::Stop (  )  [inline, virtual]

Reimplemented in Stg::WorldGui.

bool Stg::World::TestQuit (  )  [inline]

virtual void Stg::World::TogglePause (  )  [inline, virtual]

void Stg::World::TryCharge ( PowerPack pp,
const Pose pose 
)

void World::UnLoad (  )  [virtual]

Reimplemented in Stg::WorldGui.

bool World::Update ( void   )  [virtual]

Reimplemented in Stg::WorldGui.

void * World::update_thread_entry ( std::pair< World *, int > *  info  )  [static]

bool World::UpdateAll (  )  [static]

returns true when time to quit, false otherwise

int World::UpdateListAdd ( Model mod  ) 

void World::UpdateListRemove ( Model mod  ) 

void World::VelocityListAdd ( Model mod  ) 

void World::VelocityListRemove ( Model mod  ) 


Member Data Documentation

std::vector< std::string > World::args [static]

contains the command line arguments passed to Stg::Init(), so that controllers can read them.

std::list<std::pair<stg_world_callback_t,void*> > Stg::World::cb_list [protected]

List of callback functions and arguments.

duration of sim timestep

const int Stg::World::DEFAULT_PPM = 50 [static]

Describes the 3D volume of the world.

bool Stg::World::graphics [protected]

true iff we have a GUI

Special model for the floor of the world

temporal resolution: microseconds that elapse between simulated time steps

std::set<Option*> Stg::World::option_table [protected]

GUI options (toggles) registered by models.

the world only updates when this is false or steps > 0

std::list<PowerPack*> Stg::World::powerpack_list [protected]

List of all the powerpacks attached to models in the world.

std::list<float*> Stg::World::ray_list [protected]

List of rays traced for debug visualization.

the current sim time in this world in microseconds

The last superregion looked up by this world.

unsigned int Stg::World::steps

When paused, stage updates while steps > 0, decrementing steps with each update.

std::vector<ModelPtrVec > Stg::World::update_lists [protected]

long unsigned int Stg::World::updates [protected]

the number of simulated time steps executed so far

Worldfile* Stg::World::wf [protected]

If set, points to the worldfile used to create this world.


The documentation for this class was generated from the following files:

Generated on Wed Jul 22 11:51:05 2009 for Stage by  doxygen 1.5.9