[libstage - Stage library API]

Detailed Description

Implements the basic object


Model Properties

Data Structures

struct  stg_cbarg_t


#define STG_PROPNAME_MAX   128


typedef int(* stg_property_callback_t )(stg_model_t *mod, char *propname, void *data, size_t len, void *userdata)
typedef int(* stg_model_initializer_t )(stg_model_t *)


stg_model_tstg_model_create (stg_world_t *world, stg_model_t *parent, stg_id_t id, char *token, stg_model_initializer_t initializer)
void stg_model_destroy (stg_model_t *mod)
void stg_model_get_global_pose (stg_model_t *mod, stg_pose_t *gpose)
void stg_model_subscribe (stg_model_t *mod)
void stg_model_unsubscribe (stg_model_t *mod)
void stg_model_load (stg_model_t *mod)
void stg_model_save (stg_model_t *model)
int stg_model_set_global_pose (stg_model_t *mod, stg_pose_t *gpose)
int stg_model_set_velocity (stg_model_t *mod, stg_velocity_t *vel)
int stg_model_set_parent (stg_model_t *mod, stg_model_t *newparent)
void stg_model_get_geom (stg_model_t *mod, stg_geom_t *dest)
void stg_model_get_velocity (stg_model_t *mod, stg_velocity_t *dest)
void stg_model_set_property (stg_model_t *mod, const char *propname, void *data, size_t len)
void * stg_model_get_property (stg_model_t *mod, const char *name, size_t *size)
void * stg_model_get_property_fixed (stg_model_t *mod, const char *name, size_t size)
void stg_model_property_refresh (stg_model_t *mod, const char *propname)
stg_polygon_tstg_model_get_polygons (stg_model_t *mod, size_t *poly_count)
void stg_model_set_polygons (stg_model_t *mod, stg_polygon_t *polys, size_t poly_count)
int stg_model_add_property_callback (stg_model_t *mod, const char *propname, stg_property_callback_t callback, void *user)
int stg_model_remove_property_callback (stg_model_t *mod, const char *propname, stg_property_callback_t callback)
int stg_model_remove_property_callbacks (stg_model_t *mod, const char *propname)
void stg_model_print (stg_model_t *mod)
int stg_model_is_antecedent (stg_model_t *mod, stg_model_t *testmod)
int stg_model_is_descendent (stg_model_t *mod, stg_model_t *testmod)
int stg_model_is_related (stg_model_t *mod1, stg_model_t *mod2)
stg_model_tstg_model_root (stg_model_t *mod)
GPtrArray * stg_model_array_from_tree (stg_model_t *root)
int stg_model_startup (stg_model_t *mod)
int stg_model_shutdown (stg_model_t *mod)
int stg_model_update (stg_model_t *mod)
void stg_model_global_to_local (stg_model_t *mod, stg_pose_t *pose)
void stg_model_local_to_global (stg_model_t *mod, stg_pose_t *pose)
void stg_model_add_property_toggles (stg_model_t *mod, const char *propname, stg_property_callback_t callback_on, void *arg_on, stg_property_callback_t callback_off, void *arg_off, const char *label, int enabled)
int stg_model_fig_clear_cb (stg_model_t *mod, void *data, size_t len, void *userp)

Define Documentation

#define STG_PROPNAME_MAX   128

the maximum length of a model's name, in characters (bytes).

Typedef Documentation

typedef int(* stg_property_callback_t)(stg_model_t* mod, char* propname, void* data, size_t len, void* userdata )

Define a callback function type that can be attached to a model's property and called whenever the property is set with stg_model_set_property() or stg_model_property_refresh().

typedef int(* stg_model_initializer_t)(stg_model_t*)

function type for an initialization function that configures a specialized model. Each special model type (laser, position, etc) has a single initializer function that is called when the model type is specified in the worldfile. The mapping is done in a table in

Function Documentation

stg_model_t* stg_model_create stg_world_t world,
stg_model_t parent,
stg_id_t  id,
char *  token,
stg_model_initializer_t  initializer

create a new model

void stg_model_destroy stg_model_t mod  ) 

destroy a model, freeing its memory

void stg_model_get_global_pose stg_model_t mod,
stg_pose_t pose

get the pose of a model in the global CS

void stg_model_subscribe stg_model_t mod  ) 

subscribe to a model's data

void stg_model_unsubscribe stg_model_t mod  ) 

unsubscribe from a model's data

void stg_model_load stg_model_t mod  ) 

configure a model by reading from the current world file

void stg_model_save stg_model_t mod  ) 

save the state of the model to the current world file

int stg_model_set_global_pose stg_model_t mod,
stg_pose_t gpose

set the pose of model in global coordinates

int stg_model_set_velocity stg_model_t mod,
stg_velocity_t vel

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

int stg_model_set_parent stg_model_t mod,
stg_model_t newparent

Change a model's parent - experimental

void stg_model_get_geom stg_model_t mod,
stg_geom_t dest

void stg_model_get_velocity stg_model_t mod,
stg_velocity_t dest

void stg_model_set_property stg_model_t mod,
const char *  propname,
void *  data,
size_t  len

void* stg_model_get_property stg_model_t mod,
const char *  prop,
size_t *  len

gets the named property data. if len is non-NULL, it is set with the size of the data in bytes

void* stg_model_get_property_fixed stg_model_t mod,
const char *  name,
size_t  size

gets a property of a known size. Fail assertion if the size isn't right.

void stg_model_property_refresh stg_model_t mod,
const char *  propname

stg_polygon_t* stg_model_get_polygons stg_model_t mod,
size_t *  poly_count

gets a model's "polygons" property and fills poly_count with the number of polygons to be found

void stg_model_set_polygons stg_model_t mod,
stg_polygon_t polys,
size_t  poly_count

int stg_model_add_property_callback stg_model_t mod,
const char *  propname,
stg_property_callback_t  callback,
void *  user

int stg_model_remove_property_callback stg_model_t mod,
const char *  propname,
stg_property_callback_t  callback

int stg_model_remove_property_callbacks stg_model_t mod,
const char *  propname

void stg_model_print stg_model_t mod  ) 

print human-readable information about the model on stdout

int stg_model_is_antecedent stg_model_t mod,
stg_model_t testmod

returns TRUE iff [testmod] exists above [mod] in a model tree

int stg_model_is_descendent stg_model_t mod,
stg_model_t testmod

returns TRUE iff [testmod] exists below [mod] in a model tree

int stg_model_is_related stg_model_t mod1,
stg_model_t mod2

returns TRUE iff [mod1] and [mod2] both exist in the same model tree

stg_model_t* stg_model_root stg_model_t mod  ) 

return the top-level model above mod

GPtrArray* stg_model_array_from_tree stg_model_t root  ) 

Convert a tree of models into a GPtrArray containing the same models.

int stg_model_startup stg_model_t mod  ) 

initialize a model - called when a model goes from zero to one subscriptions

int stg_model_shutdown stg_model_t mod  ) 

finalize a model - called when a model goes from one to zero subscriptions

int stg_model_update stg_model_t model  ) 

Update a model by one simulation timestep. This is called by stg_world_update(), so users don't usually need to call this.

void stg_model_global_to_local stg_model_t mod,
stg_pose_t pose

Convert a pose in the world coordinate system into a model's local coordinate system. Overwrites [pose] with the new coordinate.

void stg_model_local_to_global stg_model_t mod,
stg_pose_t pose

Convert a pose in the model's local coordinate system into the world coordinate system. Overwrites [pose] with the new coordinate.

void stg_model_add_property_toggles stg_model_t mod,
const char *  propname,
stg_property_callback_t  callback_on,
void *  arg_on,
stg_property_callback_t  callback_off,
void *  arg_off,
const char *  label,
int  enabled

add an item to the View menu that will automatically install and remove a callback when the item is toggled. The specialized model types use this call to set up their data visualization.

int stg_model_fig_clear_cb stg_model_t mod,
void *  data,
size_t  len,
void *  userp

Generated on Thu Aug 11 13:08:10 2005 for Stage by  doxygen 1.4.0