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  * Copyright (c) 2019, Colorado School of Mines
6  * All rights reserved.
7  *
8  * Author(s): Neil T. Dantam <ndantam@mines.edu>
9  *
10  * Redistribution and use in source and binary forms, with or
11  * without modification, are permitted provided that the following
12  * conditions are met:
13  * * Redistributions of source code must retain the above copyright
14  * notice, this list of conditions and the following disclaimer.
15  * * Redistributions in binary form must reproduce the above
16  * copyright notice, this list of conditions and the following
17  * disclaimer in the documentation and/or other materials provided
18  * with the distribution.
19  * * Neither the name of copyright holder the names of its
20  * contributors may be used to endorse or promote products derived
21  * from this software without specific prior written permission.
22  *
23  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
24  * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
25  * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
26  * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
27  * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
28  * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
29  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
30  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
31  * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
32  * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
33  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
34  * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
35  * POSSIBILITY OF SUCH DAMAGE.
36  *
37  */
38 
39 #ifndef AMINO_RX_SCENE_SUB_H
40 #define AMINO_RX_SCENE_SUB_H
41 
42 #include "rxtype.h"
43 #include "scenegraph.h"
44 
56 struct aa_rx_sg_sub;
57 
63 AA_API void
64 aa_rx_sg_sub_destroy( struct aa_rx_sg_sub *sg );
65 
69 AA_API const struct aa_rx_sg *
70 aa_rx_sg_sub_sg( const struct aa_rx_sg_sub *sg_sub );
71 
75 AA_API size_t
76 aa_rx_sg_sub_config_count( const struct aa_rx_sg_sub *sg_sub );
77 
78 
82 AA_API size_t
83 aa_rx_sg_sub_all_config_count( const struct aa_rx_sg_sub *sg_sub );
84 
88 AA_API size_t
89 aa_rx_sg_sub_frame_count( const struct aa_rx_sg_sub *sg_sub );
90 
94 AA_API size_t
95 aa_rx_sg_sub_all_frame_count( const struct aa_rx_sg_sub *sg_sub );
96 
101 aa_rx_sg_sub_config( const struct aa_rx_sg_sub *sg_sub, size_t i );
102 
107 aa_rx_sg_sub_frame( const struct aa_rx_sg_sub *sg_sub, size_t i );
108 
115 aa_rx_sg_sub_frame_ee( const struct aa_rx_sg_sub *sg_sub );
116 
120 AA_API size_t
121 aa_rx_sg_sub_frame_ee_count( const struct aa_rx_sg_sub *sg_sub);
122 
127 aa_rx_sg_sub_frame_ees( const struct aa_rx_sg_sub *sg_sub );
128 
133 aa_rx_sg_sub_configs( const struct aa_rx_sg_sub *sg_sub );
134 
139 aa_rx_sg_sub_frames( const struct aa_rx_sg_sub *sg_sub );
140 
141 
142 AA_API void
143 aa_rx_sg_sub_config_get(
144  const struct aa_rx_sg_sub *ssg,
145  size_t n_all, const double *config_all,
146  size_t n_subset, double *config_subset );
147 
148 AA_API void
149 aa_rx_sg_sub_config_set(
150  const struct aa_rx_sg_sub *ssg,
151  size_t n_sub, const double *config_subset,
152  size_t n_all, double *config_all
153  );
154 
155 
159 AA_API void
160 aa_rx_sg_sub_config_scatter( const struct aa_rx_sg_sub *ssg,
161  const struct aa_dvec *config_subset,
162  struct aa_dvec *config_all );
163 
167 AA_API void
168 aa_rx_sg_sub_config_gather( const struct aa_rx_sg_sub *ssg,
169  const struct aa_dvec *config_all,
170  struct aa_dvec *config_subset );
171 
175 AA_API struct aa_rx_sg_sub *
176 aa_rx_sg_chain_create( const struct aa_rx_sg *sg,
177  aa_rx_frame_id root, aa_rx_frame_id tip );
178 
179 
183 AA_API void
184 aa_rx_sg_sub_center_configs( const struct aa_rx_sg_sub *ssg,
185  size_t n, double *q );
186 
187 AA_API void
188 aa_rx_sg_sub_center_configv( const struct aa_rx_sg_sub *ssg,
189  struct aa_dvec *q );
190 
191 
192 AA_API void
193 aa_rx_sg_sub_rand_config( const struct aa_rx_sg_sub *ssg,
194  struct aa_dvec *dst );
195 
196 /*-- TF --*/
197 
198 /* AA_API void */
199 /* aa_rx_sg_sub_tf_update( const struct aa_rx_sg_sub *ssg, */
200 /* const struct aa_dvec *q_sub, */
201 /* struct aa_dmat *TF_abs ); */
202 
203 /*-- Jacobians --*/
204 
208 AA_API void
209 aa_rx_sg_sub_jacobian_size( const struct aa_rx_sg_sub *ssg,
210  size_t *rows, size_t *cols );
211 
215 AA_API void
216 aa_rx_sg_sub_jacobian( const struct aa_rx_sg_sub *ssg,
217  size_t n_tf, const double *TF_abs, size_t ld_TF,
218  double *J, size_t ld_J );
219 
223 AA_API struct aa_dmat *
224 aa_rx_sg_sub_get_jacobian( const struct aa_rx_sg_sub *ssg,
225  struct aa_mem_region *reg,
226  const struct aa_dmat *TF_abs );
227 
231 AA_API double *
232 aa_rx_sg_sub_alloc_jacobian( const struct aa_rx_sg_sub *ssg, struct aa_mem_region *region );
233 
234 
235 
247 AA_API struct aa_dmat *
248 aa_rx_sg_sub_jac_twist_get( const struct aa_rx_sg_sub *ssg, struct aa_mem_region *region,
249  const struct aa_rx_fk *fk );
250 
260 AA_API void
261 aa_rx_sg_sub_jac_twist_fill2( const struct aa_rx_sg_sub *ssg,
262  const struct aa_rx_fk *fk,
263  struct aa_dmat *Jp, struct aa_dmat *Jr );
264 
274 AA_API void
275 aa_rx_sg_sub_jac_twist_fill( const struct aa_rx_sg_sub *ssg,
276  const struct aa_rx_fk *fk,
277  struct aa_dmat *J );
278 
290 AA_API struct aa_dmat *
291 aa_rx_sg_sub_jac_vel_get( const struct aa_rx_sg_sub *ssg, struct aa_mem_region *region,
292  const struct aa_rx_fk *fk );
293 
303 AA_API void
304 aa_rx_sg_sub_jac_vel_fill2( const struct aa_rx_sg_sub *ssg,
305  const struct aa_rx_fk *fk,
306  struct aa_dmat *Jp, struct aa_dmat *Jr );
307 
308 AA_API void
309 aa_rx_sg_sub_jac_vel_fill( const struct aa_rx_sg_sub *ssg,
310  const struct aa_rx_fk *fk,
311  struct aa_dmat *J );
312 
313 
314 
315 
319 AA_API double *
320 aa_rx_sg_sub_alloc_config( const struct aa_rx_sg_sub *ssg, struct aa_mem_region *region );
321 
322 
334 AA_API void
335 aa_rx_sg_sub_expand_path( const struct aa_rx_sg_sub *ssg, size_t n_pts,
336  const double *q_start,
337  const double *path_sub,
338  double *path_all );
339 
343 AA_API void
344 aa_rx_fk_sub( struct aa_rx_fk *fk,
345  const struct aa_rx_sg_sub *ssg,
346  const struct aa_dvec *q_sub );
347 
348 #endif /*AMINO_RX_SCENE_SUB_H*/
#define AA_API
calling and name mangling convention for functions
Definition: amino.h:95
Scenegraph-related type declarations.
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.
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 void aa_rx_sg_sub_config_gather(const struct aa_rx_sg_sub *ssg, const struct aa_dvec *config_all, struct aa_dvec *config_subset)
Fill a subset configuration vector with values from the full vector.
AA_API aa_rx_frame_id * aa_rx_sg_sub_frame_ees(const struct aa_rx_sg_sub *sg_sub)
Return an array of end effector frames, if any.
AA_API void aa_rx_sg_sub_jac_twist_fill2(const struct aa_rx_sg_sub *ssg, const struct aa_rx_fk *fk, struct aa_dmat *Jp, struct aa_dmat *Jr)
Fill in the blocks of the twist jacobian.
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 void aa_rx_fk_sub(struct aa_rx_fk *fk, const struct aa_rx_sg_sub *ssg, const struct aa_dvec *q_sub)
Compute the forward kinematics for the sub-scenegraph.
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 void aa_rx_sg_sub_jac_vel_fill2(const struct aa_rx_sg_sub *ssg, const struct aa_rx_fk *fk, struct aa_dmat *Jp, struct aa_dmat *Jr)
Fill in the blocks of the velocity jacobian.
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_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 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.
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 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.
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.
AA_API void aa_rx_sg_sub_destroy(struct aa_rx_sg_sub *sg)
Destroy the scengraph subset.
AA_API size_t aa_rx_sg_sub_frame_ee_count(const struct aa_rx_sg_sub *sg_sub)
Return the number of end effector frames, if any.
AA_API struct aa_dmat * aa_rx_sg_sub_get_jacobian(const struct aa_rx_sg_sub *ssg, struct aa_mem_region *reg, const struct aa_dmat *TF_abs)
Allocate and compute the Jacobian matrix for the sub-scenegraph.
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 struct aa_dmat * aa_rx_sg_sub_jac_vel_get(const struct aa_rx_sg_sub *ssg, struct aa_mem_region *region, const struct aa_rx_fk *fk)
Allocate and fill the velocity Jacobian.
AA_API void aa_rx_sg_sub_jac_twist_fill(const struct aa_rx_sg_sub *ssg, const struct aa_rx_fk *fk, struct aa_dmat *J)
Fill in the blocks of the twist jacobian.
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 struct aa_dmat * aa_rx_sg_sub_jac_twist_get(const struct aa_rx_sg_sub *ssg, struct aa_mem_region *region, const struct aa_rx_fk *fk)
Allocate and fill the twist Jacobian.
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 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'th frame of the sub-scenegraph.
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 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'th configuration 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 void aa_rx_sg_sub_config_scatter(const struct aa_rx_sg_sub *ssg, const struct aa_dvec *config_subset, struct aa_dvec *config_all)
Fill a full configuration vector with values from the subset vector.
The scenegraph data structure.
signed long aa_rx_config_id
Type for configuration indices.
Definition: scenegraph.h:59
signed long aa_rx_frame_id
Type for frame indices.
Definition: scenegraph.h:54
Descriptor for a block matrix.
Definition: mat.h:72
Descriptor for a vector.
Definition: mat.h:63
Data Structure for Region-Based memory allocation.
Definition: mem.h:199
Opaque type for a scene_graph.