amino  1.0-beta2
Lightweight Robot Utility Library
type.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) 2022, Colorado School of Mines
5  * All rights reserved.
6  *
7  * Redistribution and use in source and binary forms, with or
8  * without modification, are permitted provided that the following
9  * conditions are met:
10  *
11  * * Redistributions of source code must retain the above copyright
12  * notice, this list of conditions and the following disclaimer.
13  *
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  *
19  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
20  * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
21  * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
22  * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
23  * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
24  * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
25  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
26  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
27  * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
28  * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
29  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
30  * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
31  * POSSIBILITY OF SUCH DAMAGE.
32  *
33  */
34 
35 #ifndef AMINO_TF_TYPE_H
36 #define AMINO_TF_TYPE_H
37 
52 /*--------------*/
53 /* Planar Types */
54 /*--------------*/
55 
57 typedef double _Complex aa_tf_cmplx;
58 
61 
62 
68 typedef struct aa_tf_rotmatp {
69  union {
70  struct {
73  };
74  double data[4];
75  };
77 
81 typedef struct aa_tf_cv {
82  union {
83  double data[4];
84  struct {
87  };
88  };
90 
100 typedef struct aa_tf_tfmatp {
101  union {
102  struct {
105  };
106  double data[6];
107  };
109 
110 /*---------------*/
111 /* Spatial Types */
112 /*---------------*/
113 
115 #define AA_TF_X 0
117 #define AA_TF_Y 1
119 #define AA_TF_Z 2
120 
124 typedef struct aa_tf_vec3 {
125  union {
126  struct {
127  double x;
128  double y;
129  double z;
130  };
131  double data[3];
132  };
134 
140 typedef struct aa_tf_rotmat {
141  union {
142  struct {
143  struct aa_tf_vec3 col0;
144  struct aa_tf_vec3 col1;
145  struct aa_tf_vec3 col2;
146  };
147  double data[9];
148  };
150 
157 typedef struct aa_tf_axang {
158  union {
159  struct {
160  union {
161  struct aa_tf_vec3 axis;
162  double v[3];
163  };
164  double angle;
165  };
166  double data[4];
167  };
169 
171 #define AA_TF_QUAT_V 0
173 #define AA_TF_QUAT_XYZ AA_TF_QUAT_V
175 #define AA_TF_QUAT_X (AA_TF_QUAT_V + AA_TF_X)
177 #define AA_TF_QUAT_Y (AA_TF_QUAT_V + AA_TF_Y)
179 #define AA_TF_QUAT_Z (AA_TF_QUAT_V + AA_TF_Z)
181 #define AA_TF_QUAT_W 3
182 
189 typedef struct aa_tf_quat {
190  union {
191  struct {
192  double x;
193  double y;
194  double z;
195  double w;
196  };
197  struct {
198  union {
199  struct aa_tf_vec3 vec;
200  double v[3];
201  };
202  double scalar;
203  };
204  double data[4];
205  };
207 
211 typedef struct aa_tf_eulerzyx {
212  union {
213  struct {
214  double y;
215  double p;
216  double r;
217  };
218  double data[3];
219  };
221 
222 
232 typedef struct aa_tf_tfmat {
233  union {
234  struct {
235  double R[9];
237  };
238  double data[12];
239  };
241 
245 #define AA_TF_TFMAT_R 0
246 
250 #define AA_TF_TFMAT_V 9
251 
255 #define AA_TF_TFMAT_X 9
256 
260 #define AA_TF_TFMAT_Y 10
261 
265 #define AA_TF_TFMAT_Z 11
266 
270 typedef struct aa_tf_qv {
271  union {
272  struct {
275  };
276  double data[7];
277  };
279 
283 typedef struct aa_tf_duqu {
284  union {
285  struct {
288  };
289  double data[8];
290  };
292 
296 struct aa_tf_dx {
297  union {
298  struct {
299  double dv[3];
300  double omega[3];
301  };
302  double data[6];
303  };
304 };
305 
307 #define AA_TF_DX_V 0
309 #define AA_TF_DX_W 3
310 
312 struct aa_tf_qv_dx {
313  union {
314  struct {
315  struct aa_tf_qv tf;
316  struct aa_tf_dx dx;
317  };
318  double data[13];
319  };
320 };
321 
323 #define AA_TF_QUTR_Q 0
325 #define AA_TF_QUTR_QX (AA_TF_QUTR_Q + AA_TF_QUAT_X)
327 #define AA_TF_QUTR_QY (AA_TF_QUTR_Q + AA_TF_QUAT_Y)
329 #define AA_TF_QUTR_QZ (AA_TF_QUTR_Q + AA_TF_QUAT_Z)
331 #define AA_TF_QUTR_QW (AA_TF_QUTR_Q + AA_TF_QUAT_W)
332 
334 #define AA_TF_QUTR_T 4
336 #define AA_TF_QUTR_TX (AA_TF_QUTR_T + AA_TF_X)
338 #define AA_TF_QUTR_TY (AA_TF_QUTR_T + AA_TF_Y)
340 #define AA_TF_QUTR_TZ (AA_TF_QUTR_T + AA_TF_Z)
341 
343 #define AA_TF_DUQU_REAL 0
345 #define AA_TF_DUQU_DUAL 4
346 
348 #define AA_TF_DUQU_REAL_W (AA_TF_DUQU_REAL + AA_TF_QUAT_W)
350 #define AA_TF_DUQU_REAL_XYZ (AA_TF_DUQU_REAL + AA_TF_QUAT_XYZ)
352 #define AA_TF_DUQU_REAL_X (AA_TF_DUQU_REAL + AA_TF_QUAT_X)
354 #define AA_TF_DUQU_REAL_Y (AA_TF_DUQU_REAL + AA_TF_QUAT_Y)
356 #define AA_TF_DUQU_REAL_Z (AA_TF_DUQU_REAL + AA_TF_QUAT_Z)
357 
359 #define AA_TF_DUQU_DUAL_W (AA_TF_DUQU_DUAL + AA_TF_QUAT_W)
361 #define AA_TF_DUQU_DUAL_XYZ (AA_TF_DUQU_DUAL + AA_TF_QUAT_XYZ)
363 #define AA_TF_DUQU_DUAL_X (AA_TF_DUQU_DUAL + AA_TF_QUAT_X)
365 #define AA_TF_DUQU_DUAL_Y (AA_TF_DUQU_DUAL + AA_TF_QUAT_Y)
367 #define AA_TF_DUQU_DUAL_Z (AA_TF_DUQU_DUAL + AA_TF_QUAT_Z)
368 
369 
370 #endif //AMINO_TF_TYPE_H
Memory layout for axis-Angle rotation in x,y,z,angle order.
Definition: type.h:157
Memory layout for planar transform as complex number and translation vector.
Definition: type.h:81
double data[4]
data array
Definition: type.h:83
aa_tf_vec2 v
translation vector
Definition: type.h:86
aa_tf_cmplx c
rotation unit complex
Definition: type.h:85
Memory layout for a dual quaternion.
Definition: type.h:283
aa_tf_quat_t real
real part
Definition: type.h:286
aa_tf_quat_t dual
dual part
Definition: type.h:287
double data[8]
data array
Definition: type.h:289
Memory layout for an SE(3) velocity.
Definition: type.h:296
double omega[3]
rotational velocity
Definition: type.h:300
double dv[3]
translational velocity
Definition: type.h:299
double data[6]
data array
Definition: type.h:302
Memory layout for an Euler Angle in ZYX (yaw-pitch-roll) format.
Definition: type.h:211
double data[3]
data array
Definition: type.h:218
double y
yaw
Definition: type.h:214
double r
roll
Definition: type.h:216
double p
pitch
Definition: type.h:215
Memory layout for a quaternion, x,y,z,w order.
Definition: type.h:189
struct aa_tf_vec3 vec
vector part
Definition: type.h:199
double v[3]
vector part
Definition: type.h:200
double x
x component
Definition: type.h:192
double data[4]
data array
Definition: type.h:204
double z
z component
Definition: type.h:194
double w
w component
Definition: type.h:195
double scalar
scalar part
Definition: type.h:202
double y
y component
Definition: type.h:193
Transform and spatial velocity.
Definition: type.h:312
struct aa_tf_dx dx
velocity
Definition: type.h:316
struct aa_tf_qv tf
transform
Definition: type.h:315
Memory layout for a Transformation as rotation quaternion and translation vector.
Definition: type.h:270
double data[7]
data array
Definition: type.h:276
aa_tf_vec3_t v
translation vector
Definition: type.h:274
aa_tf_quat_t r
rotation unit quaternion
Definition: type.h:273
Memory layout for a rotation matrix.
Definition: type.h:140
struct aa_tf_vec3 col2
column 2
Definition: type.h:145
struct aa_tf_vec3 col1
column 1
Definition: type.h:144
struct aa_tf_vec3 col0
column 0
Definition: type.h:143
double data[9]
data array
Definition: type.h:147
Memory layout for a planar rotation matrix.
Definition: type.h:68
aa_tf_vec2 col1
column 1
Definition: type.h:72
aa_tf_vec2 col0
column 0
Definition: type.h:71
double data[4]
data array
Definition: type.h:74
Memory layout for a transformation matrix.
Definition: type.h:232
double R[9]
the rotation matrix part
Definition: type.h:235
double data[12]
data array
Definition: type.h:238
aa_tf_vec3_t v
the origin vector part
Definition: type.h:236
Memory layout for a planar transformation matrix.
Definition: type.h:100
aa_tf_rotmatp R
the rotation matrix part
Definition: type.h:103
aa_tf_vec2 v
the origin vector part
Definition: type.h:104
double data[6]
data array
Definition: type.h:106
Memory layout for a vector of length 3.
Definition: type.h:124
double data[3]
data array
Definition: type.h:131
double y
y component
Definition: type.h:128
double x
x component
Definition: type.h:127
double z
z component
Definition: type.h:129
struct aa_tf_tfmat aa_tf_tfmat_t
Memory layout for a transformation matrix.
struct aa_tf_qv aa_tf_qv_t
Memory layout for a Transformation as rotation quaternion and translation vector.
struct aa_tf_duqu aa_tf_duqu_t
Memory layout for a dual quaternion.
double _Complex aa_tf_cmplx
Typedef for C99 complex numbers.
Definition: type.h:57
struct aa_tf_quat aa_tf_quat_t
Memory layout for a quaternion, x,y,z,w order.
aa_tf_cmplx aa_tf_vec2
Represent 2D vectors as complex numbers.
Definition: type.h:60
struct aa_tf_rotmat aa_tf_rotmat_t
Memory layout for a rotation matrix.
struct aa_tf_vec3 aa_tf_vec3_t
Memory layout for a vector of length 3.
struct aa_tf_eulerzyx aa_tf_eulerzyx_t
Memory layout for an Euler Angle in ZYX (yaw-pitch-roll) format.
struct aa_tf_tfmatp aa_tf_tfmatp
Memory layout for a planar transformation matrix.
struct aa_tf_axang aa_tf_axang_t
Memory layout for axis-Angle rotation in x,y,z,angle order.
struct aa_tf_cv aa_tf_cv
Memory layout for planar transform as complex number and translation vector.
struct aa_tf_rotmatp aa_tf_rotmatp
Memory layout for a planar rotation matrix.