amino  1.0-beta2
Lightweight Robot Utility Library
scene_sub.h
Go to the documentation of this file.
1 /* -*- mode: C; c-basic-offset: 4; -*- */
2 /* ex: set shiftwidth=4 tabstop=4 expandtab: */
3 /*
4  * Copyright (c) 2015-2016, Rice University
5  * All rights reserved.
6  *
7  * Author(s): Neil T. Dantam <ntd@rice.edu>
8  *
9  * Redistribution and use in source and binary forms, with or
10  * without modification, are permitted provided that the following
11  * conditions are met:
12  * * Redistributions of source code must retain the above copyright
13  * notice, this list of conditions and the following disclaimer.
14  * * Redistributions in binary form must reproduce the above
15  * copyright notice, this list of conditions and the following
16  * disclaimer in the documentation and/or other materials provided
17  * with the distribution.
18  * * Neither the name of copyright holder the names of its
19  * contributors may be used to endorse or promote products derived
20  * from this software without specific prior written permission.
21  *
22  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
23  * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
24  * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
25  * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
26  * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
27  * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
28  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
29  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
30  * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
31  * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
32  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
33  * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
34  * POSSIBILITY OF SUCH DAMAGE.
35  *
36  */
37 
38 #ifndef AMINO_RX_SCENE_SUB_H
39 #define AMINO_RX_SCENE_SUB_H
40 
41 #include "scenegraph.h"
42 
54 struct aa_rx_sg_sub;
55 
61 AA_API void
62 aa_rx_sg_sub_destroy( struct aa_rx_sg_sub *sg );
63 
67 AA_API const struct aa_rx_sg *
68 aa_rx_sg_sub_sg( const struct aa_rx_sg_sub *sg_sub );
69 
73 AA_API size_t
74 aa_rx_sg_sub_config_count( const struct aa_rx_sg_sub *sg_sub );
75 
76 
80 AA_API size_t
81 aa_rx_sg_sub_all_config_count( const struct aa_rx_sg_sub *sg_sub );
82 
86 AA_API size_t
87 aa_rx_sg_sub_frame_count( const struct aa_rx_sg_sub *sg_sub );
88 
92 AA_API size_t
93 aa_rx_sg_sub_all_frame_count( const struct aa_rx_sg_sub *sg_sub );
94 
99 aa_rx_sg_sub_config( const struct aa_rx_sg_sub *sg_sub, size_t i );
100 
105 aa_rx_sg_sub_frame( const struct aa_rx_sg_sub *sg_sub, size_t i );
106 
107 
112 aa_rx_sg_sub_frame_ee( const struct aa_rx_sg_sub *sg_sub );
113 
114 
119 aa_rx_sg_sub_configs( const struct aa_rx_sg_sub *sg_sub );
120 
125 aa_rx_sg_sub_frames( const struct aa_rx_sg_sub *sg_sub );
126 
127 
128 AA_API void
129 aa_rx_sg_sub_config_get(
130  const struct aa_rx_sg_sub *ssg,
131  size_t n_all, const double *config_all,
132  size_t n_subset, double *config_subset );
133 
134 AA_API void
135 aa_rx_sg_sub_config_set(
136  const struct aa_rx_sg_sub *ssg,
137  size_t n_sub, const double *config_subset,
138  size_t n_all, double *config_all
139  );
140 
141 
145 AA_API struct aa_rx_sg_sub *
146 aa_rx_sg_chain_create( const struct aa_rx_sg *sg,
147  aa_rx_frame_id root, aa_rx_frame_id tip );
148 
149 
153 AA_API void
154 aa_rx_sg_sub_center_configs( const struct aa_rx_sg_sub *ssg,
155  size_t n, double *q );
156 
157 /*-- Jacobians --*/
158 
162 AA_API void
163 aa_rx_sg_sub_jacobian_size( const struct aa_rx_sg_sub *ssg,
164  size_t *rows, size_t *cols );
165 
169 AA_API void
170 aa_rx_sg_sub_jacobian( const struct aa_rx_sg_sub *ssg,
171  size_t n_tf, const double *TF_abs, size_t ld_TF,
172  double *J, size_t ld_J );
173 
177 AA_API double *
178 aa_rx_sg_sub_alloc_jacobian( const struct aa_rx_sg_sub *ssg, struct aa_mem_region *region );
179 
183 AA_API double *
184 aa_rx_sg_sub_alloc_config( const struct aa_rx_sg_sub *ssg, struct aa_mem_region *region );
185 
186 
198 AA_API void
199 aa_rx_sg_sub_expand_path( const struct aa_rx_sg_sub *ssg, size_t n_pts,
200  const double *q_start,
201  const double *path_sub,
202  double *path_all );
203 
204 #endif /*AMINO_RX_SCENE_SUB_H*/
AA_API aa_rx_frame_id aa_rx_sg_sub_frame(const struct aa_rx_sg_sub *sg_sub, size_t i)
Return the full scenegraph frame id for the i&#39;th frame of the sub-scenegraph.
AA_API aa_rx_config_id * aa_rx_sg_sub_configs(const struct aa_rx_sg_sub *sg_sub)
Return the array of full scenegraph config ids contained in the sub-scenegraph.
AA_API const struct aa_rx_sg * aa_rx_sg_sub_sg(const struct aa_rx_sg_sub *sg_sub)
Return the original scene graph for the sub-scenegraph.
signed long aa_rx_frame_id
Type for frame indices.
Definition: scenegraph.h:49
AA_API size_t aa_rx_sg_sub_frame_count(const struct aa_rx_sg_sub *sg_sub)
Return the number of frames in the scenegraph subset.
AA_API void aa_rx_sg_sub_jacobian(const struct aa_rx_sg_sub *ssg, size_t n_tf, const double *TF_abs, size_t ld_TF, double *J, size_t ld_J)
Compute the Jacobian matrix for the sub-scenegraph.
The scenegraph data structure.
Data Structure for Region-Based memory allocation.
Definition: mem.h:198
AA_API aa_rx_frame_id * aa_rx_sg_sub_frames(const struct aa_rx_sg_sub *sg_sub)
Return the array of full scenegraph frame ids contained in the sub-scenegraph.
AA_API void aa_rx_sg_sub_expand_path(const struct aa_rx_sg_sub *ssg, size_t n_pts, const double *q_start, const double *path_sub, double *path_all)
Expand sub path to full config path.
AA_API void aa_rx_sg_sub_jacobian_size(const struct aa_rx_sg_sub *ssg, size_t *rows, size_t *cols)
Determine the size of the Jacobian matrix for the sub-scenegraph.
AA_API aa_rx_config_id aa_rx_sg_sub_config(const struct aa_rx_sg_sub *sg_sub, size_t i)
Return the full scenegraph config id for the i&#39;th configuration of the sub-scenegraph.
Opaque type for a scene_graph.
AA_API void aa_rx_sg_sub_center_configs(const struct aa_rx_sg_sub *ssg, size_t n, double *q)
Fill q with the centered positions of each configuration.
AA_API size_t aa_rx_sg_sub_config_count(const struct aa_rx_sg_sub *sg_sub)
Return the number of configuration variables in the scenegraph subset.
AA_API size_t aa_rx_sg_sub_all_config_count(const struct aa_rx_sg_sub *sg_sub)
Return the number of configuration variables in the full scenegraph.
AA_API size_t aa_rx_sg_sub_all_frame_count(const struct aa_rx_sg_sub *sg_sub)
Return the number of frames in the full scenegraph.
AA_API double * aa_rx_sg_sub_alloc_config(const struct aa_rx_sg_sub *ssg, struct aa_mem_region *region)
Allocate sub scene graph config array.
#define AA_API
calling and name mangling convention for functions
Definition: amino.h:95
AA_API double * aa_rx_sg_sub_alloc_jacobian(const struct aa_rx_sg_sub *ssg, struct aa_mem_region *region)
Allocate jacobian matrix for sub scene graph.
AA_API aa_rx_frame_id aa_rx_sg_sub_frame_ee(const struct aa_rx_sg_sub *sg_sub)
Return the end-effector frame id, if any.
AA_API void aa_rx_sg_sub_destroy(struct aa_rx_sg_sub *sg)
Destroy the scengraph subset.
AA_API struct aa_rx_sg_sub * aa_rx_sg_chain_create(const struct aa_rx_sg *sg, aa_rx_frame_id root, aa_rx_frame_id tip)
Create a sub-scenegraph for the kinematic chain starting at root and ending a tip.
signed long aa_rx_config_id
Type for configuration indices.
Definition: scenegraph.h:54