rotations.h
Go to the documentation of this file.
1 /**************************************************************************************************
2  Software License Agreement (BSD License)
3 
4  Copyright (c) 2011-2013, LAR toolkit developers - University of Aveiro - http://lars.mec.ua.pt
5  All rights reserved.
6 
7  Redistribution and use in source and binary forms, with or without modification, are permitted
8  provided that the following conditions are met:
9 
10  *Redistributions of source code must retain the above copyright notice, this list of
11  conditions and the following disclaimer.
12  *Redistributions in binary form must reproduce the above copyright notice, this list of
13  conditions and the following disclaimer in the documentation and/or other materials provided
14  with the distribution.
15  *Neither the name of the University of Aveiro nor the names of its contributors may be used to
16  endorse or promote products derived from this software without specific prior written permission.
17 
18  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR
19  IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
20  FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
21  CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
22  DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23  DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
24  IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
25  OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 ***************************************************************************************************/
33 #ifndef _TRANSFORMS_H
34 #define _TRANSFORMS_H
35 
36 /* SECTION:transforms*/
37 
55 #ifdef __cplusplus
56 extern "C" {
57 #endif
58 
59 /*
60 When composing rotations, the resulting quaternion represents
61 first rotating by b, then rotation by a.
62 */
63 void rot_quat_mult (double c[4], const double a[4], const double b[4]);
64 void rot_quat_rotate (const double quat[4], double v[3]);
65 void rot_quat_rotate_rev (const double quat[4], double v[3]);
66 // formerly: rot_quat_to_matrix
67 int rot_quat_to_matrix(const double quat[4], double rot[9]);
68 // formerly: rot_matrix_to_quat
69 int rot_matrix_to_quat(const double rot[9], double quat[4]);
70 int rot_quat_pos_to_matrix(const double quat[4], const double pose[3], double m[16]);
71 
72 /*
73 populates a quaternion so that it represents a rotation of theta radians
74 about the axis <x,y,z>
75 */
76 void rot_angle_axis_to_quat (double theta, const double axis[3], double q[4]);
77 void rot_quat_to_angle_axis (const double q[4], double *theta, double axis[3]);
78 
79 /*
80  * converts a rotation from RPY representation (radians) into unit quaternion
81  * representation
82  *
83  * rpy[0] = roll
84  * rpy[1] = pitch
85  * rpy[2] = yaw
86  */
87 void rot_roll_pitch_yaw_to_quat(const double rpy[3], double q[4]);
88 
89 /*
90  * converts a rotation from unit quaternion representation to RPY
91  * representation. Resulting values are in radians.
92  *
93  * If any of roll, pitch, or yaw are NULL, then they are not set.
94  *
95  * rpy[0] = roll
96  * rpy[1] = pitch
97  * rpy[2] = yaw
98  */
99 void rot_quat_to_roll_pitch_yaw (const double q[4], double rpy[3]);
100 /* These doesn't truly belong with the quaternion functions, but are useful and sort of fits in here. */
101 void rot_roll_pitch_yaw_to_angle_axis (const double rpy[3], double *angle, double axis[3]);
102 void rot_angle_axis_to_roll_pitch_yaw (double angle, const double axis[3], double rpy[3]);
103 // runs some sanity checks
104 int rot_quaternion_test();
105 
106 #ifdef __cplusplus
107 }
108 #endif
109 
110 #endif
111 
void rot_angle_axis_to_quat(double theta, const double axis[3], double q[4])
Definition: rotations.cpp:134
int rot_quat_to_matrix(const double quat[4], double rot[9])
Definition: rotations.cpp:228
void rot_quat_rotate_rev(const double quat[4], double v[3])
rot_quat_rotate_rev
Definition: rotations.cpp:116
void rot_quat_mult(double c[4], const double a[4], const double b[4])
rot_quat_mult
Definition: rotations.cpp:68
void rot_quat_to_angle_axis(const double q[4], double *theta, double axis[3])
Definition: rotations.cpp:153
int rot_quat_pos_to_matrix(const double quat[4], const double pose[3], double m[16])
Definition: rotations.cpp:260
int rot_quaternion_test()
Definition: rotations.cpp:320
void rot_quat_to_roll_pitch_yaw(const double q[4], double rpy[3])
Definition: rotations.cpp:194
void rot_roll_pitch_yaw_to_quat(const double rpy[3], double q[4])
Definition: rotations.cpp:171
void rot_angle_axis_to_roll_pitch_yaw(double angle, const double axis[3], double rpy[3])
Definition: rotations.cpp:218
int rot_matrix_to_quat(const double rot[9], double quat[4])
Definition: rotations.cpp:289
void rot_roll_pitch_yaw_to_angle_axis(const double rpy[3], double *angle, double axis[3])
Definition: rotations.cpp:209
void rot_quat_rotate(const double quat[4], double v[3])
rot_quat_rotate
Definition: rotations.cpp:87


mit_darpa_logs_player
Author(s): Miguel Oliveira
autogenerated on Mon Mar 2 2015 01:32:15