Stg::Model Class Reference

Model class More...

#include <stage.hh>

Inherits Stg::Ancestor.

Inherited by Stg::ModelActuator, Stg::ModelBlinkenlight, Stg::ModelBlobfinder, Stg::ModelCamera, Stg::ModelFiducial, Stg::ModelGripper, Stg::ModelLaser, Stg::ModelLightIndicator, Stg::ModelPosition, and Stg::ModelRanger.

List of all members.

Classes

class  CallbackHooks
class  Flag
class  GuiState
class  RasterVis
class  stg_cb_t
class  TrailItem
class  Visibility

Public Member Functions

BlockAddBlockRect (stg_meters_t x, stg_meters_t y, stg_meters_t dx, stg_meters_t dy, stg_meters_t dz)
void AddCallback (void *address, stg_model_callback_t cb, void *user)
void AddFlag (Flag *flag)
void AddFlagDecrCallback (stg_model_callback_t cb, void *user)
void AddFlagIncrCallback (stg_model_callback_t cb, void *user)
void AddLoadCallback (stg_model_callback_t cb, void *user)
void AddSaveCallback (stg_model_callback_t cb, void *user)
void AddShutdownCallback (stg_model_callback_t cb, void *user)
void AddStartupCallback (stg_model_callback_t cb, void *user)
void AddToPose (double dx, double dy, double dz, double da)
void AddToPose (const Pose &pose)
void AddUpdateCallback (stg_model_callback_t cb, void *user)
void AddVisualizer (Visualizer *custom_visual, bool on_by_default)
void BecomeParentOf (Model *child)
int CallCallbacks (void *address)
void ClearBlocks ()
bool DataIsFresh () const
void Disable ()
void Enable ()
PowerPackFindPowerPack () const
ModelGetChild (const std::string &name) const
Color GetColor () const
stg_usec_t GetEnergyInterval ()
int GetFiducialReturn () const
int GetFlagCount () const
Geom GetGeom () const
Pose GetGlobalPose () const
Velocity GetGlobalVelocity () const
uint32_t GetId () const
stg_kg_t GetMassOfChildren ()
const std::string & GetModelType () const
Pose GetPose () const
stg_usec_t GetPoseInterval ()
const void * GetProperty (const char *key) const
bool GetPropertyFloat (const char *key, float *f, float defaultval) const
bool GetPropertyInt (const char *key, int *i, int defaultval) const
bool GetPropertyStr (const char *key, char **c, char *defaultval) const
std::string GetSayString ()
unsigned int GetSubscriptionCount () const
stg_kg_t GetTotalMass ()
ModelGetUnsubscribedModelOfType (const std::string &type) const
ModelGetUnusedModelOfType (const std::string &type)
stg_usec_t GetUpdateInterval ()
Velocity GetVelocity () const
WorldGetWorld () const
Pose GlobalToLocal (const Pose &pose) const
bool HasSubscribers () const
void InitControllers ()
bool IsAntecedent (const Model *testmod) const
bool IsDescendent (const Model *testmod) const
bool IsRelated (const Model *testmod) const
virtual void Load ()
void Load (Worldfile *wf, int wf_entity)
void LoadBlock (Worldfile *wf, int entity)
void LoadControllerModule (const char *lib)
stg_point_t LocalToGlobal (const stg_point_t &pt) const
Pose LocalToGlobal (const Pose &pose) const
void LocalToPixels (const std::vector< stg_point_t > &local, std::vector< stg_point_int_t > &pixels) const
 Model (World *world, Model *parent=NULL, const std::string &type="model")
void NeedRedraw ()
ModelParent () const
void PlaceInFreeSpace (stg_meters_t xmin, stg_meters_t xmax, stg_meters_t ymin, stg_meters_t ymax)
virtual void PopColor ()
FlagPopFlag ()
std::string PoseString ()
virtual void Print (char *prefix) const
virtual const char * PrintWithPose () const
virtual void PushColor (double r, double g, double b, double a)
virtual void PushColor (Color col)
void PushFlag (Flag *flag)
void Rasterize (uint8_t *data, unsigned int width, unsigned int height, stg_meters_t cellwidth, stg_meters_t cellheight)
int RemoveCallback (void *member, stg_model_callback_t callback)
void RemoveFlag (Flag *flag)
void RemoveFlagDecrCallback (stg_model_callback_t cb)
void RemoveFlagIncrCallback (stg_model_callback_t cb)
void RemoveLoadCallback (stg_model_callback_t cb)
void RemoveSaveCallback (stg_model_callback_t cb)
void RemoveShutdownCallback (stg_model_callback_t cb)
void RemoveStartupCallback (stg_model_callback_t cb)
void RemoveUpdateCallback (stg_model_callback_t cb)
void RemoveVisualizer (Visualizer *custom_visual)
ModelRoot ()
virtual void Save ()
void Say (const std::string &str)
void SetBlobReturn (int val)
void SetBoundary (int val)
void SetColor (Color col)
void SetFiducialKey (int key)
void SetFiducialReturn (int fid)
void SetFriction (double friction)
void SetGeom (const Geom &src)
void SetGlobalPose (const Pose &gpose)
void SetGlobalVelocity (const Velocity &gvel)
void SetGravityReturn (int val)
void SetGripperReturn (int val)
void SetGuiGrid (int val)
void SetGuiMove (int val)
void SetGuiNose (int val)
void SetGuiOutline (int val)
void SetLaserReturn (stg_laser_return_t val)
void SetMapResolution (stg_meters_t res)
void SetMass (stg_kg_t mass)
void SetObstacleReturn (int val)
int SetParent (Model *newparent)
void SetPose (const Pose &pose)
int SetProperty (const char *key, const void *data)
 Set a named property of a Stage model.
void SetPropertyFloat (const char *key, float f)
void SetPropertyInt (const char *key, int i)
void SetPropertyStr (const char *key, const char *str)
void SetRangerReturn (int val)
void SetStall (stg_bool_t stall)
void SetStickyReturn (int val)
void SetVelocity (const Velocity &vel)
void SetWatts (stg_watts_t watts)
void SetWorldfile (Worldfile *wf, int wf_entity)
bool Stalled () const
void Subscribe ()
void UnsetProperty (const char *key)
void Unsubscribe ()
void VelocityDisable ()
void VelocityEnable ()
virtual ~Model ()

Static Public Member Functions

static ModelLookupId (uint32_t id)

Public Attributes

class Stg::Model::Visibility vis

Static Public Attributes

static std::map< std::string,
creator_t
name_map

Protected Member Functions

void AppendTouchingModels (ModelPtrSet &touchers)
void CommitTestedPose ()
ModelConditionalMove (const Pose &newpose)
virtual void DataVisualize (Camera *cam)
void DataVisualizeTree (Camera *cam)
virtual void DrawBlocks ()
void DrawBlocksTree ()
void DrawBoundingBox ()
void DrawBoundingBoxTree ()
void DrawFlagList ()
void DrawGrid ()
void DrawImage (uint32_t texture_id, Camera *cam, float alpha, double width=1.0, double height=1.0)
void DrawOrigin ()
void DrawOriginTree ()
virtual void DrawPicker ()
void DrawPose (Pose pose)
virtual void DrawSelected (void)
virtual void DrawStatus (Camera *cam)
void DrawStatusTree (Camera *cam)
void DrawTrailArrows ()
void DrawTrailBlocks ()
void DrawTrailFootprint ()
void GPoseDirtyTree ()
void LoadDataBaseEntries (Worldfile *wf, int entity)
void Map ()
void MapFromRoot ()
void MapWithChildren ()
stg_meters_t ModelHeight () const
void PopCoords ()
void PushLocalCoords ()
void Raytrace (const stg_radians_t bearing, const stg_meters_t range, const stg_radians_t fov, const stg_ray_test_func_t func, const void *arg, stg_raytrace_result_t *samples, const uint32_t sample_count, const bool ztest=true)
stg_raytrace_result_t Raytrace (const stg_radians_t bearing, const stg_meters_t range, const stg_ray_test_func_t func, const void *arg, const bool ztest=true)
void Raytrace (const Pose &pose, const stg_meters_t range, const stg_radians_t fov, const stg_ray_test_func_t func, const void *arg, stg_raytrace_result_t *samples, const uint32_t sample_count, const bool ztest=true)
stg_raytrace_result_t Raytrace (const Pose &pose, const stg_meters_t range, const stg_ray_test_func_t func, const void *arg, const bool ztest=true)
void RegisterOption (Option *opt)
virtual void Shutdown ()
virtual void Startup ()
ModelTestCollision ()
ModelTestCollisionTree ()
void UnMap ()
void UnMapFromRoot ()
void UnMapWithChildren ()
virtual void Update ()
virtual void UpdateCharge ()
virtual void UpdatePose ()
void UpdateTrail ()

Protected Attributes

pthread_mutex_t access_mutex
 Used by Lock() and Unlock() to prevent parallel access to this model.
bool alwayson
BlockGroup blockgroup
int blocks_dl
int boundary
Color color
std::list< Visualizer * > cv_list
bool data_fresh
stg_bool_t disabled
 if non-zero, the model is disabled
unsigned int event_queue_num
std::list< Flag * > flag_list
double friction
Geom geom
class Stg::Model::GuiState gui
bool has_default_block
class Stg::Model::CallbackHooks hooks
uint32_t id
stg_usec_t interval
 time between updates in usec
stg_usec_t interval_energy
 time between updates of powerpack in usec
stg_usec_t interval_pose
 time between updates of pose due to velocity in usec
stg_usec_t last_update
 time of last update in us
bool log_state
 iff true, model state is logged
stg_meters_t map_resolution
stg_kg_t mass
Modelparent
Pose pose
PowerPackpower_pack
std::list< PowerPack * > pps_charging
std::map< std::string, const
void * > 
props
Stg::Model::RasterVis rastervis
bool rebuild_displaylist
 iff true, regenerate block display list before redraw
std::string say_string
 if non-null, this string is displayed in the GUI
stg_bool_t stall
int subs
 the number of subscriptions to this model
bool thread_safe
std::list< TrailItemtrail
const std::string type
bool used
 TRUE iff this model has been returned by GetUnusedModelOfType().
Velocity velocity
bool velocity_enable
stg_watts_t watts
 power consumed by this model
stg_watts_t watts_give
stg_watts_t watts_take
Worldfilewf
int wf_entity
Worldworld
WorldGuiworld_gui

Static Protected Attributes

static std::map< void
*, std::set< stg_cb_t > > 
callbacks
static uint64_t trail_interval = 5
static unsigned int trail_length = 50

Detailed Description

Model class


Constructor & Destructor Documentation

Model::Model ( World world,
Model parent = NULL,
const std::string &  type = "model" 
)

Constructor

Model::~Model ( void   )  [virtual]

Destructor


Member Function Documentation

Block * Model::AddBlockRect ( stg_meters_t  x,
stg_meters_t  y,
stg_meters_t  dx,
stg_meters_t  dy,
stg_meters_t  dz 
)

Add a block to this model centered at [x,y] with extent [dx, dy, dz]

void Model::AddCallback ( void *  address,
stg_model_callback_t  cb,
void *  user 
)
void Model::AddFlag ( Flag flag  ) 
void Stg::Model::AddFlagDecrCallback ( stg_model_callback_t  cb,
void *  user 
) [inline]
void Stg::Model::AddFlagIncrCallback ( stg_model_callback_t  cb,
void *  user 
) [inline]
void Stg::Model::AddLoadCallback ( stg_model_callback_t  cb,
void *  user 
) [inline]
void Stg::Model::AddSaveCallback ( stg_model_callback_t  cb,
void *  user 
) [inline]
void Stg::Model::AddShutdownCallback ( stg_model_callback_t  cb,
void *  user 
) [inline]
void Stg::Model::AddStartupCallback ( stg_model_callback_t  cb,
void *  user 
) [inline]
void Model::AddToPose ( double  dx,
double  dy,
double  dz,
double  da 
)

add values to a model's pose in its parent's coordinate system

void Model::AddToPose ( const Pose pose  ) 

add values to a model's pose in its parent's coordinate system

void Stg::Model::AddUpdateCallback ( stg_model_callback_t  cb,
void *  user 
) [inline]
void Model::AddVisualizer ( Visualizer custom_visual,
bool  on_by_default 
)

Attach a user supplied visualization to a model.

void Model::AppendTouchingModels ( ModelPtrSet touchers  )  [protected]
void Model::BecomeParentOf ( Model child  ) 
int Model::CallCallbacks ( void *  address  ) 
void Model::ClearBlocks ( void   ) 

remove all blocks from this model, freeing their memory

void Model::CommitTestedPose (  )  [protected]
Model * Model::ConditionalMove ( const Pose newpose  )  [protected]
bool Stg::Model::DataIsFresh (  )  const [inline]
void Model::DataVisualize ( Camera cam  )  [protected, virtual]
void Model::DataVisualizeTree ( Camera cam  )  [protected]
void Stg::Model::Disable (  )  [inline]

Add a pointer to a blinkenlight to the model. Clear all blinkenlights from the model. Does not destroy the blinkenlight objects. Disable the model. Its pose will not change due to velocity until re-enabled using Enable(). This is used for example when dragging a model with the mouse pointer. The model is enabled by default.

void Model::DrawBlocks (  )  [protected, virtual]

Reimplemented in Stg::ModelLightIndicator.

void Model::DrawBlocksTree (  )  [protected]
void Model::DrawBoundingBox (  )  [protected]
void Model::DrawBoundingBoxTree (  )  [protected]
void Model::DrawFlagList ( void   )  [protected]
void Model::DrawGrid ( void   )  [protected]
void Model::DrawImage ( uint32_t  texture_id,
Camera cam,
float  alpha,
double  width = 1.0,
double  height = 1.0 
) [protected]

Draw the image stored in texture_id above the model

void Stg::Model::DrawOrigin (  )  [protected]
void Model::DrawOriginTree (  )  [protected]
void Model::DrawPicker ( void   )  [protected, virtual]
void Model::DrawPose ( Pose  pose  )  [protected]
void Model::DrawSelected ( void   )  [protected, virtual]
void Model::DrawStatus ( Camera cam  )  [protected, virtual]
void Model::DrawStatusTree ( Camera cam  )  [protected]
void Model::DrawTrailArrows (  )  [protected]
void Model::DrawTrailBlocks (  )  [protected]
void Model::DrawTrailFootprint (  )  [protected]
void Stg::Model::Enable (  )  [inline]

Enable the model, so that non-zero velocities will change the model's pose. Models are enabled by default.

PowerPack * Model::FindPowerPack (  )  const
Model * Model::GetChild ( const std::string &  name  )  const

Returns a pointer to the model identified by name, or NULL if it doesn't exist in this model.

Color Stg::Model::GetColor (  )  const [inline]
stg_usec_t Stg::Model::GetEnergyInterval (  )  [inline]
int Stg::Model::GetFiducialReturn (  )  const [inline]

Get a model's fiducial return value.

int Stg::Model::GetFlagCount (  )  const [inline]
Geom Stg::Model::GetGeom (  )  const [inline]

Get (a copy of) the model's geometry - it's size and local pose (offset from origin in local coords).

Pose Model::GetGlobalPose (  )  const

get the pose of a model in the global CS

Velocity Model::GetGlobalVelocity (  )  const

get the velocity of a model in the global CS

uint32_t Stg::Model::GetId (  )  const [inline]

return a model's unique process-wide identifier

stg_kg_t Model::GetMassOfChildren (  ) 

Get the mass of this model's children recursively.

const std::string& Stg::Model::GetModelType (  )  const [inline]
Pose Stg::Model::GetPose (  )  const [inline]

Get (a copy of) the pose of a model in its parent's coordinate system.

stg_usec_t Stg::Model::GetPoseInterval (  )  [inline]
const void * Model::GetProperty ( const char *  key  )  const

named-property interface

bool Model::GetPropertyFloat ( const char *  key,
float *  f,
float  defaultval 
) const
bool Model::GetPropertyInt ( const char *  key,
int *  i,
int  defaultval 
) const
bool Model::GetPropertyStr ( const char *  key,
char **  c,
char *  defaultval 
) const
std::string Stg::Model::GetSayString (  )  [inline]
unsigned int Stg::Model::GetSubscriptionCount (  )  const [inline]

Returns the current number of subscriptions. If alwayson, this is never less than 1.

stg_kg_t Model::GetTotalMass (  ) 

Get the total mass of a model and it's children recursively

Model * Model::GetUnsubscribedModelOfType ( const std::string &  type  )  const

returns the first descendent of this model that is unsubscribed and has the type indicated by the string

Model * Model::GetUnusedModelOfType ( const std::string &  type  ) 

returns the first descendent of this model that is unused and has the type indicated by the string. This model is tagged as used.

stg_usec_t Stg::Model::GetUpdateInterval (  )  [inline]
Velocity Stg::Model::GetVelocity (  )  const [inline]

Get (a copy of) the model's velocity in its local reference frame.

World* Stg::Model::GetWorld (  )  const [inline]

Returns a pointer to the world that contains this model

Pose Model::GlobalToLocal ( const Pose pose  )  const

Given a global pose, returns that pose in the model's local coordinate system.

void Stg::Model::GPoseDirtyTree (  )  [protected]

Causes this model and its children to recompute their global position instead of using a cached pose in Model::GetGlobalPose()..

bool Stg::Model::HasSubscribers (  )  const [inline]

Returns true if the model has one or more subscribers, else false.

void Model::InitControllers (  ) 

Call Init() for all attached controllers.

bool Model::IsAntecedent ( const Model testmod  )  const
bool Model::IsDescendent ( const Model testmod  )  const

returns true if model [testmod] is a descendent of this model

bool Model::IsRelated ( const Model testmod  )  const

returns true if model [testmod] is a descendent or antecedent of this model

void Model::Load ( void   )  [virtual]
void Stg::Model::Load ( Worldfile wf,
int  wf_entity 
) [inline]

Set the worldfile and worldfile entity ID - must be called before Load()

Reimplemented from Stg::Ancestor.

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

Add a block to this model by loading it from a worldfile entity

void Model::LoadControllerModule ( const char *  lib  ) 

Load a control program for this model from an external library

void Model::LoadDataBaseEntries ( Worldfile wf,
int  entity 
) [protected]
stg_point_t Model::LocalToGlobal ( const stg_point_t pt  )  const

Return the 2d point in world coordinates of a 2d point specified in the model's local coordinate system

Pose Stg::Model::LocalToGlobal ( const Pose pose  )  const [inline]

Return the global pose (i.e. pose in world coordinates) of a pose specified in the model's local coordinate system

void Model::LocalToPixels ( const std::vector< stg_point_t > &  local,
std::vector< stg_point_int_t > &  pixels 
) const

Fill an array of global pixels from an array of local points.

static Model* Stg::Model::LookupId ( uint32_t  id  )  [inline, static]

Look up a model pointer by a unique model ID

void Model::Map (  )  [protected]
void Model::MapFromRoot (  )  [protected]
void Model::MapWithChildren (  )  [protected]
stg_meters_t Model::ModelHeight (  )  const [protected]
void Model::NeedRedraw ( void   ) 

Sets the redraw flag, so this model will be redrawn at the earliest opportunity

Model* Stg::Model::Parent (  )  const [inline]

Returns a pointer to this model's parent model, or NULL if this model has no parent

void Model::PlaceInFreeSpace ( stg_meters_t  xmin,
stg_meters_t  xmax,
stg_meters_t  ymin,
stg_meters_t  ymax 
)
virtual void Stg::Model::PopColor (  )  [inline, virtual]
void Model::PopCoords (  )  [protected]
Model::Flag * Model::PopFlag (  ) 
std::string Stg::Model::PoseString (  )  [inline]

Return a human-readable string describing the model's pose

void Model::Print ( char *  prefix  )  const [virtual]
const char * Model::PrintWithPose (  )  const [virtual]
virtual void Stg::Model::PushColor ( double  r,
double  g,
double  b,
double  a 
) [inline, virtual]
virtual void Stg::Model::PushColor ( Color  col  )  [inline, virtual]
void Model::PushFlag ( Flag flag  ) 
void Model::PushLocalCoords (  )  [protected]
void Model::Rasterize ( uint8_t *  data,
unsigned int  width,
unsigned int  height,
stg_meters_t  cellwidth,
stg_meters_t  cellheight 
)

Render the model's blocks as an occupancy grid into the preallocated array of width by height pixels

void Model::Raytrace ( const stg_radians_t  bearing,
const stg_meters_t  range,
const stg_radians_t  fov,
const stg_ray_test_func_t  func,
const void *  arg,
stg_raytrace_result_t samples,
const uint32_t  sample_count,
const bool  ztest = true 
) [protected]
stg_raytrace_result_t Model::Raytrace ( const stg_radians_t  bearing,
const stg_meters_t  range,
const stg_ray_test_func_t  func,
const void *  arg,
const bool  ztest = true 
) [protected]
void Stg::Model::Raytrace ( const Pose pose,
const stg_meters_t  range,
const stg_radians_t  fov,
const stg_ray_test_func_t  func,
const void *  arg,
stg_raytrace_result_t samples,
const uint32_t  sample_count,
const bool  ztest = true 
) [protected]

raytraces multiple rays around the point and heading identified by pose, in local coords

stg_raytrace_result_t Model::Raytrace ( const Pose pose,
const stg_meters_t  range,
const stg_ray_test_func_t  func,
const void *  arg,
const bool  ztest = true 
) [protected]

raytraces a single ray from the point and heading identified by pose, in local coords

void Model::RegisterOption ( Option opt  )  [protected]

Register an Option for pickup by the GUI.

int Model::RemoveCallback ( void *  member,
stg_model_callback_t  callback 
)
void Model::RemoveFlag ( Flag flag  ) 
void Stg::Model::RemoveFlagDecrCallback ( stg_model_callback_t  cb  )  [inline]
void Stg::Model::RemoveFlagIncrCallback ( stg_model_callback_t  cb  )  [inline]
void Stg::Model::RemoveLoadCallback ( stg_model_callback_t  cb  )  [inline]
void Stg::Model::RemoveSaveCallback ( stg_model_callback_t  cb  )  [inline]
void Stg::Model::RemoveShutdownCallback ( stg_model_callback_t  cb  )  [inline]
void Stg::Model::RemoveStartupCallback ( stg_model_callback_t  cb  )  [inline]
void Stg::Model::RemoveUpdateCallback ( stg_model_callback_t  cb  )  [inline]
void Model::RemoveVisualizer ( Visualizer custom_visual  ) 

remove user supplied visualization to a model - supply the same ptr passed to AddCustomVisualizer

Model* Stg::Model::Root (  )  [inline]

return the root model of the tree containing this model

void Model::Save ( void   )  [virtual]

save the state of the model to the current world file

Reimplemented in Stg::ModelGripper.

void Model::Say ( const std::string &  str  ) 
void Model::SetBlobReturn ( int  val  ) 
void Model::SetBoundary ( int  val  ) 
void Model::SetColor ( Color  col  ) 
void Model::SetFiducialKey ( int  key  ) 

set a model's fiducial key: only fiducial finders with a matching key can detect this model as a fiducial.

void Model::SetFiducialReturn ( int  fid  ) 

Set a model's fiducial return value. Values less than zero are not detected by the fiducial sensor.

void Model::SetFriction ( double  friction  ) 
void Model::SetGeom ( const Geom src  ) 

set a model's geometry (size and center offsets)

void Model::SetGlobalPose ( const Pose gpose  ) 

set the pose of model in global coordinates

void Model::SetGlobalVelocity ( const Velocity gvel  ) 
void Stg::Model::SetGravityReturn ( int  val  ) 
void Model::SetGripperReturn ( int  val  ) 
void Model::SetGuiGrid ( int  val  ) 
void Model::SetGuiMove ( int  val  ) 
void Model::SetGuiNose ( int  val  ) 
void Model::SetGuiOutline ( int  val  ) 
void Model::SetLaserReturn ( stg_laser_return_t  val  ) 
void Model::SetMapResolution ( stg_meters_t  res  ) 
void Model::SetMass ( stg_kg_t  mass  ) 
void Model::SetObstacleReturn ( int  val  ) 
int Model::SetParent ( Model newparent  ) 

Change a model's parent - experimental

void Model::SetPose ( const Pose pose  ) 

set a model's pose in its parent's coordinate system

int Model::SetProperty ( const char *  key,
const void *  data 
)

Set a named property of a Stage model.

Set a property of a Stage model.

This function can set both predefined and user-defined properties of a model. Predefined properties are intrinsic to every model, such as pose and color. Every supported predefined properties has its identifying string defined as a preprocessor macro in stage.h. Users should use the macro instead of a hard-coded string, so that the compiler can help you to avoid mis-naming properties.

User-defined properties allow the user to attach arbitrary data pointers to a model. User-defined property data is not copied, so the original pointer must remain valid. User-defined property names are simple strings. Names beginning with an underscore ('_') are reserved for internal libstage use: users should not use names beginning with underscore (at risk of causing very weird behaviour).

Any callbacks registered for the named property will be called.

Returns 0 on success, or a positive error code on failure.

CAUTION* The caller is responsible for making sure the pointer points to data of the correct type for the property, so use carefully. Check the docs or the equivalent stg_model_set_<property>() function definition to see the type of data required for each property.

void Model::SetPropertyFloat ( const char *  key,
float  f 
)
void Model::SetPropertyInt ( const char *  key,
int  i 
)
void Model::SetPropertyStr ( const char *  key,
const char *  str 
)
void Model::SetRangerReturn ( int  val  ) 
void Model::SetStall ( stg_bool_t  stall  ) 
void Stg::Model::SetStickyReturn ( int  val  ) 
void Model::SetVelocity ( const Velocity vel  ) 

set a model's velocity in its parent's coordinate system

void Model::SetWatts ( stg_watts_t  watts  ) 
void Stg::Model::SetWorldfile ( Worldfile wf,
int  wf_entity 
) [inline]

Set the worldfile and worldfile entity ID

void Model::Shutdown ( void   )  [protected, virtual]
bool Stg::Model::Stalled (  )  const [inline]

Returns the value of the model's stall boolean, which is true iff the model has crashed into another model

void Model::Startup ( void   )  [protected, virtual]
void Model::Subscribe ( void   ) 

subscribe to a model's data

Model * Model::TestCollision (  )  [protected]

Check to see if the current pose will yield a collision with obstacles. Returns a pointer to the first entity we are in collision with, or NULL if no collision exists.

Model * Model::TestCollisionTree (  )  [protected]

Recursively call TestCollision() on this model and all its descendents

void Model::UnMap (  )  [protected]
void Model::UnMapFromRoot (  )  [protected]
void Model::UnMapWithChildren (  )  [protected]
void Model::UnsetProperty ( const char *  key  ) 
void Model::Unsubscribe ( void   ) 

unsubscribe from a model's data

void Model::Update ( void   )  [protected, virtual]
void Model::UpdateCharge (  )  [protected, virtual]
void Model::UpdatePose ( void   )  [protected, virtual]
void Model::UpdateTrail (  )  [protected]

Record the current pose in our trail. Delete the trail head if it is full.

void Model::VelocityDisable (  ) 

Disable update of model pose according to velocity state

void Model::VelocityEnable (  ) 

Enable update of model pose according to velocity state


Member Data Documentation

pthread_mutex_t Stg::Model::access_mutex [protected]

Used by Lock() and Unlock() to prevent parallel access to this model.

Reimplemented from Stg::Ancestor.

bool Stg::Model::alwayson [protected]

If true, the model always has at least one subscription, so always runs. Defaults to false.

int Stg::Model::blocks_dl [protected]

OpenGL display list identifier for the blockgroup

int Stg::Model::boundary [protected]

Iff true, 4 thin blocks are automatically added to the model, forming a solid boundary around the bounding box of the model.

std::map< void *, std::set< Model::stg_cb_t > > Model::callbacks [static, protected]

A list of callback functions can be attached to any address. When Model::CallCallbacks( void*) is called, the callbacks are called.

Color Stg::Model::color [protected]

Default color of the model's blocks.

std::list<Visualizer*> Stg::Model::cv_list [protected]
bool Stg::Model::data_fresh [protected]

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.

if non-zero, the model is disabled

unsigned int Stg::Model::event_queue_num [protected]

The index into the world's vector of event queues. Initially -1, to indicate that it is not on a list yet.

std::list<Flag*> Stg::Model::flag_list [protected]
double Stg::Model::friction [protected]
Geom Stg::Model::geom [protected]

Records model state and functionality in the GUI, if used

uint32_t Stg::Model::id [protected]

unique process-wide identifier for this model

time between updates in usec

time between updates of powerpack in usec

time between updates of pose due to velocity in usec

time of last update in us

bool Stg::Model::log_state [protected]

iff true, model state is logged

std::map< std::string, creator_t > Model::name_map [static]
Model* Stg::Model::parent [protected]

Pointer to the parent of this model, possibly NULL.

Pose Stg::Model::pose [protected]

The pose of the model in it's parents coordinate frame, or the global coordinate frame is the parent is NULL.

Optional attached PowerPack, defaults to NULL

std::list<PowerPack*> Stg::Model::pps_charging [protected]

list of powerpacks that this model is currently charging, initially NULL.

std::map<std::string,const void*> Stg::Model::props [protected]

Props map can contain arbitrary named data items. Can be used by derived model types to store properties, and for user code to associate arbitrary items with a model.

Visualize the most recent rasterization operation performed by this model

iff true, regenerate block display list before redraw

std::string Stg::Model::say_string [protected]

if non-null, this string is displayed in the GUI

int Stg::Model::subs [protected]

the number of subscriptions to this model

bool Stg::Model::thread_safe [protected]

Thread safety flag. Iff true, Update() may be called in parallel with other models. Defaults to false for safety

std::list<TrailItem> Stg::Model::trail [protected]
uint64_t Model::trail_interval = 5 [static, protected]

Number of world updates between trail records.

uint32_t Model::trail_length = 50 [static, protected]

The maxiumum length of the trail drawn. Default is 20, but can be set in the world file using the tail_length model property.

const std::string Stg::Model::type [protected]
bool Stg::Model::used [protected]

TRUE iff this model has been returned by GetUnusedModelOfType().

bool Stg::Model::velocity_enable [protected]

respond to velocity state by changing position. Initially false, set to true by subclass, worldfile, or explcicit call to Model::VelocityEnable().

power consumed by this model

If >0, this model can transfer energy to models that have watts_take >0

If >0, this model can transfer energy from models that have watts_give >0

Worldfile* Stg::Model::wf [protected]
int Stg::Model::wf_entity [protected]
World* Stg::Model::world [protected]

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

Generated on Tue Oct 20 15:42:06 2009 for Stage by  doxygen 1.6.1