AUV-Coop-Assembly
Master Thesis for Robotics Engineering. Cooperative peg-in-hole assembly with two underwater vehicles guided by vision
Rpy2Rot.m
1 function R = Rpy2Rot(rpy)
2 %
3 % Rotation matrix from body-fixed frame to inertial frame in roll-pitch-yaw
4 % angles
5 %
6 % function R = Rpy2Rot(rpy)
7 %
8 % input:
9 % rpy dim 3x1 roll-pitch-yaw angles
10 %
11 % output:
12 % R dim 3x3 Rotation matrix
13 %
14 % G. Antonelli, Simurv 4.0, 2013
15 % http://www.eng.docente.unicas.it/gianluca_antonelli/simurv
16 
17 phi = rpy(1);
18 theta = rpy(2);
19 psi = rpy(3);
20 
21 cp = cos(psi); sp = sin(psi);
22 ct = cos(theta); st = sin(theta);
23 cf = cos(phi); sf = sin(phi);
24 
25 R = [ cp*ct -sp*cf+cp*st*sf sp*sf+cp*cf*st
26  sp*ct cp*cf+sf*st*sp -cp*sf+st*sp*cf
27  -st ct*sf ct*cf ];