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::ModelLoadCell, Stg::ModelPosition, and Stg::ModelRanger.
Classes | |
class | RasterVis |
class | stg_cb_t |
Public Member Functions | |
Block * | AddBlockRect (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 () |
PowerPack * | FindPowerPack () const |
Color | GetColor () const |
int | GetFiducialReturn () const |
int | GetFlagCount () const |
Geom | GetGeom () const |
Pose | GetGlobalPose () const |
Velocity | GetGlobalVelocity () const |
uint32_t | GetId () const |
Model * | GetModel (const char *name) const |
stg_model_type_t | GetModelType () |
Pose | GetPose () const |
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 () |
stg_usec_t | GetSimInterval () |
stg_kg_t | GetTotalMass () |
Model * | GetUnsubscribedModelOfType (const stg_model_type_t type) const |
Model * | GetUnusedModelOfType (const stg_model_type_t type) |
Velocity | GetVelocity () const |
World * | GetWorld () const |
Pose | GlobalToLocal (const Pose &pose) const |
void | Init () |
void | InitRecursive () |
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 (char *lib) |
stg_point_t | LocalToGlobal (const stg_point_t &pt) const |
Pose | LocalToGlobal (const Pose &pose) const |
Model (World *world, Model *parent, stg_model_type_t type=MODEL_TYPE_PLAIN) | |
void | NeedRedraw () |
Model * | Parent () const |
void | PlaceInFreeSpace (stg_meters_t xmin, stg_meters_t xmax, stg_meters_t ymin, stg_meters_t ymax) |
virtual void | PopColor () |
Flag * | PopFlag () |
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) |
Model * | Root () |
virtual void | Save () |
void | Say (const char *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 | SetGuiMask (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 () |
virtual | ~Model () |
Static Public Member Functions | |
static Model * | Create (World *world, Model *parent) |
static Model * | LookupId (uint32_t id) |
Public Attributes | |
Visibility | vis |
Static Public Attributes | |
static std::map< std::string, stg_creator_t > | name_map |
static std::map < stg_model_type_t, std::string > | type_map |
Protected Member Functions | |
void | AppendTouchingModels (ModelPtrSet &touchers) |
void | CallUpdateCallbacks (void) |
void | CommitTestedPose () |
Model * | ConditionalMove (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) |
Register an Option for pickup by the GUI. | |
virtual void | Shutdown () |
virtual void | Startup () |
void | StartUpdating () |
void | StopUpdating () |
Model * | TestCollision () |
Model * | TestCollisionTree () |
void | UnMap () |
void | UnMapFromRoot () |
void | UnMapWithChildren () |
virtual void | Update () |
virtual void | UpdateCharge () |
bool | UpdateDue (void) |
void | UpdateIfDue () |
virtual void | UpdatePose () |
Protected Attributes | |
pthread_mutex_t | access_mutex |
Used by Lock() and Unlock() to prevent parallel access to this model. | |
BlockGroup | blockgroup |
int | blocks_dl |
int | boundary |
std::map< void *, std::set < stg_cb_t > > | callbacks |
Color | color |
std::list< Visualizer * > | cv_list |
bool | data_fresh |
stg_bool_t | disabled |
if non-zero, the model is disabled | |
std::list< Flag * > | flag_list |
double | friction |
Geom | geom |
Pose | global_pose |
bool | gpose_dirty |
set this to indicate that global pose may have changed | |
GuiState | gui |
bool | has_default_block |
CallbackHooks | hooks |
uint32_t | id |
ctrlinit_t * | initfunc |
stg_usec_t | interval |
time between updates in us | |
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 |
bool | on_velocity_list |
Model * | parent |
Pose | pose |
PowerPack * | power_pack |
std::list< PowerPack * > | pps_charging |
std::map< const char *, const void * > | props |
Stg::Model::RasterVis | rastervis |
bool | rebuild_displaylist |
iff true, regenerate block display list before redraw | |
char * | 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< TrailItem > | trail |
long unsigned int | trail_interval |
unsigned int | trail_length |
stg_model_type_t | type |
int | update_list_num |
bool | used |
TRUE iff this model has been returned by GetUnusedModelOfType(). | |
Velocity | velocity |
stg_watts_t | watts |
power consumed by this model | |
stg_watts_t | watts_give |
stg_watts_t | watts_take |
Worldfile * | wf |
int | wf_entity |
World * | world |
WorldGui * | world_gui |
Detailed Description
Model classConstructor & Destructor Documentation
Model::Model | ( | World * | world, | |
Model * | parent, | |||
stg_model_type_t | type = MODEL_TYPE_PLAIN | |||
) |
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::CallUpdateCallbacks | ( | void | ) | [protected] |
void Model::ClearBlocks | ( | void | ) |
remove all blocks from this model, freeing their memory
void Model::CommitTestedPose | ( | ) | [protected] |
Every class derived from Stg::Model must provide a "named constructor" for its class, like this.
Reimplemented in Stg::ModelBlobfinder, Stg::ModelLaser, Stg::ModelLoadCell, Stg::ModelLightIndicator, Stg::ModelGripper, Stg::ModelFiducial, Stg::ModelRanger, Stg::ModelBlinkenlight, Stg::ModelCamera, Stg::ModelPosition, and Stg::ModelActuator.
bool Stg::Model::DataIsFresh | ( | ) | const [inline] |
void Model::DataVisualize | ( | Camera * | cam | ) | [protected, virtual] |
Reimplemented in Stg::ModelRanger, Stg::ModelBlinkenlight, and Stg::ModelCamera.
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 |
Color Stg::Model::GetColor | ( | ) | const [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
Model * Model::GetModel | ( | const char * | name | ) | const |
stg_model_type_t Stg::Model::GetModelType | ( | ) | [inline] |
Pose Stg::Model::GetPose | ( | ) | const [inline] |
Get (a copy of) the pose of a model in its parent's coordinate system.
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] |
stg_usec_t Stg::Model::GetSimInterval | ( | ) | [inline] |
stg_kg_t Model::GetTotalMass | ( | ) |
Get the total mass of a model and it's children recursively
Model * Model::GetUnsubscribedModelOfType | ( | const stg_model_type_t | type | ) | const |
returns the first descendent of this model that is unsubscribed and has the type indicated by the string
Model * Model::GetUnusedModelOfType | ( | const stg_model_type_t | 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.
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
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()..
void Model::Init | ( | ) |
Should be called after all models are loaded, to do any last-minute setup
void Model::InitRecursive | ( | ) |
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] |
configure a model by reading from the current world file
Reimplemented in Stg::ModelBlobfinder, Stg::ModelLaser, Stg::ModelGripper, Stg::ModelFiducial, Stg::ModelRanger, Stg::ModelBlinkenlight, Stg::ModelCamera, Stg::ModelPosition, and Stg::ModelActuator.
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 | ( | 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 3d point in world coordinates of a 3d point specified in the model's local coordinate system Return the 2d point in world coordinates of a 2d point specified in the model's local coordinate system
Return the global pose (i.e. pose in world coordinates) of a pose specified in the model's local coordinate system
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] |
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
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 char * | 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::SetGuiMask | ( | 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] |
Reimplemented in Stg::ModelBlobfinder, Stg::ModelLaser, Stg::ModelFiducial, Stg::ModelRanger, Stg::ModelPosition, and Stg::ModelActuator.
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] |
Reimplemented in Stg::ModelBlobfinder, Stg::ModelLaser, Stg::ModelRanger, Stg::ModelPosition, and Stg::ModelActuator.
void Model::StartUpdating | ( | ) | [protected] |
void Model::StopUpdating | ( | ) | [protected] |
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] |
Reimplemented in Stg::ModelBlobfinder, Stg::ModelLaser, Stg::ModelRanger, Stg::ModelBlinkenlight, Stg::ModelCamera, Stg::ModelPosition, and Stg::ModelActuator.
void Model::UpdateCharge | ( | ) | [protected, virtual] |
bool Model::UpdateDue | ( | void | ) | [protected] |
void Model::UpdateIfDue | ( | void | ) | [protected] |
void Model::UpdatePose | ( | void | ) | [protected, virtual] |
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.
BlockGroup Stg::Model::blockgroup [protected] |
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<stg_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 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.
stg_bool_t Stg::Model::disabled [protected] |
if non-zero, the model is disabled
std::list<Flag*> Stg::Model::flag_list [protected] |
double Stg::Model::friction [protected] |
Geom Stg::Model::geom [protected] |
Pose Stg::Model::global_pose [protected] |
bool Stg::Model::gpose_dirty [protected] |
set this to indicate that global pose may have changed
GuiState Stg::Model::gui [protected] |
Controls our appearance and functionality in the GUI, if used
bool Stg::Model::has_default_block [protected] |
CallbackHooks Stg::Model::hooks [protected] |
uint32_t Stg::Model::id [protected] |
unique process-wide identifier for this model
ctrlinit_t* Stg::Model::initfunc [protected] |
stg_usec_t Stg::Model::interval [protected] |
time between updates in us
stg_usec_t Stg::Model::last_update [protected] |
time of last update in us
bool Stg::Model::log_state [protected] |
iff true, model state is logged
stg_meters_t Stg::Model::map_resolution [protected] |
stg_kg_t Stg::Model::mass [protected] |
std::map< std::string, stg_creator_t > Model::name_map [static] |
bool Stg::Model::on_velocity_list [protected] |
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.
PowerPack* Stg::Model::power_pack [protected] |
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<const char*,const void*> Stg::Model::props [protected] |
GData datalist 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.
Stg::Model::RasterVis Stg::Model::rastervis [protected] |
Visualize the most recent rasterization operation performed by this model
bool Stg::Model::rebuild_displaylist [protected] |
iff true, regenerate block display list before redraw
char* Stg::Model::say_string [protected] |
if non-null, this string is displayed in the GUI
stg_bool_t Stg::Model::stall [protected] |
int Stg::Model::subs [protected] |
the number of subscriptions to this model
Thread safety flag. Iff true, Update() may be called in parallel with other models. Defaults to false for safety
bool Stg::Model::thread_safe [protected] |
std::list<TrailItem> Stg::Model::trail [protected] |
Cache of recent poses, used to draw the trail.
long unsigned int Stg::Model::trail_interval [protected] |
Number of world updates between trail records.
unsigned int Stg::Model::trail_length [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.
stg_model_type_t Stg::Model::type [protected] |
std::map< stg_model_type_t, std::string > Model::type_map [static] |
int Stg::Model::update_list_num [protected] |
The index into the world's vector of update lists. Initially -1, to indicate that it is not on a list yet.
bool Stg::Model::used [protected] |
TRUE iff this model has been returned by GetUnusedModelOfType().
Velocity Stg::Model::velocity [protected] |
Reimplemented in Stg::ModelBlobfinder.
stg_watts_t Stg::Model::watts [protected] |
power consumed by this model
stg_watts_t Stg::Model::watts_give [protected] |
If >0, this model can transfer energy to models that have watts_take >0
stg_watts_t Stg::Model::watts_take [protected] |
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] |
WorldGui* Stg::Model::world_gui [protected] |
The documentation for this class was generated from the following files:
Generated on Wed Jul 22 11:51:05 2009 for Stage by
