# How to calculate quaternion from rotation vector?

I'm using ROS kinetic to control Yumi ABB robot. For the calculation of the qauternion I've implemented a code in Matlab. The inputs are the start vector and the goal vector both of them are normalized. Then I apply the dot product to get the angle between the two vectors and then the cross product to get the angle of rotation.

For example my start vector is [0 0 1] and goal vector is [0 1 0] the dot product gives me an angle of pi and cross product gives me the rotation axis [-1 0 0].

Then I rotate this axis by the given angle

```
rotationVector = 1.5708 *[-1,0,0]
rotationMatrix = rotationVectorToMatrix(rotationVector)
quat = rotm2quat(rotationMatrix)
```

quat =

```
0.7071 0.7071 0 0
```

The results of my code are correct my question is there any function in ros to convert the rotation vector to quaternions? As I'm still making the calculations in Matlab and transfer the results to the ROS code manually and I want the process to be automated.

Thank you in advance.

Would Eigen::Quaternion::FromTwoVectors(..) be of any help here?