amino
1.0-beta2
Lightweight Robot Utility Library
|
The scenegraph data structure. More...
Go to the source code of this file.
Macros | |
#define | AA_RX_FRAME_ROOT ((aa_rx_frame_id)-1) |
Magic frame_id for the root/global/absolute frame. | |
#define | AA_RX_FRAME_NONE ((aa_rx_frame_id)-2) |
Magic frame_id for no frame. | |
#define | AA_RX_CONFIG_NONE ((aa_rx_config_id)-1) |
Magic config_id for no configuration variable. | |
#define | AA_RX_CONFIG_MULTI ((aa_rx_config_id)-2) |
Magic config_id for multiple configuration variables. | |
Typedefs | |
typedef signed long | aa_rx_frame_id |
Type for frame indices. | |
typedef signed long | aa_rx_config_id |
Type for configuration indices. | |
Enumerations | |
enum | aa_rx_frame_type { AA_RX_FRAME_FIXED , AA_RX_FRAME_REVOLUTE , AA_RX_FRAME_PRISMATIC } |
Enum of frame types. More... | |
Functions | |
AA_API struct aa_rx_sg * | aa_rx_sg_create () |
Construct a new, empty scene graph. | |
AA_API void | aa_rx_sg_destroy (struct aa_rx_sg *scene_graph) |
Destroy a scene graph. | |
AA_API int | aa_rx_sg_init (struct aa_rx_sg *scene_graph) |
Setup the scenegraph internal indices. More... | |
AA_API enum aa_rx_frame_type | aa_rx_sg_frame_type (const struct aa_rx_sg *scene_graph, aa_rx_frame_id frame_id) |
Return the type of the given frame. More... | |
AA_API const char * | aa_rx_sg_frame_name (const struct aa_rx_sg *scene_graph, aa_rx_frame_id frame_id) |
Return the name of the given frame. More... | |
AA_API const char * | aa_rx_sg_config_name (const struct aa_rx_sg *scene_graph, aa_rx_config_id config_id) |
Return the config of the given frame. More... | |
AA_API aa_rx_frame_id | aa_rx_sg_frame_parent (const struct aa_rx_sg *scene_graph, aa_rx_frame_id frame_id) |
Return the parent id of the frame. More... | |
AA_API size_t | aa_rx_sg_frame_count (const struct aa_rx_sg *scene_graph) |
Return the number of frames in scene_graph. | |
AA_API size_t | aa_rx_sg_config_count (const struct aa_rx_sg *scene_graph) |
Return the number of configuration variables in scene_graph. | |
AA_API aa_rx_config_id | aa_rx_sg_frame_config (const struct aa_rx_sg *scene_graph, aa_rx_frame_id frame) |
Return the config id of frame. More... | |
AA_API size_t | aa_rx_sg_config_names (const struct aa_rx_sg *scene_graph, size_t n_names, const char **names) |
Fill names with pointers to config names. | |
AA_API aa_rx_config_id | aa_rx_sg_config_id (const struct aa_rx_sg *scene_graph, const char *config_name) |
Return the index of a configuration variable in the scene graph. More... | |
AA_API void | aa_rx_sg_config_indices (const struct aa_rx_sg *scene_graph, size_t n, const char **config_name, aa_rx_config_id *ids) |
Return the indices of a configuration variable in the scene graph. More... | |
AA_API void | aa_rx_sg_config_get (const struct aa_rx_sg *scene_graph, size_t n_all, size_t n_subset, const aa_rx_config_id *ids, const double *config_all, double *config_subset) |
Retrieve a subset of the configuration vector. | |
AA_API void | aa_rx_sg_config_set (const struct aa_rx_sg *scene_graph, size_t n_all, size_t n_subset, const aa_rx_config_id *ids, const double *config_subset, double *config_all) |
Fill a subset of the configuration vector. | |
AA_API aa_rx_frame_id | aa_rx_sg_frame_id (const struct aa_rx_sg *scene_graph, const char *frame_name) |
Return the index of a frame in the scene graph. More... | |
AA_API void | aa_rx_sg_add_frame_fixed (struct aa_rx_sg *scene_graph, const char *parent, const char *name, const double q[4], const double v[3]) |
Add a fixed-transform frame to the scene graph. More... | |
AA_API void | aa_rx_sg_add_frame_prismatic (struct aa_rx_sg *scene_graph, const char *parent, const char *name, const double q[4], const double v[3], const char *config_name, const double axis[3], double offset) |
Add a prismatic-joint frame to the scene graph. More... | |
AA_API void | aa_rx_sg_add_frame_revolute (struct aa_rx_sg *scene_graph, const char *parent, const char *name, const double q[4], const double v[3], const char *config_name, const double axis[3], double offset) |
Add a revolute-joint frame to the scene graph. More... | |
AA_API void | aa_rx_sg_rm_frame (struct aa_rx_sg *scene_graph, const char *name) |
Remove a frame. | |
AA_API void | aa_rx_sg_set_limit_pos (struct aa_rx_sg *scenegraph, const char *config_name, double min, double max) |
Set position limit values. | |
AA_API void | aa_rx_sg_set_limit_vel (struct aa_rx_sg *scenegraph, const char *config_name, double min, double max) |
Set velocity limit values. | |
AA_API void | aa_rx_sg_set_limit_acc (struct aa_rx_sg *scenegraph, const char *config_name, double min, double max) |
Set acceleration limit values. | |
AA_API void | aa_rx_sg_set_limit_eff (struct aa_rx_sg *scenegraph, const char *config_name, double min, double max) |
Set effort limit values. | |
AA_API int | aa_rx_sg_get_limit_pos (const struct aa_rx_sg *scenegraph, aa_rx_config_id config_id, double *min, double *max) |
Get position limit values. More... | |
AA_API int | aa_rx_sg_get_limit_vel (const struct aa_rx_sg *scenegraph, aa_rx_config_id config_id, double *min, double *max) |
Get velocity limit values. More... | |
AA_API int | aa_rx_sg_get_limit_acc (const struct aa_rx_sg *scenegraph, aa_rx_config_id config_id, double *min, double *max) |
Get acceleration limit values. More... | |
AA_API int | aa_rx_sg_get_limit_eff (const struct aa_rx_sg *scenegraph, aa_rx_config_id config_id, double *min, double *max) |
Get effort limit values. More... | |
AA_API double | aa_rx_sg_config_center (const struct aa_rx_sg *sg, aa_rx_config_id config_id) |
Get the centered position of a configuration variable. | |
AA_API void | aa_rx_sg_center_configs (const struct aa_rx_sg *sg, size_t n, double *q) |
Fill q with the centered positions of each configuration. | |
AA_API const double * | aa_rx_sg_frame_axis (const struct aa_rx_sg *scene_graph, aa_rx_frame_id frame) |
Return pointer to frame axis. More... | |
AA_API void | aa_rx_sg_tf (const struct aa_rx_sg *scene_graph, size_t n_q, const double *q, size_t n_tf, double *TF_rel, size_t ld_rel, double *TF_abs, size_t ld_abs) |
Compute transforms for the scene graph as quaternion-translations. More... | |
AA_API struct aa_dmat * | aa_rx_sg_get_tf_abs (const struct aa_rx_sg *scene_graph, struct aa_mem_region *reg, const struct aa_dvec *q) |
Allocate and compute absolute transforms for the scene graph. More... | |
AA_API void | aa_rx_sg_fill_tf_abs (const struct aa_rx_sg *scene_graph, const struct aa_dvec *q, struct aa_dmat *tf_abs) |
AA_API void | aa_rx_sg_tfmat (const struct aa_rx_sg *scene_graph, size_t n_q, const double *q, size_t n_tf, double *TF_rel, size_t ld_rel, double *TF_abs, size_t ld_abs) |
Compute transforms for the scene graph as matrices. More... | |
AA_API void | aa_rx_sg_duqu (const struct aa_rx_sg *scene_graph, size_t n_q, const double *q, size_t n_tf, double *TF_rel, size_t ld_rel, double *TF_abs, size_t ld_abs) |
Compute transforms for the scene graph as dual quaternions. More... | |
AA_API void | aa_rx_sg_tf_update (const struct aa_rx_sg *scene_graph, size_t n_q, const double *q0, const double *q, size_t n_tf, const double *TF_rel0, size_t ld_rel0, const double *TF_abs0, size_t ld_abs0, double *TF_rel, size_t ld_rel, double *TF_abs, size_t ld_abs) |
Updated transforms efficiently when only some configurations change. More... | |
AA_API void | aa_rx_sg_map_geom (const struct aa_rx_sg *scene_graph, void(*function)(void *context, aa_rx_frame_id frame_id, struct aa_rx_geom *geom), void *context) |
Call function for every geometry object in the scene graph. More... | |
AA_API void | aa_rx_sg_rel_tf (const struct aa_rx_sg *scene_graph, const aa_rx_frame_id frame_from, const aa_rx_frame_id frame_to, const double *tf_abs, size_t ld_abs, double *from_tf_to) |
Get transform between two given frames. More... | |
AA_API void | aa_rx_sg_reparent_id (const struct aa_rx_sg *scene_graph, aa_rx_frame_id new_parent, aa_rx_frame_id frame, const double *E1) |
Change the parent of frame in the scenegraph. | |
AA_API void | aa_rx_sg_reparent_name (const struct aa_rx_sg *scene_graph, const char *new_parent, const char *frame, const double *E1) |
Change the parent of frame in the scenegraph. | |
AA_API struct aa_rx_sg * | aa_rx_sg_copy (const struct aa_rx_sg *orig) |
Deeply copy a scenegraph. More... | |
AA_API void | aa_rx_sg_allow_collision (struct aa_rx_sg *scene_graph, aa_rx_frame_id id0, aa_rx_frame_id id1, int allowed) |
Set allowed collisions between frames id0 and id1. | |
AA_API void | aa_rx_sg_allow_collision_name (struct aa_rx_sg *scene_graph, const char *frame0, const char *frame1, int allowed) |
Set allowed collisions between frame0 and frame1. | |
AA_API void | aa_rx_sg_copy_frame_geom (struct aa_rx_sg *scene_graph, const char *src_frame, const char *dst_frame) |
AA_API double * | aa_rx_sg_alloc_tf (const struct aa_rx_sg *sg, struct aa_mem_region *region) |
Allocate storage for TF array from region. | |
AA_API double * | aa_rx_sg_alloc_config (const struct aa_rx_sg *sg, struct aa_mem_region *region) |
Allocate storage for config array from region. | |
AA_API void | aa_rx_sg_add_octree (struct aa_rx_sg *scene_graph, const char *parent, const char *name, struct aa_rx_octree *ocTree, struct aa_rx_geom_opt *opt) |
Variables | |
AA_EXTERN const aa_rx_frame_id | aa_rx_frame_root |
AA_EXTERN const aa_rx_frame_id | aa_rx_frame_none |
AA_EXTERN const aa_rx_config_id | aa_rx_config_none |
AA_EXTERN const aa_rx_config_id | aa_rx_config_multi |
The scenegraph data structure.
Definition in file scenegraph.h.
enum aa_rx_frame_type |
Enum of frame types.
Enumerator | |
---|---|
AA_RX_FRAME_FIXED | A fixed transform. |
AA_RX_FRAME_REVOLUTE | A rotating transform. |
AA_RX_FRAME_PRISMATIC | A prismatic (sliding) transform. |
Definition at line 88 of file scenegraph.h.
AA_API void aa_rx_sg_add_frame_fixed | ( | struct aa_rx_sg * | scene_graph, |
const char * | parent, | ||
const char * | name, | ||
const double | q[4], | ||
const double | v[3] | ||
) |
Add a fixed-transform frame to the scene graph.
Note that adding a new frame may changes the frame_ids of all previously added frames.
scene_graph | The scene graph container |
parent | The name of the parent frame |
name | The name of the frame to be added |
q | The unit quaternion frame rotation (xyzw) |
v | The frame translation vector |
AA_API void aa_rx_sg_add_frame_prismatic | ( | struct aa_rx_sg * | scene_graph, |
const char * | parent, | ||
const char * | name, | ||
const double | q[4], | ||
const double | v[3], | ||
const char * | config_name, | ||
const double | axis[3], | ||
double | offset | ||
) |
Add a prismatic-joint frame to the scene graph.
Note that adding a new frame may changes the frame_ids and config_ids of all previously added frames.
scene_graph | The scene graph container |
parent | The name of the parent frame |
name | The name of the frame to be added |
q | The unit quaternion frame initial rotation (xyzw) |
v | The frame initial translation vector |
config_name | The name of the configuration variable. |
axis | The axis of rotation. A non-unit axis will scale the translation accordingly. |
offset | An offset to be added to the configuration value |
AA_API void aa_rx_sg_add_frame_revolute | ( | struct aa_rx_sg * | scene_graph, |
const char * | parent, | ||
const char * | name, | ||
const double | q[4], | ||
const double | v[3], | ||
const char * | config_name, | ||
const double | axis[3], | ||
double | offset | ||
) |
Add a revolute-joint frame to the scene graph.
Note that adding a new frame may changes the frame_ids and config_ids of all previously added frames.
scene_graph | The scene graph container |
parent | The name of the parent frame |
name | The name of the frame to be added |
q | The unit quaternion frame initial rotation (xyzw) |
v | The frame initial translation vector |
config_name | The name of the configuration variable. |
axis | The axis of rotation. A non-unit axis will scale the rotation accordingly. |
offset | An offset to be added to the configuration value |
AA_API aa_rx_config_id aa_rx_sg_config_id | ( | const struct aa_rx_sg * | scene_graph, |
const char * | config_name | ||
) |
Return the index of a configuration variable in the scene graph.
AA_API void aa_rx_sg_config_indices | ( | const struct aa_rx_sg * | scene_graph, |
size_t | n, | ||
const char ** | config_name, | ||
aa_rx_config_id * | ids | ||
) |
Return the indices of a configuration variable in the scene graph.
AA_API const char* aa_rx_sg_config_name | ( | const struct aa_rx_sg * | scene_graph, |
aa_rx_config_id | config_id | ||
) |
Return the config of the given frame.
Deeply copy a scenegraph.
Note that geometry objects and meshes will be shared via reference-counting.
AA_API void aa_rx_sg_duqu | ( | const struct aa_rx_sg * | scene_graph, |
size_t | n_q, | ||
const double * | q, | ||
size_t | n_tf, | ||
double * | TF_rel, | ||
size_t | ld_rel, | ||
double * | TF_abs, | ||
size_t | ld_abs | ||
) |
Compute transforms for the scene graph as dual quaternions.
Transform entries are in {real, dual} format.
scene_graph | The scene graph container |
n_q | Size of configuration vector q |
q | Configuraiton vector |
n_tf | Number of entries in the TF array |
TF_rel | Relative transform in dual quaternion format |
ld_rel | Leading dimensional of TF_rel, i.e., space between each entry |
TF_abs | Absolute transform dual quaternion format |
ld_abs | Leading dimensional of TF_abs, i.e., space between each entry |
AA_API const double* aa_rx_sg_frame_axis | ( | const struct aa_rx_sg * | scene_graph, |
aa_rx_frame_id | frame | ||
) |
Return pointer to frame axis.
Only valid for univariate joint frames.
AA_API aa_rx_config_id aa_rx_sg_frame_config | ( | const struct aa_rx_sg * | scene_graph, |
aa_rx_frame_id | frame | ||
) |
Return the config id of frame.
AA_API aa_rx_frame_id aa_rx_sg_frame_id | ( | const struct aa_rx_sg * | scene_graph, |
const char * | frame_name | ||
) |
Return the index of a frame in the scene graph.
AA_API const char* aa_rx_sg_frame_name | ( | const struct aa_rx_sg * | scene_graph, |
aa_rx_frame_id | frame_id | ||
) |
Return the name of the given frame.
AA_API aa_rx_frame_id aa_rx_sg_frame_parent | ( | const struct aa_rx_sg * | scene_graph, |
aa_rx_frame_id | frame_id | ||
) |
Return the parent id of the frame.
AA_API enum aa_rx_frame_type aa_rx_sg_frame_type | ( | const struct aa_rx_sg * | scene_graph, |
aa_rx_frame_id | frame_id | ||
) |
Return the type of the given frame.
AA_API int aa_rx_sg_get_limit_acc | ( | const struct aa_rx_sg * | scenegraph, |
aa_rx_config_id | config_id, | ||
double * | min, | ||
double * | max | ||
) |
Get acceleration limit values.
AA_API int aa_rx_sg_get_limit_eff | ( | const struct aa_rx_sg * | scenegraph, |
aa_rx_config_id | config_id, | ||
double * | min, | ||
double * | max | ||
) |
Get effort limit values.
AA_API int aa_rx_sg_get_limit_pos | ( | const struct aa_rx_sg * | scenegraph, |
aa_rx_config_id | config_id, | ||
double * | min, | ||
double * | max | ||
) |
Get position limit values.
AA_API int aa_rx_sg_get_limit_vel | ( | const struct aa_rx_sg * | scenegraph, |
aa_rx_config_id | config_id, | ||
double * | min, | ||
double * | max | ||
) |
Get velocity limit values.
AA_API struct aa_dmat* aa_rx_sg_get_tf_abs | ( | const struct aa_rx_sg * | scene_graph, |
struct aa_mem_region * | reg, | ||
const struct aa_dvec * | q | ||
) |
Allocate and compute absolute transforms for the scene graph.
Transform entries are in {q_x, q_y, q_z, q_w, v_x, v_y, v_z} format.
scene_graph | The scene graph container |
q | Configuraiton vector |
Setup the scenegraph internal indices.
This function must be called before any frame_ids or config_ids can be used with the scenegraph.
AA_API void aa_rx_sg_map_geom | ( | const struct aa_rx_sg * | scene_graph, |
void(*)(void *context, aa_rx_frame_id frame_id, struct aa_rx_geom *geom) | function, | ||
void * | context | ||
) |
Call function for every geometry object in the scene graph.
scene_graph | The scene graph container |
function | A function to call on every geometry object |
context | The context argument to function |
AA_API void aa_rx_sg_rel_tf | ( | const struct aa_rx_sg * | scene_graph, |
const aa_rx_frame_id | frame_from, | ||
const aa_rx_frame_id | frame_to, | ||
const double * | tf_abs, | ||
size_t | ld_abs, | ||
double * | from_tf_to | ||
) |
Get transform between two given frames.
scene_graph | The scene graph container |
frame_from | The parent frame id |
frame_to | The child frame id |
tf_abs | Array of absolute transforms |
ld_abs | Leading dimension of tf_abs |
from_tf_to | The relative transform |
AA_API void aa_rx_sg_tf | ( | const struct aa_rx_sg * | scene_graph, |
size_t | n_q, | ||
const double * | q, | ||
size_t | n_tf, | ||
double * | TF_rel, | ||
size_t | ld_rel, | ||
double * | TF_abs, | ||
size_t | ld_abs | ||
) |
Compute transforms for the scene graph as quaternion-translations.
Transform entries are in {q_x, q_y, q_z, q_w, v_x, v_y, v_z} format.
scene_graph | The scene graph container |
n_q | Size of configuration vector q |
q | Configuraiton vector |
n_tf | Number of entries in the TF array |
TF_rel | Relative transform matrix in quaternion-vector format |
ld_rel | Leading dimensional of TF_rel, i.e., space between each entry |
TF_abs | Absolute transform matrix in quaternion-vector format |
ld_abs | Leading dimensional of TF_abs, i.e., space between each entry |
AA_API void aa_rx_sg_tf_update | ( | const struct aa_rx_sg * | scene_graph, |
size_t | n_q, | ||
const double * | q0, | ||
const double * | q, | ||
size_t | n_tf, | ||
const double * | TF_rel0, | ||
size_t | ld_rel0, | ||
const double * | TF_abs0, | ||
size_t | ld_abs0, | ||
double * | TF_rel, | ||
size_t | ld_rel, | ||
double * | TF_abs, | ||
size_t | ld_abs | ||
) |
Updated transforms efficiently when only some configurations change.
scene_graph | The scene graph container |
n_q | Size of configuration vector q |
q0 | Initial configuration vector |
q | Current configuraiton vector |
n_tf | Number of entries in the TF array |
TF_rel0 | Initial relative transform matrix in quaternion-vector format |
ld_rel0 | Initial leading dimensional of TF_rel, i.e., space between each entry |
TF_abs0 | Initial absolute transform matrix in quaternion-vector format |
ld_abs0 | Leading dimensional of TF_abs, i.e., space between each entry |
TF_rel | Current relative transform matrix in quaternion-vector format |
ld_rel | Current leading dimensional of TF_rel, i.e., space between each entry |
TF_abs | Current absolute transform matrix in quaternion-vector format |
ld_abs | Current leading dimensional of TF_abs, i.e., space between each entry |
AA_API void aa_rx_sg_tfmat | ( | const struct aa_rx_sg * | scene_graph, |
size_t | n_q, | ||
const double * | q, | ||
size_t | n_tf, | ||
double * | TF_rel, | ||
size_t | ld_rel, | ||
double * | TF_abs, | ||
size_t | ld_abs | ||
) |
Compute transforms for the scene graph as matrices.
Transform entries are in {R, v} format.
scene_graph | The scene graph container |
n_q | Size of configuration vector q |
q | Configuraiton vector |
n_tf | Number of entries in the TF array |
TF_rel | Relative transform matrix |
ld_rel | Leading dimensional of TF_rel, i.e., space between each entry |
TF_abs | Absolute transform matrix |
ld_abs | Leading dimensional of TF_abs, i.e., space between each entry |