dRonin  adbada4
dRonin firmware
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
coordinate_conversions.h
Go to the documentation of this file.
1 
19 /*
20  * This program is free software; you can redistribute it and/or modify
21  * it under the terms of the GNU General Public License as published by
22  * the Free Software Foundation; either version 3 of the License, or
23  * (at your option) any later version.
24  *
25  * This program is distributed in the hope that it will be useful, but
26  * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
27  * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
28  * for more details.
29  *
30  * You should have received a copy of the GNU General Public License along
31  * with this program; if not, see <http://www.gnu.org/licenses/>
32  */
33 
34 #ifndef COORDINATECONVERSIONS_H_
35 #define COORDINATECONVERSIONS_H_
36 
37 #include <stdbool.h>
38 
39 void RneFromLLA(float LLA[3], float Rne[3][3]);
40 
41  // ****** find rotation matrix from rotation vector
42 void Rv2Rot(float Rv[3], float R[3][3]);
43 
44  // ****** find roll, pitch, yaw from quaternion ********
45 void Quaternion2RPY(const float q[4], float rpy[3]);
46 
47  // ****** find quaternion from roll, pitch, yaw ********
48 void RPY2Quaternion(const float rpy[3], float q[4]);
49 
50  //** Find Rbe, that rotates a vector from earth fixed to body frame, from quaternion **
51 void Quaternion2R(float q[4], float Rbe[3][3]);
52 
53 //** Find Rbe, that rotates a vector from earth fixed to body frame, from Tait-Bryan angles **
54 void Euler2R(float rpy[3], float Rbe[3][3]); //WHAT TO DO ABOUT ALL THE CONST? SHOULD EVERY INPUT BE A CONST?
55 
56  // ****** convert Rotation Matrix to Quaternion ********
57  // ****** if R converts from e to b, q is rotation from e to b ****
58 void R2Quaternion(float R[3][3], float q[4]);
59 
60  // ****** Rotation Matrix from Two Vector Directions ********
61  // ****** given two vector directions (v1 and v2) known in two frames (b and e) find Rbe ***
62  // ****** solution is approximate if can't be exact ***
63 uint8_t RotFrom2Vectors(const float v1b[3], const float v1e[3], const float v2b[3], const float v2e[3], float Rbe[3][3]);
64 
65  // ****** Vector Cross Product ********
66 void CrossProduct(const float v1[3], const float v2[3], float result[3]);
67 
68  // ****** Vector Magnitude ********
69 float VectorMagnitude(const float v[3]);
70 
71 void quat_inverse(float q[4]);
72 void quat_copy(const float q[4], float qnew[4]);
73 void quat_mult(const float q1[4], const float q2[4], float qout[4]);
74 void rot_mult(float R[3][3], const float vec[3], float vec_out[3], bool transpose);
75 
76 #endif /* COORDINATECONVERSIONS_H_ */
77 
void rot_mult(float R[3][3], const float vec[3], float vec_out[3], bool transpose)
Rotate a vector by a rotation matrix.
void Rv2Rot(float Rv[3], float R[3][3])
void Quaternion2R(float q[4], float Rbe[3][3])
void RPY2Quaternion(const float rpy[3], float q[4])
void quat_copy(const float q[4], float qnew[4])
Duplicate a quaternion.
float R[NUMV]
Definition: insgps14state.c:67
float VectorMagnitude(const float v[3])
void quat_mult(const float q1[4], const float q2[4], float qout[4])
Multiply two quaternions into a third.
void RneFromLLA(float LLA[3], float Rne[3][3])
void R2Quaternion(float R[3][3], float q[4])
void Euler2R(float rpy[3], float Rbe[3][3])
void CrossProduct(const float v1[3], const float v2[3], float result[3])
void quat_inverse(float q[4])
Compute the inverse of a quaternion.
uint8_t RotFrom2Vectors(const float v1b[3], const float v1e[3], const float v2b[3], const float v2e[3], float Rbe[3][3])
void Quaternion2RPY(const float q[4], float rpy[3])