# Orientation Modeling Using Quaternions and Rational Trigonometry

^{1}

^{2}

^{3}

^{4}

^{*}

## Abstract

**:**

## 1. Introduction

## 2. Related Work

## 3. Quaternions in a Rational Way

## 4. Dual Quaternions in a Rational Way

## 5. Orientation Model

- The point O corresponds to the fourth joint of an industrial robotic arm and is the first degree of freedom for the orientation mechanism. Its rotation axis is parallel to the ${z}_{1}$ axis of our main reference frame;
- The point C corresponds to the fifth joint of an industrial robotic arm and is the second degree of freedom for the orientation mechanism. This point is where the three rotation axes of the wrist intersect. The opening of this joint defines the final position of the wrist mechanism, but this point remains fixed under any variation of the three joint parameters;
- The point P corresponds to the sixth joint of the manipulator and is the last degree of freedom for the orientation mechanism. P is where the end effector is, as long as the first joint of the orientation mechanism does not change. Otherwise, the end effector moves through the circular trajectory to ${P}_{f}$.

#### 5.1. Euler Angles in a Rational Way

#### 5.2. Real Mechanism in a Rational Way

## 6. Experimental Results

#### 6.1. Rational Euler Angles Implementation

#### 6.2. Hardware Implementation

## 7. Conclusions

## Author Contributions

## Funding

## Institutional Review Board Statement

## Informed Consent Statement

## Data Availability Statement

## Acknowledgments

## Conflicts of Interest

## Appendix A

**Turn:**The turn of any complex number z is defined as:

**Half-turn:**For any complex number z on the unit circle, except the point $[-1,0]$, the half-turn is the intersection between the y-axis and the line through the points $[-1,0]$ and z, as shown in Figure A1b. Therefore, the half-turn is defined by:

**Spread:**The spread can be defined in several ways. According to Figure A1c, the spread is determined by:

#### Rotations on the Plane

**Figure A2.**Rational parameterization of the unit circle. (

**a**) Representation of the stereographic projection for the unit circumference. (

**b**) Some points on the unit circle according to the half-turn parameter.

**Example:**Find the points on the unit circle when $t=0,1,2,3$, Figure A2b:

## References

- Arrigo, J.; Chau, P. Accurate motion capture at high rotational rates using the CORDIC algorithm. In Proceedings of the Thrity-Seventh Asilomar Conference on Signals, Systems and Computers, Pacific Grove, CA, USA, 9–12 November 2003; Volume 2, pp. 2203–2207. [Google Scholar]
- Lang, T.; Antelo, E. High-throughput 3D rotations and normalizations. In Proceedings of the Conference Record of Thirty-Fifth Asilomar Conference on Signals, Systems and Computers (Cat. No. 01CH37256), Pacific Grove, CA, USA, 4–9 November 2001; Volume 1, pp. 846–851. [Google Scholar]
- Biswas, D.; Ye, Z.; Mazomenos, E.B.; Jöbges, M.; Maharatna, K. CORDIC framework for quaternion-based joint angle computation to classify arm movements. In Proceedings of the 2018 IEEE International Symposium on Circuits and Systems (ISCAS), Vancouver, BC, Canada, 23–26 May 2018; pp. 1–5. [Google Scholar]
- Arrigo, J.F.; Chau, P.M. Power aware attitude computation during rapid rotational motion. IEEE Trans. Instrum. Meas.
**2006**, 55, 63–69. [Google Scholar] [CrossRef] - Osborne, J.; Hicks, G.; Fuentes, R. Global analysis of the double-gimbal mechanism. IEEE Control Syst. Mag.
**2008**, 28, 44–64. [Google Scholar] - Ahi, B.; Nobakhti, A. Hardware implementation of an ADRC controller on a gimbal mechanism. IEEE Trans. Control Syst. Technol.
**2017**, 26, 2268–2275. [Google Scholar] [CrossRef] - Choi, C.L.; Rebello, J.; Koppel, L.; Ganti, P.; Das, A.; Waslander, S.L. Encoderless gimbal calibration of dynamic multi-camera clusters. In Proceedings of the IEEE International Conference on Robotics and Automation (ICRA), Brisbane, Australia, 21–25 May 2018; pp. 2126–2133. [Google Scholar]
- Rajesh, R.; Kavitha, P. Camera gimbal stabilization using conventional PID controller and evolutionary algorithms. In Proceedings of the 2015 International Conference on Computer, Communication and Control (IC4), Indore, India, 10–12 September 2015; pp. 1–6. [Google Scholar]
- Lo, Y.L.; Li, Y.C.; Kim, Y.C. Downstream interference effect of low-Scruton-number high-rise buildings under turbulent boundary layer flow. J. Wind Eng. Ind. Aerodyn.
**2020**, 198, 104101. [Google Scholar] [CrossRef] - Altan, A.; Hacıoğlu, R. Model predictive control of three-axis gimbal system mounted on UAV for real-time target tracking under external disturbances. Mech. Syst. Signal Process.
**2020**, 138, 106548. [Google Scholar] [CrossRef] - Zheng, P.; Tan, X.; Kocer, B.B.; Yang, E.; Kovac, M. TiltDrone: A Fully-Actuated Tilting Quadrotor Platform. IEEE Robot. Autom. Lett.
**2020**, 5, 6845–6852. [Google Scholar] [CrossRef] - Craig, J.J. Introduction to Robotics: Mechanics and Control; Pearson Educacion: London, UK, 2005. [Google Scholar]
- Fu, Z.; Pan, J.; Spyrakos-Papastavridis, E.; Chen, X.; Li, M. A Dual Quaternion-Based Approach for Coordinate Calibration of Dual Robots in Collaborative Motion. IEEE Robot. Autom. Lett.
**2020**, 5, 4086–4093. [Google Scholar] [CrossRef] - Rodman, L. Topics in quaternion linear algebra. In Topics in Quaternion Linear Algebra; Princeton University Press: Princeton, NJ, USA, 2014. [Google Scholar]
- Morais, J.P.; Georgiev, S.; Sprößig, W. Real Quaternionic Calculus Handbook; Springer: Berlin/Heidelberg, Germany, 2014. [Google Scholar]
- Kavan, L.; Collins, S.; O’Sullivan, C.; Zara, J. Dual Quaternions for Rigid Transformation Blending; Technical report; Trinity College Dublin: Dublin, Ireland, 2006. [Google Scholar]
- Ma, R.; Gupta, K.C. On the motion of oblique bevel geared robot wrists. J. Robot. Syst.
**1989**, 6, 509–520. [Google Scholar] [CrossRef] - Zhang, H. Feasibility analysis of displacement trajectories for robot manipulators with a spherical wrist. In Proceedings of the 1991 IEEE International Conference on Robotics and Automation, Sacramento, CA, USA, 9–11 April 1991; pp. 1252–1257. [Google Scholar]
- Jo, H.M.; Lim, D.J.; Chung, W.J.; Choi, J.K.; Kim, D.Y.; Ahn, Y.J.; Ahn, H.S. Optimal wrist design of wrist-hollow type 6-axis articulated robot using genetic algorithm. In Proceedings of the 2018 IEEE International Conference on Mechatronics and Automation (ICMA), Jilin, China, 5–8 August 2018; pp. 1486–1491. [Google Scholar]
- Bailly, F.; Charbonneau, E.; Danès, L.; Begon, M. Optimal 3D arm strategies for maximizing twist rotation during somersault of a rigid-body model. Multibody Syst. Dyn.
**2021**, 52, 193–209. [Google Scholar] [CrossRef] - Chu, C.Y.; Xu, J.Y.; Lan, C.C. Design and experiment of a compact wrist mechanism with high torque density. Mech. Mach. Theory
**2014**, 78, 65–80. [Google Scholar] [CrossRef] - Cheng, L.; Wang, H.; Liu, Y. Movement coupling analysis on the wrist of 165Kg spot welding robot. In Proceedings of the 2011 IEEE International Conference on Cyber Technology in Automation, Control, and Intelligent Systems, Kunming, China, 20–23 May 2011; pp. 244–248. [Google Scholar]
- Hildenbrand, D. Foundations of geometric algebra computing. In Proceedings of the AIP Conference Proceedings, Ft. Worth, TX, USA, 5–10 August 2012; American Institute of Physics: College Park, MD, USA; Volume 1479, pp. 27–30. [Google Scholar]
- Cao, Y.; Ji, W.; Li, Z.; Zhou, H.; Liu, M. Orientation-singularity and nonsingular orientation-workspace analyses of the stewart-gough platform using unit quaternion representation. In Proceedings of the 2010 Chinese Control and Decision Conference, Xuzhou, China, 26–28 May 2010; pp. 2282–2287. [Google Scholar]
- Wang, C.; Fu, Z. A new way to detect the position and orientation of the wheeled mobile robot on the image plane. In Proceedings of the IEEE International Conference on Robotics and Biomimetics (ROBIO 2014), Bali, Indonesia, 5–10 December 2014; pp. 2158–2162. [Google Scholar]
- Paulraj, M.; Ahmad, R.B.; Hema, C.; Hashim, F.; Yusoff, S. Active stereo vision based system for estimation of mobile robot orientation using affine moment invariants. In Proceedings of the 2008 International Conference on Electronic Design, Penang, Malaysia, 1–3 December 2008; pp. 1–7. [Google Scholar]
- Wildberger, N. A rational approach to trigonometry. Math Horizons
**2007**, 15, 16–20. [Google Scholar] [CrossRef] - Wildberger, N.J. Divine Proportions: Rational Trigonometry to Universal Geometry; Wild Egg: Sydney, Australia, 2005. [Google Scholar]
- Jia, Y.B. Quaternions and rotations. Com. S
**2008**, 477, 15. [Google Scholar] - Kenwright, B. A beginners guide to dual-quaternions: What they are, how they work, and how to use them for 3D character hierarchies. In Proceedings of the 20th International Conference in Central Europe on Computer Graphics, Visualization and Computer Vision 2012, Plzen, Czech Republic, 26–28 June 2012; pp. 1–10. [Google Scholar]
- Paul, R.P. Robot Manipulators: Mathematics, Programming, and Control: The Computer Control of Robot Manipulators; The MIT Press: Cambridge, MA, USA, 1981. [Google Scholar]
- Peralta, R.M.; Gómez, E.Z.; Azuela, J.H.S. Efficient FPGA hardware implementation for robot manipulator kinematic modeling using rational trigonometry. IEEE Lat. Am. Trans.
**2019**, 17, 1524–1536. [Google Scholar] [CrossRef]

**Figure 1.**Representation of four-dimensional space. (

**a**) 4D space where the blue sphere represents an S

^{3}sphere, the red sphere describes an S

^{2}sphere, and q is a quaternion on the 4D space. (

**b**) 4D space where the V space in green is equal to a 3D space and the t-axis is orthogonal to this space.

**Figure 8.**Simulation of different rotation techniques. (

**a**) Intrinsic rotation, where rotations were performed around the body reference frame with parameters ϕ = 111°, ɵ = 67°, and φ = 60°. (

**b**) Extrinsic rotation, where rotations were performed around the general reference frame with parameters ϕ = 60°, ɵ = 67°, and φ = 111°. (

**c**) Classical rotation algorithm with three parameters given in angles. (

**d**) Rational rotation algorithm with three parameters given in rational form (half-turns).

Bits | Maximum Value | Half-Turn (Degrees) |
---|---|---|

2 | 1 | $\pm {90}^{\circ}$ |

3 | 3 | $\pm 143.{13}^{\circ}$ |

4 | 7 | $\pm 163.{74}^{\circ}$ |

5 | 15 | $\pm 172.{37}^{\circ}$ |

6 | 31 | $\pm 176.{30}^{\circ}$ |

7 | 63 | $\pm 178.{18}^{\circ}$ |

8 | 127 | $\pm 179.{1}^{\circ}$ |

Bits | Maximum Value | Half-Turn (Degrees) |
---|---|---|

1 | 0.5 | $\pm 53.{13}^{\circ}$ |

2 | 0.25 | $\pm 28.{07}^{\circ}$ |

3 | 0.125 | $\pm 14.{25}^{\circ}$ |

4 | 0.0625 | $\pm 7.{15}^{\circ}$ |

5 | 0.3125 | $\pm 3.{58}^{\circ}$ |

6 | 0.015625 | $\pm 1.{79}^{\circ}$ |

7 | 0.0078125 | $\pm 0.{9}^{\circ}$ |

8 | 0.00390625 | $\pm 0.{45}^{\circ}$ |

Operation | Rational Method | Classical Method |
---|---|---|

± | 4 | 5 |

× | 6 | 12 |

÷ | 2 | 2 |

$sin\theta $ | 0 | 1 |

$cos\theta $ | 0 | 1 |

$\sqrt{\xb7}$ | 0 | 1 |

Operation | Rational Method | Classical Method |
---|---|---|

± | 12 | 15 |

× | 18 | 36 |

÷ | 6 | 6 |

$sin\theta $ | 0 | 3 |

$cos\theta $ | 0 | 3 |

$\sqrt{\xb7}$ | 0 | 3 |

Publisher’s Note: MDPI stays neutral with regard to jurisdictional claims in published maps and institutional affiliations. |

© 2022 by the authors. Licensee MDPI, Basel, Switzerland. This article is an open access article distributed under the terms and conditions of the Creative Commons Attribution (CC BY) license (https://creativecommons.org/licenses/by/4.0/).

## Share and Cite

**MDPI and ACS Style**

Martínez, R.; Zamora, E.; Sossa, H.; Arce, F.; Soriano, L.A.
Orientation Modeling Using Quaternions and Rational Trigonometry. *Machines* **2022**, *10*, 749.
https://doi.org/10.3390/machines10090749

**AMA Style**

Martínez R, Zamora E, Sossa H, Arce F, Soriano LA.
Orientation Modeling Using Quaternions and Rational Trigonometry. *Machines*. 2022; 10(9):749.
https://doi.org/10.3390/machines10090749

**Chicago/Turabian Style**

Martínez, Rogelio, Erik Zamora, Humberto Sossa, Fernando Arce, and Luis Arturo Soriano.
2022. "Orientation Modeling Using Quaternions and Rational Trigonometry" *Machines* 10, no. 9: 749.
https://doi.org/10.3390/machines10090749