Models
[libstage API reference]


Detailed Description

Implements the basic object


Data Structures

struct  stg_audio_cmd_t
struct  stg_audio_config_t
struct  stg_audio_data_t
struct  stg_blobfinder_blob_t
struct  stg_blobfinder_config_t
struct  stg_bumper_config_t
struct  stg_bumper_sample_t
struct  stg_energy_config_t
struct  stg_energy_data_t
struct  stg_fiducial_config_t
struct  stg_fiducial_t
struct  stg_gripper_cmd_t
struct  stg_gripper_config_t
struct  stg_gripper_data_t
struct  stg_laser_config_t
struct  stg_laser_sample_t
struct  stg_model_t
struct  stg_position_cfg_t
struct  stg_position_cmd_t
struct  stg_position_data_t
struct  stg_ptz_config_t
struct  stg_ranger_config_t
struct  stg_ranger_sample_t
struct  stg_speech_cmd_t
struct  stg_speech_config_t
struct  stg_speech_data_t
struct  stg_wifi_config_t
struct  stg_wifi_data_t
struct  stg_wifi_sample_t

Defines

#define STG_AUDIO_MAX_STRING_LEN   256
#define STG_BLOB_CHANNELS_MAX   16
#define STG_MOVE_ROT   (1 << 1)
#define STG_MOVE_SCALE   (1 << 2)
#define STG_MOVE_TRANS   (1 << 0)
#define STG_MP_AUDIO_RETURN   "_mp_audio_return"
#define STG_MP_COLOR   "_mp_color"
#define STG_MP_FIDUCIAL_RETURN   "_mp_fiducial_return"
#define STG_MP_GEOM   "_mp_geom"
#define STG_MP_GRIPPER_RETURN   "_mp_gripper_return"
#define STG_MP_LASER_RETURN   "_mp_laser_return"
#define STG_MP_MASS   "_mp_mass"
#define STG_MP_OBSTACLE_RETURN   "_mp_obstacle_return"
#define STG_MP_POSE   "_mp_pose"
#define STG_MP_PREFIX   "_mp_"
#define STG_MP_RANGER_RETURN   "_mp_ranger_return"
#define STG_MP_VELOCITY   "_mp_velocity"
#define STG_MP_WATTS   "_mp_watts"
#define STG_POSITION_CONTROL_DEFAULT   STG_POSITION_CONTROL_VELOCITY
#define STG_POSITION_DRIVE_DEFAULT   STG_POSITION_DRIVE_DIFFERENTIAL
#define STG_POSITION_LOCALIZATION_DEFAULT   STG_POSITION_LOCALIZATION_GPS
#define STG_SPEECH_MAX_STRING_LEN   256

Typedefs

typedef int(* stg_model_callback_t )(stg_model_t *mod, void *user)
typedef int(* stg_model_initializer_t )(stg_model_t *)
typedef int stg_movemask_t
typedef stg_ptz_t stg_ptz_cmd_t
typedef stg_ptz_t stg_ptz_data_t

Enumerations

enum  stg_audio_cmd_type_t { STG_AUDIO_CMD_NOP = 0, STG_AUDIO_CMD_SAY }
enum  stg_gripper_cmd_type_t {
  STG_GRIPPER_CMD_NOP = 0, STG_GRIPPER_CMD_OPEN, STG_GRIPPER_CMD_CLOSE, STG_GRIPPER_CMD_UP,
  STG_GRIPPER_CMD_DOWN
}
enum  stg_gripper_lift_state_t { STG_GRIPPER_LIFT_DOWN = 0, STG_GRIPPER_LIFT_UP, STG_GRIPPER_LIFT_UPPING, STG_GRIPPER_LIFT_DOWNING }
enum  stg_gripper_paddle_state_t { STG_GRIPPER_PADDLE_OPEN = 0, STG_GRIPPER_PADDLE_CLOSED, STG_GRIPPER_PADDLE_OPENING, STG_GRIPPER_PADDLE_CLOSING }
enum  stg_laser_return_t { LaserTransparent, LaserVisible, LaserBright }
enum  stg_position_control_mode_t { STG_POSITION_CONTROL_VELOCITY, STG_POSITION_CONTROL_POSITION }
enum  stg_position_drive_mode_t { STG_POSITION_DRIVE_DIFFERENTIAL, STG_POSITION_DRIVE_OMNI, STG_POSITION_DRIVE_CAR }
enum  stg_position_localization_mode_t { STG_POSITION_LOCALIZATION_GPS, STG_POSITION_LOCALIZATION_ODOM }
enum  stg_speech_cmd_type_t { STG_SPEECH_CMD_NOP = 0, STG_SPEECH_CMD_SAY }

Functions

void stg_model_add_callback (stg_model_t *mod, void *member, stg_model_callback_t cb, void *user)
void stg_model_add_property_toggles (stg_model_t *mod, void *member, stg_model_callback_t callback_on, void *arg_on, stg_model_callback_t callback_off, void *arg_off, const char *name, const char *label, gboolean enabled)
GPtrArray * stg_model_array_from_tree (stg_model_t *root)
stg_model_tstg_model_create (stg_world_t *world, stg_model_t *parent, stg_id_t id, char *typestr)
void stg_model_destroy (stg_model_t *mod)
void stg_model_draw_points (stg_model_t *mod, const char *group, double x, double y, double a, stg_point_t *points, size_t point, double size, stg_color_t color)
void stg_model_draw_polygons (stg_model_t *mod, const char *group, double x, double y, double a, stg_polygon_t *polys, size_t polycount)
void stg_model_draw_polylines (stg_model_t *mod, const char *group, double x, double y, double a, stg_polyline_t *lines, size_t linecount, double thickness, stg_color_t colot)
int stg_model_fig_clear_cb (stg_model_t *mod, void *data, size_t len, void *userp)
void * stg_model_get_cfg (stg_model_t *mod, size_t *lenp)
void * stg_model_get_cmd (stg_model_t *mod, size_t *lenp)
void * stg_model_get_data (stg_model_t *mod, size_t *lenp)
void stg_model_get_geom (stg_model_t *mod, stg_geom_t *dest)
void stg_model_get_global_pose (stg_model_t *mod, stg_pose_t *pose)
void stg_model_get_global_velocity (stg_model_t *mod, stg_velocity_t *gvel)
stg_polygon_tstg_model_get_polygons (stg_model_t *mod, size_t *poly_count)
void stg_model_get_pose (stg_model_t *mod, stg_pose_t *dest)
void * stg_model_get_property (stg_model_t *mod, char *key)
void stg_model_get_velocity (stg_model_t *mod, stg_velocity_t *dest)
void stg_model_global_to_local (stg_model_t *mod, stg_pose_t *pose)
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)
void stg_model_load (stg_model_t *mod)
void stg_model_local_to_global (stg_model_t *mod, stg_pose_t *pose)
void stg_model_position_set_odom (stg_model_t *mod, stg_pose_t *odom)
void stg_model_print (stg_model_t *mod, char *prefix)
int stg_model_remove_callback (stg_model_t *mod, void *member, stg_model_callback_t callback)
stg_model_tstg_model_root (stg_model_t *mod)
void stg_model_save (stg_model_t *mod)
void stg_model_set_audio_return (stg_model_t *mod, int val)
void stg_model_set_blob_return (stg_model_t *mod, int val)
void stg_model_set_boundary (stg_model_t *mod, int val)
void stg_model_set_cfg (stg_model_t *mod, void *cfg, size_t len)
void stg_model_set_cmd (stg_model_t *mod, void *cmd, size_t len)
void stg_model_set_color (stg_model_t *mod, stg_color_t col)
void stg_model_set_data (stg_model_t *mod, void *data, size_t len)
void stg_model_set_fiducial_key (stg_model_t *mod, int key)
void stg_model_set_fiducial_return (stg_model_t *mod, int fid)
void stg_model_set_geom (stg_model_t *mod, stg_geom_t *src)
void stg_model_set_global_pose (stg_model_t *mod, stg_pose_t *gpose)
void stg_model_set_global_velocity (stg_model_t *mod, stg_velocity_t *gvel)
void stg_model_set_gripper_return (stg_model_t *mod, int val)
void stg_model_set_gui_grid (stg_model_t *mod, int val)
void stg_model_set_gui_mask (stg_model_t *mod, int val)
void stg_model_set_gui_nose (stg_model_t *mod, int val)
void stg_model_set_gui_outline (stg_model_t *mod, int val)
void stg_model_set_laser_return (stg_model_t *mod, int val)
void stg_model_set_lines (stg_model_t *mod, stg_polyline_t *lines, size_t lines_count)
void stg_model_set_map_resolution (stg_model_t *mod, stg_meters_t res)
void stg_model_set_mass (stg_model_t *mod, stg_kg_t mass)
void stg_model_set_obstacle_return (stg_model_t *mod, int val)
int stg_model_set_parent (stg_model_t *mod, stg_model_t *newparent)
void stg_model_set_polygons (stg_model_t *mod, stg_polygon_t *polys, size_t poly_count)
void stg_model_set_pose (stg_model_t *mod, stg_pose_t *pose)
int stg_model_set_property (stg_model_t *mod, char *propname, void *data)
void stg_model_set_ranger_return (stg_model_t *mod, int val)
void stg_model_set_stall (stg_model_t *mod, stg_bool_t stall)
void stg_model_set_velocity (stg_model_t *mod, stg_velocity_t *vel)
void stg_model_set_watts (stg_model_t *mod, stg_watts_t watts)
int stg_model_shutdown (stg_model_t *mod)
int stg_model_startup (stg_model_t *mod)
void stg_model_subscribe (stg_model_t *mod)
void stg_model_unset_property (stg_model_t *mod, char *propname)
void stg_model_unsubscribe (stg_model_t *mod)
int stg_model_update (stg_model_t *model)

Define Documentation

#define STG_AUDIO_MAX_STRING_LEN   256
 

#define STG_BLOB_CHANNELS_MAX   16
 

#define STG_MOVE_ROT   (1 << 1)
 

#define STG_MOVE_SCALE   (1 << 2)
 

#define STG_MOVE_TRANS   (1 << 0)
 

#define STG_MP_AUDIO_RETURN   "_mp_audio_return"
 

#define STG_MP_COLOR   "_mp_color"
 

#define STG_MP_FIDUCIAL_RETURN   "_mp_fiducial_return"
 

#define STG_MP_GEOM   "_mp_geom"
 

#define STG_MP_GRIPPER_RETURN   "_mp_gripper_return"
 

#define STG_MP_LASER_RETURN   "_mp_laser_return"
 

#define STG_MP_MASS   "_mp_mass"
 

#define STG_MP_OBSTACLE_RETURN   "_mp_obstacle_return"
 

#define STG_MP_POSE   "_mp_pose"
 

#define STG_MP_PREFIX   "_mp_"
 

#define STG_MP_RANGER_RETURN   "_mp_ranger_return"
 

#define STG_MP_VELOCITY   "_mp_velocity"
 

#define STG_MP_WATTS   "_mp_watts"
 

#define STG_POSITION_CONTROL_DEFAULT   STG_POSITION_CONTROL_VELOCITY
 

#define STG_POSITION_DRIVE_DEFAULT   STG_POSITION_DRIVE_DIFFERENTIAL
 

#define STG_POSITION_LOCALIZATION_DEFAULT   STG_POSITION_LOCALIZATION_GPS
 

#define STG_SPEECH_MAX_STRING_LEN   256
 


Typedef Documentation

typedef int(* stg_model_callback_t)(stg_model_t *mod, void *user)
 

Define a callback function type that can be attached to a record within a model and called whenever the record is set.

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 typetable.cc.

typedef int stg_movemask_t
 

typedef stg_ptz_t stg_ptz_cmd_t
 

ptz command: specify desired PTZ angles. Tilt has no effect.

typedef stg_ptz_t stg_ptz_data_t
 

ptz data: specifies actual PTZ angles.


Enumeration Type Documentation

enum stg_audio_cmd_type_t
 

Enumerator:
STG_AUDIO_CMD_NOP 
STG_AUDIO_CMD_SAY 

enum stg_gripper_cmd_type_t
 

Enumerator:
STG_GRIPPER_CMD_NOP 
STG_GRIPPER_CMD_OPEN 
STG_GRIPPER_CMD_CLOSE 
STG_GRIPPER_CMD_UP 
STG_GRIPPER_CMD_DOWN 

enum stg_gripper_lift_state_t
 

Enumerator:
STG_GRIPPER_LIFT_DOWN 
STG_GRIPPER_LIFT_UP 
STG_GRIPPER_LIFT_UPPING 
STG_GRIPPER_LIFT_DOWNING 

enum stg_gripper_paddle_state_t
 

Enumerator:
STG_GRIPPER_PADDLE_OPEN 
STG_GRIPPER_PADDLE_CLOSED 
STG_GRIPPER_PADDLE_OPENING 
STG_GRIPPER_PADDLE_CLOSING 

enum stg_laser_return_t
 

laser return value

Enumerator:
LaserTransparent  not detected by laser model
LaserVisible  detected by laser with a reflected intensity of 0
LaserBright 

enum stg_position_control_mode_t
 

Enumerator:
STG_POSITION_CONTROL_VELOCITY 
STG_POSITION_CONTROL_POSITION 

enum stg_position_drive_mode_t
 

"position_drive" property

Enumerator:
STG_POSITION_DRIVE_DIFFERENTIAL 
STG_POSITION_DRIVE_OMNI 
STG_POSITION_DRIVE_CAR 

enum stg_position_localization_mode_t
 

Enumerator:
STG_POSITION_LOCALIZATION_GPS 
STG_POSITION_LOCALIZATION_ODOM 

enum stg_speech_cmd_type_t
 

Enumerator:
STG_SPEECH_CMD_NOP 
STG_SPEECH_CMD_SAY 

Function Documentation

void stg_model_add_callback stg_model_t mod,
void *  member,
stg_model_callback_t  cb,
void *  user
 

void stg_model_add_property_toggles stg_model_t mod,
void *  member,
stg_model_callback_t  callback_on,
void *  arg_on,
stg_model_callback_t  callback_off,
void *  arg_off,
const char *  name,
const char *  label,
gboolean  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.

GPtrArray* stg_model_array_from_tree stg_model_t root  ) 
 

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

stg_model_t* stg_model_create stg_world_t world,
stg_model_t parent,
stg_id_t  id,
char *  typestr
 

create a new model

void stg_model_destroy stg_model_t mod  ) 
 

destroy a model, freeing its memory

void stg_model_draw_points stg_model_t mod,
const char *  group,
double  x,
double  y,
double  a,
stg_point_t points,
size_t  point,
double  size,
stg_color_t  color
 

void stg_model_draw_polygons stg_model_t mod,
const char *  group,
double  x,
double  y,
double  a,
stg_polygon_t polys,
size_t  polycount
 

void stg_model_draw_polylines stg_model_t mod,
const char *  group,
double  x,
double  y,
double  a,
stg_polyline_t lines,
size_t  linecount,
double  thickness,
stg_color_t  colot
 

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

void* stg_model_get_cfg stg_model_t mod,
size_t *  lenp
 

void* stg_model_get_cmd stg_model_t mod,
size_t *  lenp
 

void* stg_model_get_data stg_model_t mod,
size_t *  lenp
 

void stg_model_get_geom stg_model_t mod,
stg_geom_t dest
 

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

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_get_global_velocity stg_model_t mod,
stg_velocity_t gvel
 

get the velocity of a model in the global CS

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_get_pose stg_model_t mod,
stg_pose_t dest
 

Get the pose of a model in its parent's coordinate system

void* stg_model_get_property stg_model_t mod,
char *  key
 

Get a named property associated with a model

void stg_model_get_velocity stg_model_t mod,
stg_velocity_t dest
 

Get a model's velocity (in its local reference frame)

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.

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

void stg_model_load stg_model_t mod  ) 
 

configure a model by reading from the current world file

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_position_set_odom stg_model_t mod,
stg_pose_t odom
 

set the current odometry estimate

void stg_model_print stg_model_t mod,
char *  prefix
 

print human-readable information about the model on stdout. If prefix is non-null, it is printed first.

int stg_model_remove_callback stg_model_t mod,
void *  member,
stg_model_callback_t  callback
 

stg_model_t* stg_model_root stg_model_t mod  ) 
 

return the top-level model above mod

void stg_model_save stg_model_t mod  ) 
 

save the state of the model to the current world file

void stg_model_set_audio_return stg_model_t mod,
int  val
 

void stg_model_set_blob_return stg_model_t mod,
int  val
 

void stg_model_set_boundary stg_model_t mod,
int  val
 

void stg_model_set_cfg stg_model_t mod,
void *  cfg,
size_t  len
 

void stg_model_set_cmd stg_model_t mod,
void *  cmd,
size_t  len
 

void stg_model_set_color stg_model_t mod,
stg_color_t  col
 

void stg_model_set_data stg_model_t mod,
void *  data,
size_t  len
 

void stg_model_set_fiducial_key stg_model_t mod,
int  key
 

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

void stg_model_set_fiducial_return stg_model_t mod,
int  fid
 

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

void stg_model_set_geom stg_model_t mod,
stg_geom_t src
 

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

void stg_model_set_global_pose stg_model_t mod,
stg_pose_t gpose
 

set the pose of model in global coordinates

void stg_model_set_global_velocity stg_model_t mod,
stg_velocity_t gvel
 

void stg_model_set_gripper_return stg_model_t mod,
int  val
 

void stg_model_set_gui_grid stg_model_t mod,
int  val
 

void stg_model_set_gui_mask stg_model_t mod,
int  val
 

void stg_model_set_gui_nose stg_model_t mod,
int  val
 

void stg_model_set_gui_outline stg_model_t mod,
int  val
 

void stg_model_set_laser_return stg_model_t mod,
int  val
 

void stg_model_set_lines stg_model_t mod,
stg_polyline_t lines,
size_t  lines_count
 

set an array oflines to be drawn for the model

void stg_model_set_map_resolution stg_model_t mod,
stg_meters_t  res
 

void stg_model_set_mass stg_model_t mod,
stg_kg_t  mass
 

void stg_model_set_obstacle_return stg_model_t mod,
int  val
 

int stg_model_set_parent stg_model_t mod,
stg_model_t newparent
 

Change a model's parent - experimental

void stg_model_set_polygons stg_model_t mod,
stg_polygon_t polys,
size_t  poly_count
 

void stg_model_set_pose stg_model_t mod,
stg_pose_t pose
 

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

int stg_model_set_property stg_model_t mod,
char *  propname,
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 stg_model_set_ranger_return stg_model_t mod,
int  val
 

void stg_model_set_stall stg_model_t mod,
stg_bool_t  stall
 

void stg_model_set_velocity stg_model_t mod,
stg_velocity_t vel
 

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

void stg_model_set_watts stg_model_t mod,
stg_watts_t  watts
 

int stg_model_shutdown stg_model_t mod  ) 
 

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

int stg_model_startup stg_model_t mod  ) 
 

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

void stg_model_subscribe stg_model_t mod  ) 
 

subscribe to a model's data

void stg_model_unset_property stg_model_t mod,
char *  propname
 

Remove a property from a model.

Removes a data item previously associated with the model using stg_model_set_property(). No memory is freed, so the user should take care to free the memory.

void stg_model_unsubscribe stg_model_t mod  ) 
 

unsubscribe from a model's data

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.


Generated on Thu Dec 13 13:55:22 2007 for Stage by  doxygen 1.4.6