Stg::Model Class Reference

Model class More...

#include <stage.hh>

Inheritance diagram for Stg::Model:

Classes

class  cb_t
 
class  Flag
 
class  GuiState
 
class  RasterVis
 
class  TrailItem
 
class  Visibility
 

Public Types

enum  callback_type_t {
  CB_FLAGDECR , CB_FLAGINCR , CB_GEOM , CB_INIT ,
  CB_LOAD , CB_PARENT , CB_POSE , CB_SAVE ,
  CB_SHUTDOWN , CB_STARTUP , CB_UPDATE , CB_VELOCITY ,
  __CB_TYPE_COUNT
}
 

Public Member Functions

void AddBlockRect (meters_t x, meters_t y, meters_t dx, meters_t dy, meters_t dz)
 
void AddCallback (callback_type_t type, model_callback_t cb, void *user)
 
void AddFlag (Flag *flag)
 
void AddToPose (const Pose &pose)
 
void AddToPose (double dx, double dy, double dz, double da)
 
void AddVisualizer (Visualizer *custom_visual, bool on_by_default)
 
void BecomeParentOf (Model *child)
 
int CallCallbacks (callback_type_t type)
 
void ClearBlocks ()
 
bool DataIsFresh () const
 
void Disable ()
 
void Enable ()
 
PowerPackFindPowerPack () const
 
ModelGetChild (const std::string &name) const
 
Color GetColor () const
 
usec_t GetEnergyInterval () const
 
int GetFiducialReturn () const
 
unsigned int GetFlagCount () const
 
Geom GetGeom () const
 
Pose GetGlobalPose () const
 
uint32_t GetId () const
 
usec_t GetInterval ()
 
kg_t GetMassOfChildren () const
 
const std::string & GetModelType () const
 
Pose GetPose () const
 
std::string GetSayString ()
 
unsigned int GetSubscriptionCount () const
 
kg_t GetTotalMass () const
 
ModelGetUnsubscribedModelOfType (const std::string &type) const
 
ModelGetUnusedModelOfType (const std::string &type)
 
usec_t GetUpdateInterval () const
 
WorldGetWorld () const
 
Pose GlobalToLocal (const Pose &pose) const
 
bool HasCollision ()
 
bool HasSubscribers () const
 
void InitControllers ()
 
bool IsAntecedent (const Model *testmod) const
 
bool IsDescendent (const Model *testmod) const
 
bool IsEnabled () 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)
 
point_t LocalToGlobal (const point_t &pt) const
 
Pose LocalToGlobal (const Pose &pose) const
 
std::vector< point_int_tLocalToPixels (const std::vector< point_t > &local) const
 
 Model ()
 
 Model (World *world, Model *parent=NULL, const std::string &type="model", const std::string &name="")
 
void NeedRedraw ()
 
ModelParent () const
 
bool PlaceInFreeSpace (meters_t xmin, meters_t xmax, meters_t ymin, meters_t ymax, size_t max_iter=0)
 
virtual void PopColor ()
 
FlagPopFlag ()
 
std::string PoseString ()
 
virtual void Print (char *prefix) const
 
virtual const char * PrintWithPose () const
 
virtual void PushColor (Color col)
 
virtual void PushColor (double r, double g, double b, double a)
 
void PushFlag (Flag *flag)
 
bool RandomPoseInFreeSpace (meters_t xmin, meters_t xmax, meters_t ymin, meters_t ymax, size_t max_iter=0)
 
void Rasterize (uint8_t *data, unsigned int width, unsigned int height, meters_t cellwidth, meters_t cellheight)
 
void Redraw ()
 
int RemoveCallback (callback_type_t type, model_callback_t callback)
 
void RemoveFlag (Flag *flag)
 
void RemoveVisualizer (Visualizer *custom_visual)
 
ModelRoot ()
 
virtual void Save ()
 
void Say (const std::string &str)
 
void SetBlobReturn (bool val)
 
void SetBoundary (bool 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 SetGravityReturn (bool val)
 
void SetGripperReturn (bool val)
 
void SetGuiGrid (bool val)
 
void SetGuiMove (bool val)
 
void SetGuiNose (bool val)
 
void SetGuiOutline (bool val)
 
void SetMapResolution (meters_t res)
 
void SetMass (kg_t mass)
 
void SetObstacleReturn (bool val)
 
int SetParent (Model *newparent)
 
void SetPose (const Pose &pose)
 
void SetRangerReturn (bool val)
 
void SetRangerReturn (double val)
 
void SetStall (bool stall)
 
void SetStickyReturn (bool val)
 
virtual void SetToken (const std::string &str)
 
void SetWatts (watts_t watts)
 
void SetWorldfile (Worldfile *wf, int wf_entity)
 
bool Stalled () const
 
void Subscribe ()
 
void Unsubscribe ()
 
virtual ~Model ()
 
- Public Member Functions inherited from Stg::Ancestor
virtual void AddChild (Model *mod)
 
 Ancestor ()
 
void ForEachDescendant (model_callback_t func, void *arg)
 
std::vector< Model * > & GetChildren ()
 
void * GetProperty (std::string &key)
 
virtual void RemoveChild (Model *mod)
 
void SetProperty (std::string &key, void *value)
 
const char * Token () const
 
const std::string & TokenStr () const
 
virtual ~Ancestor ()
 

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_tname_map
 

Protected Member Functions

void AppendTouchingModels (std::set< Model * > &touchers)
 
void CallUpdateCallbacks (void)
 
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 Map ()
 
void Map (unsigned int layer)
 
void MapFromRoot (unsigned int layer)
 Find the root model, and map/unmap the whole tree.
 
void MapWithChildren (unsigned int layer)
 
meters_t ModelHeight () const
 
void PopCoords ()
 
void PushLocalCoords ()
 
void Raytrace (const Pose &pose, const meters_t range, const radians_t fov, const ray_test_func_t func, const void *arg, const bool ztest, std::vector< RaytraceResult > &results)
 
RaytraceResult Raytrace (const Pose &pose, const meters_t range, const ray_test_func_t func, const void *arg, const bool ztest)
 
void RegisterOption (Option *opt)
 
virtual void Shutdown ()
 
virtual void Startup ()
 
ModelTestCollision ()
 
void UnMap ()
 
void UnMap (unsigned int layer)
 
void UnMapFromRoot (unsigned int layer)
 
void UnMapWithChildren (unsigned int layer)
 
virtual void Update ()
 
virtual void UpdateCharge ()
 
void UpdateTrail ()
 
- Protected Member Functions inherited from Stg::Ancestor
AncestorLoad (Worldfile *wf, int section)
 
void Save (Worldfile *wf, int section)
 

Static Protected Member Functions

static int UpdateWrapper (Model *mod, void *)
 

Protected Attributes

bool alwayson
 
BlockGroup blockgroup
 
int boundary
 
std::vector< std::set< cb_t > > callbacks
 
Color color
 
std::list< Visualizer * > cv_list
 
bool data_fresh
 
bool disabled
 
unsigned int event_queue_num
 
std::list< Flag * > flag_list
 
double friction
 
Geom geom
 
class Stg::Model::GuiState gui
 
bool has_default_block
 
uint32_t id
 
usec_t interval
 time between updates in usec
 
usec_t interval_energy
 time between updates of powerpack in usec
 
usec_t last_update
 time of last update in us
 
bool log_state
 iff true, model state is logged
 
meters_t map_resolution
 
kg_t mass
 
Modelparent
 
Pose pose
 
PowerPackpower_pack
 
std::list< PowerPack * > pps_charging
 
Stg::Model::RasterVis rastervis
 
bool rebuild_displaylist
 iff true, regenerate block display list before redraw
 
std::string say_string
 if non-empty, this string is displayed in the GUI
 
bool stack_children
 whether child models should be stacked on top of this model or not
 
bool stall
 Set to true iff the model collided with something else.
 
int subs
 the number of subscriptions to this model
 
bool thread_safe
 
std::vector< TrailItemtrail
 
unsigned int trail_index
 
uint64_t trail_interval
 
const std::string type
 
bool used
 TRUE iff this model has been returned by GetUnusedModelOfType()
 
watts_t watts
 power consumed by this model
 
watts_t watts_give
 
watts_t watts_take
 
Worldfilewf
 
int wf_entity
 
Worldworld
 Pointer to the world in which this model exists.
 
WorldGuiworld_gui
 Pointer to the GUI world - NULL if running in non-gui mode.
 
- Protected Attributes inherited from Stg::Ancestor
std::map< std::string, unsigned int > child_type_counts
 
std::vector< Model * > children
 
bool debug
 
std::map< std::string, void * > props
 
std::string token
 

Detailed Description

Model class

Member Enumeration Documentation

◆ callback_type_t

Enumerator
CB_FLAGDECR 
CB_FLAGINCR 
CB_GEOM 
CB_INIT 
CB_LOAD 
CB_PARENT 
CB_POSE 
CB_SAVE 
CB_SHUTDOWN 
CB_STARTUP 
CB_UPDATE 
CB_VELOCITY 
__CB_TYPE_COUNT 

must be the last entry: counts the number of types

Constructor & Destructor Documentation

◆ Model() [1/2]

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

Constructor

◆ ~Model()

Model::~Model ( void )
virtual

Destructor

◆ Model() [2/2]

Stg::Model::Model ( )
inline

Alternate constructor that creates dummy models with only a pose

Member Function Documentation

◆ AddBlockRect()

void Model::AddBlockRect ( meters_t x,
meters_t y,
meters_t dx,
meters_t dy,
meters_t dz )

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

◆ AddCallback()

void Model::AddCallback ( callback_type_t type,
model_callback_t cb,
void * user )

attach callback functions to data members. The function gets called when the member is changed using SetX() accessor method Add a callback. The specified function is called whenever the indicated model method is called, and passed the user data.

Parameters
cbPointer the function to be called.
userPointer to arbitrary user data, passed to the callback when called.

◆ AddFlag()

void Model::AddFlag ( Flag * flag)

◆ AddToPose() [1/2]

void Model::AddToPose ( const Pose & pose)

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

◆ AddToPose() [2/2]

void Model::AddToPose ( double dx,
double dy,
double dz,
double da )

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

◆ AddVisualizer()

void Model::AddVisualizer ( Visualizer * custom_visual,
bool on_by_default )

Attach a user supplied visualization to a model.

◆ AppendTouchingModels()

void Model::AppendTouchingModels ( std::set< Model * > & touchers)
protected

◆ BecomeParentOf()

void Model::BecomeParentOf ( Model * child)

◆ CallCallbacks()

int Model::CallCallbacks ( callback_type_t type)

◆ CallUpdateCallbacks()

void Model::CallUpdateCallbacks ( void )
protected

Calls CallCallback( CB_UPDATE )

◆ ClearBlocks()

void Model::ClearBlocks ( )

remove all blocks from this model, freeing their memory

◆ DataIsFresh()

bool Stg::Model::DataIsFresh ( ) const
inline

◆ DataVisualize()

void Model::DataVisualize ( Camera * cam)
protectedvirtual

Reimplemented in Stg::ModelBlinkenlight, and Stg::ModelCamera.

◆ DataVisualizeTree()

void Model::DataVisualizeTree ( Camera * cam)
protected

◆ Disable()

void Stg::Model::Disable ( )
inline

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.

◆ DrawBlocks()

void Model::DrawBlocks ( )
protectedvirtual

Reimplemented in Stg::ModelLightIndicator.

◆ DrawBlocksTree()

void Model::DrawBlocksTree ( )
protected

◆ DrawBoundingBox()

void Model::DrawBoundingBox ( )
protected

◆ DrawBoundingBoxTree()

void Model::DrawBoundingBoxTree ( )
protected

◆ DrawFlagList()

void Model::DrawFlagList ( void )
protected

◆ DrawGrid()

void Model::DrawGrid ( void )
protected

◆ DrawImage()

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

◆ DrawOrigin()

void Stg::Model::DrawOrigin ( )
protected

◆ DrawOriginTree()

void Model::DrawOriginTree ( )
protected

◆ DrawPicker()

void Model::DrawPicker ( void )
protectedvirtual

◆ DrawPose()

void Model::DrawPose ( Pose pose)
protected

◆ DrawSelected()

void Model::DrawSelected ( void )
protectedvirtual

◆ DrawStatus()

void Model::DrawStatus ( Camera * cam)
protectedvirtual

◆ DrawStatusTree()

void Model::DrawStatusTree ( Camera * cam)
protected

◆ DrawTrailArrows()

void Model::DrawTrailArrows ( )
protected

◆ DrawTrailBlocks()

void Model::DrawTrailBlocks ( )
protected

◆ DrawTrailFootprint()

void Model::DrawTrailFootprint ( )
protected

◆ Enable()

void Stg::Model::Enable ( )
inline

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

◆ FindPowerPack()

PowerPack * Model::FindPowerPack ( ) const

◆ GetChild()

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.

◆ GetColor()

Color Stg::Model::GetColor ( ) const
inline

◆ GetEnergyInterval()

usec_t Stg::Model::GetEnergyInterval ( ) const
inline

◆ GetFiducialReturn()

int Stg::Model::GetFiducialReturn ( ) const
inline

Get a model's fiducial return value.

◆ GetFlagCount()

unsigned int Stg::Model::GetFlagCount ( ) const
inline

◆ GetGeom()

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).

◆ GetGlobalPose()

Pose Model::GetGlobalPose ( ) const
virtual

get the pose of a model in the global CS

Reimplemented from Stg::Ancestor.

◆ GetId()

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

return a model's unique process-wide identifier

◆ GetInterval()

usec_t Stg::Model::GetInterval ( )
inline

return the update interval in usec

◆ GetMassOfChildren()

kg_t Model::GetMassOfChildren ( ) const

Get the mass of this model's children recursively.

◆ GetModelType()

const std::string & Stg::Model::GetModelType ( ) const
inline

◆ GetPose()

Pose Stg::Model::GetPose ( ) const
inline

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

◆ GetSayString()

std::string Stg::Model::GetSayString ( )
inline

◆ GetSubscriptionCount()

unsigned int Stg::Model::GetSubscriptionCount ( ) const
inline

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

◆ GetTotalMass()

kg_t Model::GetTotalMass ( ) const

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

◆ GetUnsubscribedModelOfType()

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

◆ GetUnusedModelOfType()

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.

◆ GetUpdateInterval()

usec_t Stg::Model::GetUpdateInterval ( ) const
inline

◆ GetWorld()

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

Returns a pointer to the world that contains this model

◆ GlobalToLocal()

Pose Model::GlobalToLocal ( const Pose & pose) const

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

◆ HasCollision()

bool Stg::Model::HasCollision ( )
inline

Check to see if the current pose causes a collision with obstacles. Returns true if a collision is detected but does not update the stall state, and false otherwise.

◆ HasSubscribers()

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

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

◆ InitControllers()

void Model::InitControllers ( )

Call Init() for all attached controllers.

◆ IsAntecedent()

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

◆ IsDescendent()

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

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

◆ IsEnabled()

bool Stg::Model::IsEnabled ( ) const
inline

Test if the model is enabled. See also Disable() and Enable().

◆ IsRelated()

bool Model::IsRelated ( const Model * testmod) const

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

◆ Load() [1/2]

void Model::Load ( void )
virtual

◆ Load() [2/2]

void Stg::Model::Load ( Worldfile * wf,
int wf_entity )
inline

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

◆ LoadBlock()

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

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

◆ LoadControllerModule()

void Model::LoadControllerModule ( const char * lib)

Load a control program for this model from an external library

◆ LocalToGlobal() [1/2]

point_t Model::LocalToGlobal ( const point_t & pt) const

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

◆ LocalToGlobal() [2/2]

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

◆ LocalToPixels()

std::vector< point_int_t > Model::LocalToPixels ( const std::vector< point_t > & local) const

Return a vector of global pixels corresponding to a vector of local points.

◆ LookupId()

static Model * Stg::Model::LookupId ( uint32_t id)
inlinestatic

Look up a model pointer by a unique model ID

◆ Map() [1/2]

void Stg::Model::Map ( )
inlineprotected

Call Map on all layers

◆ Map() [2/2]

void Model::Map ( unsigned int layer)
protected

◆ MapFromRoot()

void Model::MapFromRoot ( unsigned int layer)
protected

Find the root model, and map/unmap the whole tree.

◆ MapWithChildren()

void Model::MapWithChildren ( unsigned int layer)
protected

◆ ModelHeight()

meters_t Model::ModelHeight ( ) const
protected

◆ NeedRedraw()

void Model::NeedRedraw ( void )

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

◆ Parent()

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

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

◆ PlaceInFreeSpace()

bool Stg::Model::PlaceInFreeSpace ( meters_t xmin,
meters_t xmax,
meters_t ymin,
meters_t ymax,
size_t max_iter = 0 )

Ensures that the model is placed in free space (w/o collisions). The pose is not altered if the model is already in free space. Since this is implemented in a set-and-test manner, you can provide a maximum number of tries to prevent running indefinitely.

Parameters
xminminimum x position for the model
xmaxmaximum x position for the model
yminminimum y position for the model
ymaxmaximum x position for the model
max_itermaximum number of iterations, 0 to possibly run/try indefinitely
Returns
true on success, false otherwise (no pose found within max_iter)

◆ PopColor()

virtual void Stg::Model::PopColor ( )
inlinevirtual

◆ PopCoords()

void Model::PopCoords ( )
protected

◆ PopFlag()

Model::Flag * Model::PopFlag ( )

◆ PoseString()

std::string Stg::Model::PoseString ( )
inline

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

◆ Print()

void Model::Print ( char * prefix) const
virtual

Reimplemented in Stg::ModelBumper, and Stg::ModelRanger.

◆ PrintWithPose()

const char * Model::PrintWithPose ( ) const
virtual

◆ PushColor() [1/2]

virtual void Stg::Model::PushColor ( Color col)
inlinevirtual

◆ PushColor() [2/2]

virtual void Stg::Model::PushColor ( double r,
double g,
double b,
double a )
inlinevirtual

◆ PushFlag()

void Model::PushFlag ( Flag * flag)

◆ PushLocalCoords()

void Model::PushLocalCoords ( )
protected

◆ RandomPoseInFreeSpace()

bool Model::RandomPoseInFreeSpace ( meters_t xmin,
meters_t xmax,
meters_t ymin,
meters_t ymax,
size_t max_iter = 0 )

Behaves much like PlaceInFreeSpace() but always changes the pose to a random one.

Ensures that the model is placed in free space (w/o collisions). The pose is not altered if the model is already in free space. Since this is implemented in a set-and-test manner, you can provide a maximum number of tries to prevent running indefinitely.

Parameters
xminminimum x position for the model
xmaxmaximum x position for the model
yminminimum y position for the model
ymaxmaximum x position for the model
max_itermaximum number of iterations, 0 to possibly run/try indefinitely
Returns
true on success, false otherwise (no pose found within max_iter)

◆ Rasterize()

void Model::Rasterize ( uint8_t * data,
unsigned int width,
unsigned int height,
meters_t cellwidth,
meters_t cellheight )

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

◆ Raytrace() [1/2]

void Stg::Model::Raytrace ( const Pose & pose,
const meters_t range,
const radians_t fov,
const ray_test_func_t func,
const void * arg,
const bool ztest,
std::vector< RaytraceResult > & results )
inlineprotected

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

◆ Raytrace() [2/2]

RaytraceResult Stg::Model::Raytrace ( const Pose & pose,
const meters_t range,
const ray_test_func_t func,
const void * arg,
const bool ztest )
inlineprotected

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

◆ Redraw()

void Model::Redraw ( void )

Force the GUI (if any) to redraw this model

◆ RegisterOption()

void Model::RegisterOption ( Option * opt)
protected

Register an Option for pickup by the GUI.

◆ RemoveCallback()

int Model::RemoveCallback ( callback_type_t type,
model_callback_t callback )

◆ RemoveFlag()

void Model::RemoveFlag ( Flag * flag)

◆ RemoveVisualizer()

void Model::RemoveVisualizer ( Visualizer * custom_visual)

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

◆ Root()

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

return the root model of the tree containing this model

◆ Save()

void Model::Save ( void )
virtual

save the state of the model to the current world file

Reimplemented in Stg::ModelGripper.

◆ Say()

void Model::Say ( const std::string & str)

◆ SetBlobReturn()

void Model::SetBlobReturn ( bool val)

◆ SetBoundary()

void Model::SetBoundary ( bool val)

◆ SetColor()

void Model::SetColor ( Color col)

◆ SetFiducialKey()

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.

◆ SetFiducialReturn()

void Model::SetFiducialReturn ( int fid)

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

◆ SetFriction()

void Model::SetFriction ( double friction)

◆ SetGeom()

void Model::SetGeom ( const Geom & src)

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

◆ SetGlobalPose()

void Model::SetGlobalPose ( const Pose & gpose)

set the pose of model in global coordinates

◆ SetGravityReturn()

void Stg::Model::SetGravityReturn ( bool val)

◆ SetGripperReturn()

void Model::SetGripperReturn ( bool val)

◆ SetGuiGrid()

void Model::SetGuiGrid ( bool val)

◆ SetGuiMove()

void Model::SetGuiMove ( bool val)

◆ SetGuiNose()

void Model::SetGuiNose ( bool val)

◆ SetGuiOutline()

void Model::SetGuiOutline ( bool val)

◆ SetMapResolution()

void Model::SetMapResolution ( meters_t res)

◆ SetMass()

void Model::SetMass ( kg_t mass)

◆ SetObstacleReturn()

void Model::SetObstacleReturn ( bool val)

◆ SetParent()

int Model::SetParent ( Model * newparent)

Change a model's parent - experimental

◆ SetPose()

void Model::SetPose ( const Pose & pose)

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

◆ SetRangerReturn() [1/2]

void Stg::Model::SetRangerReturn ( bool val)

◆ SetRangerReturn() [2/2]

void Model::SetRangerReturn ( double val)

◆ SetStall()

void Model::SetStall ( bool stall)

◆ SetStickyReturn()

void Stg::Model::SetStickyReturn ( bool val)

◆ SetToken()

virtual void Stg::Model::SetToken ( const std::string & str)
inlinevirtual

Reimplemented from Stg::Ancestor.

◆ SetWatts()

void Model::SetWatts ( watts_t watts)

◆ SetWorldfile()

void Stg::Model::SetWorldfile ( Worldfile * wf,
int wf_entity )
inline

Set the worldfile and worldfile entity ID

◆ Shutdown()

void Model::Shutdown ( void )
protectedvirtual

◆ Stalled()

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

◆ Startup()

void Model::Startup ( void )
protectedvirtual

◆ Subscribe()

void Model::Subscribe ( void )

subscribe to a model's data

◆ TestCollision()

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. Recursively calls TestCollision() on all descendents.

◆ UnMap() [1/2]

void Stg::Model::UnMap ( )
inlineprotected

Call UnMap on all layers

◆ UnMap() [2/2]

void Model::UnMap ( unsigned int layer)
protected

◆ UnMapFromRoot()

void Model::UnMapFromRoot ( unsigned int layer)
protected

◆ UnMapWithChildren()

void Model::UnMapWithChildren ( unsigned int layer)
protected

◆ Unsubscribe()

void Model::Unsubscribe ( void )

unsubscribe from a model's data

◆ Update()

◆ UpdateCharge()

void Model::UpdateCharge ( )
protectedvirtual

◆ UpdateTrail()

void Model::UpdateTrail ( )
protected

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

◆ UpdateWrapper()

static int Stg::Model::UpdateWrapper ( Model * mod,
void *  )
inlinestaticprotected

Member Data Documentation

◆ alwayson

bool Stg::Model::alwayson
protected

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

◆ blockgroup

BlockGroup Stg::Model::blockgroup
protected

◆ boundary

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.

◆ callbacks

std::vector<std::set<cb_t> > Stg::Model::callbacks
protected

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

◆ color

Color Stg::Model::color
protected

Default color of the model's blocks.

◆ cv_list

std::list<Visualizer *> Stg::Model::cv_list
protected

Container for Visualizers attached to this model.

◆ data_fresh

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.

◆ disabled

bool Stg::Model::disabled
protected

If set true, Update() is not called on this model. Useful e.g. for temporarily disabling updates when dragging models with the mouse.

◆ event_queue_num

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.

◆ flag_list

std::list<Flag *> Stg::Model::flag_list
protected

Container for flags attached to this model.

◆ friction

double Stg::Model::friction
protected

Model the interaction between the model's blocks and the surface they touch.

Todo
primitive at the moment

◆ geom

Geom Stg::Model::geom
protected

Specifies the the size of this model's bounding box, and the offset of its local coordinate system wrt that its parent.

◆ gui

class Stg::Model::GuiState Stg::Model::gui
protected

◆ has_default_block

bool Stg::Model::has_default_block
protected

◆ id

uint32_t Stg::Model::id
protected

unique process-wide identifier for this model

◆ interval

usec_t Stg::Model::interval
protected

time between updates in usec

◆ interval_energy

usec_t Stg::Model::interval_energy
protected

time between updates of powerpack in usec

◆ last_update

usec_t Stg::Model::last_update
protected

time of last update in us

◆ log_state

bool Stg::Model::log_state
protected

iff true, model state is logged

◆ map_resolution

meters_t Stg::Model::map_resolution
protected

◆ mass

kg_t Stg::Model::mass
protected

◆ name_map

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

◆ parent

Model* Stg::Model::parent
protected

Pointer to the parent of this model, possibly NULL.

◆ pose

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.

◆ power_pack

PowerPack* Stg::Model::power_pack
protected

Optional attached PowerPack, defaults to NULL

◆ pps_charging

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

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

◆ rastervis

Stg::Model::RasterVis Stg::Model::rastervis
protected

◆ rebuild_displaylist

bool Stg::Model::rebuild_displaylist
protected

iff true, regenerate block display list before redraw

◆ say_string

std::string Stg::Model::say_string
protected

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

◆ stack_children

bool Stg::Model::stack_children
protected

whether child models should be stacked on top of this model or not

◆ stall

bool Stg::Model::stall
protected

Set to true iff the model collided with something else.

◆ subs

int Stg::Model::subs
protected

the number of subscriptions to this model

◆ thread_safe

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. Derived classes can set it true in their constructor to allow parallel Updates().

◆ trail

std::vector<TrailItem> Stg::Model::trail
protected

a ring buffer for storing recent poses

◆ trail_index

unsigned int Stg::Model::trail_index
protected

current position in the ring buffer

◆ trail_interval

uint64_t Stg::Model::trail_interval
protected

Number of world updates between trail records.

◆ type

const std::string Stg::Model::type
protected

◆ used

bool Stg::Model::used
protected

TRUE iff this model has been returned by GetUnusedModelOfType()

◆ vis

class Stg::Model::Visibility Stg::Model::vis

◆ watts

watts_t Stg::Model::watts
protected

power consumed by this model

◆ watts_give

watts_t Stg::Model::watts_give
protected

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

◆ watts_take

watts_t Stg::Model::watts_take
protected

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

◆ wf

Worldfile* Stg::Model::wf
protected

◆ wf_entity

int Stg::Model::wf_entity
protected

◆ world

World* Stg::Model::world
protected

Pointer to the world in which this model exists.

◆ world_gui

WorldGui* Stg::Model::world_gui
protected

Pointer to the GUI world - NULL if running in non-gui mode.


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