1 | initial version |

First be aware what a quaternion is, a fairly concise representation of an arbitrary rotation, using four components, _qx_, _qy_, _qx_, and _qw_. These represent two values: 1) an axis of rotation, as a vector <_x_, _y_, _z_>, and 2) an angle of rotation _theta_ around that vector, in radians, using a right-hand rule. (Point your right thumb along the vector pointing away from the origin, and curl the fingers of your right hand. That direction is a positive rotation.) Those two values are encoded into four components like this:

```
qx = x * sin(theta/2)
qy = y * sin(theta/2)
qz = z * sin(theta/2)
qw = cos(theta/2)
```

Since the only thing that matters is the direction of the axis vector, it is usually normalized so that it has unit length. That means that each component of the quaternion can have a value from -1 to +1. However, I don't believe a quaternion you get from ROS is guaranteed to be normalized. There is a _normalize()_ method in the _Quaternion_ class to ensure this, however.

2 | No.2 Revision |

First be aware what a quaternion is, a fairly concise representation of an arbitrary rotation, using four components, _qx_, _qy_, _qx_, and _qw_. These represent two values: 1) an axis of rotation, as a vector <_x_, _y_, _z_>, and 2) an angle of rotation _theta_ around that vector, in radians, using a right-hand rule. (Point your right thumb along the vector pointing away from the origin, and curl the fingers of your right hand. That direction is a positive rotation.) Those two values are encoded into four components like this:

```
qx = x * sin(theta/2)
qy = y * sin(theta/2)
qz = z * sin(theta/2)
qw = cos(theta/2)
```

Since the only thing that matters is the direction of the axis vector, it is usually normalized so that it has unit length. That means that each component of the quaternion can have a value from -1 to +1. However, I don't believe a quaternion you get from ROS is guaranteed to be normalized. There is a _normalize()_ method in the _Quaternion_ class to ensure this, however.

3 | No.3 Revision |

First be aware what a quaternion is, a fairly concise representation of an arbitrary rotation, using four components, ~~_qx_, _qy_, _qx_, ~~*qx*, *qy*, *qx*, and ~~_qw_. ~~*qw*. These represent two values: 1) an axis of rotation, as a vector ~~<_x_, _y_, _z_>, ~~<*x*, *y*, *z*>, and 2) an angle of rotation ~~_theta_ ~~*theta* around that vector, in radians, using a right-hand rule. (Point your right thumb along the vector pointing away from the origin, and curl the fingers of your right hand. That direction is a positive rotation.) Those two values are encoded into four components like this:

```
qx = x * sin(theta/2)
qy = y * sin(theta/2)
qz = z * sin(theta/2)
qw = cos(theta/2)
```

Since the only thing that matters is the direction of the axis vector, it is usually normalized so that it has unit length. That means that each component of the quaternion can have a value from -1 to +1. However, I don't believe a quaternion you get from ROS is guaranteed to be normalized. There is a ~~_normalize()_ ~~*normalize()* method in the ~~_Quaternion_ ~~*Quaternion* class to ensure this, however.

4 | No.4 Revision |

First be aware what a quaternion is, a fairly concise representation of an arbitrary rotation, using four components, *qx*, *qy*, *qx*, and *qw*. These represent two values: 1) an axis of rotation, as a vector <*x*, *y*, *z*>, and 2) an angle of rotation *theta* around that vector, in radians, using a right-hand rule. (Point your right thumb along the vector pointing away from the origin, and curl the fingers of your right hand. That direction is a positive rotation.) Those two values are encoded into four components like this:

```
qx = x * sin(theta/2)
qy = y * sin(theta/2)
qz = z * sin(theta/2)
qw = cos(theta/2)
```

Since the only thing that matters is the direction of the axis vector, it is usually normalized so that it has unit length. That means that each component of the quaternion can have a value from -1 to +1. ~~However, ~~I don't believe a quaternion you get from ROS is guaranteed to be normalized. There is a *normalize()* method in the *Quaternion* class to ensure this, however.

5 | No.5 Revision |

First be aware what a quaternion is, a fairly concise representation of an arbitrary rotation, using four components, *qx*, *qy*, *qx*, and *qw*. These represent two values: 1) an axis of rotation, as a vector <*x*, *y*, *z*>, and 2) an angle of rotation *theta* around that vector, in radians, using a right-hand rule. (Point your right thumb along the vector pointing away from the origin, and curl the fingers of your right hand. That direction is a positive rotation.) Those two values are encoded into four components like this:

```
qw = cos(theta/2)
qx = x * sin(theta/2)
qy = y * sin(theta/2)
qz = z * sin(theta/2)
```~~qw = cos(theta/2)
~~

Since the only thing that matters is the direction of the axis vector, it is usually normalized so that it has unit length. That means that each component of the quaternion can have a value from -1 to +1. I don't believe a quaternion you get from ROS is guaranteed to be normalized. There is a *normalize()* method in the *Quaternion* class to ensure this, however.

6 | No.6 Revision |

First be aware what a quaternion is, a fairly concise representation of an arbitrary rotation, using four components, *qx*, *qy*, *qx*, and *qw*. These represent two values: 1) an axis of rotation, as a vector <*x*, *y*, *z*>, and 2) an angle of rotation *theta* around that vector, in radians, using a right-hand rule. (Point your right thumb along the vector pointing away from the origin, and curl the fingers of your right hand. That direction is a positive rotation.) Those two values are encoded into four components like this:

```
qw = cos(theta/2)
qx = x * sin(theta/2)
qy = y * sin(theta/2)
qz = z * sin(theta/2)
```

Since the only thing that matters ~~is the direction of ~~about the axis ~~vector, ~~vector is its direction, it is usually normalized so that it has unit length. That means that each component of the quaternion can have a value from -1 to +1. I don't believe a quaternion you get from ROS is guaranteed to be normalized. There is a *normalize()* method in the *Quaternion* class to ensure this, however.

ROS Answers is licensed under Creative Commons Attribution 3.0 Content on this site is licensed under a Creative Commons Attribution Share Alike 3.0 license.