amino
Lightweight Robot Utility Library
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
scene_kin.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, 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_KIN_H
39 #define AMINO_RX_SCENE_KIN_H
40 
41 #include "scenegraph.h"
42 
48 struct aa_rx_sg_sub;
49 
50 /*-- Kinematic Solvers --*/
51 
55 typedef int aa_rx_ik_fun( void *context,
56  size_t n_tf, const double *TF, size_t ld_TF,
57  size_t n_q, double *q );
58 
59 
60 struct aa_rx_ksol_opts;
61 
62 AA_API struct aa_rx_ksol_opts*
63 aa_rx_ksol_opts_create();
64 
65 AA_API void
66 aa_rx_ksol_opts_destroy( struct aa_rx_ksol_opts *opts);
67 
68 AA_API void
69 aa_rx_ksol_opts_set_dt( struct aa_rx_ksol_opts *opts, double dt);
70 
71 AA_API void
72 aa_rx_ksol_opts_set_tol_angle( struct aa_rx_ksol_opts *opts, double tol);
73 
74 AA_API void
75 aa_rx_ksol_opts_set_tol_trans( struct aa_rx_ksol_opts *opts, double tol);
76 
77 AA_API void
78 aa_rx_ksol_opts_set_tol_angle_svd( struct aa_rx_ksol_opts *opts, double tol);
79 
80 AA_API void
81 aa_rx_ksol_opts_set_tol_trans_svd( struct aa_rx_ksol_opts *opts, double tol);
82 
83 AA_API void
84 aa_rx_ksol_opts_set_tol_dq( struct aa_rx_ksol_opts *opts, double tol);
85 
86 AA_API void
87 aa_rx_ksol_opts_set_tol_k_dls( struct aa_rx_ksol_opts *opts, double s2min);
88 
89 AA_API void
90 aa_rx_ksol_opts_set_tol_s2min( struct aa_rx_ksol_opts *opts, double s2min);
91 
92 AA_API void
93 aa_rx_ksol_opts_set_gain_angle( struct aa_rx_ksol_opts *opts, double k );
94 
95 AA_API void
96 aa_rx_ksol_opts_set_gain_trans( struct aa_rx_ksol_opts *opts, double k );
97 
98 AA_API void
99 aa_rx_ksol_opts_set_max_iterations( struct aa_rx_ksol_opts *opts, size_t n );
100 
101 AA_API void
102 aa_rx_ksol_opts_set_frame( struct aa_rx_ksol_opts *opts, aa_rx_frame_id frame );
103 
104 AA_API void
105 aa_rx_ksol_opts_take_config( struct aa_rx_ksol_opts *opts, size_t n_q,
106  double *q, enum aa_mem_refop refop );
107 
108 AA_API void
109 aa_rx_ksol_opts_take_gain_config( struct aa_rx_ksol_opts *opts, size_t n_q,
110  double *q, enum aa_mem_refop refop );
111 
112 AA_API void
113 aa_rx_ksol_opts_take_seed( struct aa_rx_ksol_opts *opts, size_t n_q,
114  double *q_all, enum aa_mem_refop refop );
115 
116 
117 AA_API void
118 aa_rx_ksol_opts_center_seed( struct aa_rx_ksol_opts *opts,
119  const struct aa_rx_sg_sub *ssg );
120 
124 AA_API void
125 aa_rx_ksol_opts_center_configs( struct aa_rx_ksol_opts *opts,
126  const struct aa_rx_sg_sub *ssg,
127  double gain );
128 
129 /*-- Jacobian IK Solver --*/
130 
131 struct aa_rx_ik_jac_cx;
132 
133 AA_API struct aa_rx_ik_jac_cx *
134 aa_rx_ik_jac_cx_create(const struct aa_rx_sg_sub *ssg, const struct aa_rx_ksol_opts *opts );
135 
136 AA_API void
137 aa_rx_ik_jac_cx_destroy( struct aa_rx_ik_jac_cx *cx );
138 
139 
140 AA_API int aa_rx_ik_jac_solve( const struct aa_rx_ik_jac_cx *context,
141  size_t n_tf, const double *TF, size_t ld_TF,
142  size_t n_q, double *q );
143 
144 AA_API int aa_rx_ik_jac_fun( void *context,
145  size_t n_tf, const double *TF, size_t ld_TF,
146  size_t n_q, double *q );
147 
148 
149 /* AA_API int */
150 /* aa_rx_sg_sub_ksol_dls( const struct aa_rx_sg_sub *ssg, */
151 /* const struct aa_rx_ksol_opts *opts, */
152 /* size_t n_tf, const double *TF, size_t ld_TF, */
153 /* size_t n_q_all, const double *q_start_all, */
154 /* size_t n_q, double *q_subset ); */
155 
156 /* static inline int */
157 /* aa_rx_sg_chain_ksol_dls( const struct aa_rx_sg_sub *ssg, */
158 /* const struct aa_rx_ksol_opts *opts, */
159 /* const double *TF, */
160 /* size_t n_q_all, const double *q_start_all, */
161 /* size_t n_qs, double *q_subset ) */
162 /* { */
163 /* return aa_rx_sg_sub_ksol_dls( ssg, opts, 1, TF, 7, */
164 /* n_q_all, q_start_all, */
165 /* n_qs, q_subset ); */
166 /* } */
167 
168 
169 #endif /*AMINO_RX_SCENE_KIN_H*/
AA_API void aa_rx_ksol_opts_center_configs(struct aa_rx_ksol_opts *opts, const struct aa_rx_sg_sub *ssg, double gain)
Convenience function to set IK options to center joints.
int aa_rx_ik_fun(void *context, size_t n_tf, const double *TF, size_t ld_TF, size_t n_q, double *q)
General type for an IK solver function.
Definition: scene_kin.h:55
signed long aa_rx_frame_id
Type for frame indices.
Definition: scenegraph.h:49
The scenegraph data structure.
#define AA_API
calling and name mangling convention for functions
Definition: amino.h:95