2017-01-16 18:06:15 +00:00
|
|
|
%*** CHAPTER 3: RIGID-BODY MOTIONS ***
|
|
|
|
|
|
2018-04-30 15:42:43 +00:00
|
|
|
function T = RpToTrans(R, p)
|
2017-01-16 18:06:15 +00:00
|
|
|
% Takes rotation matrix R and position p.
|
|
|
|
|
% Returns the corresponding homogeneous transformation matrix T in SE(3).
|
|
|
|
|
% Example Input:
|
|
|
|
|
%{
|
2018-04-30 15:42:43 +00:00
|
|
|
clear; clc;
|
2017-01-16 18:06:15 +00:00
|
|
|
R = [[1, 0, 0]; [0, 0, -1]; [0, 1, 0]];
|
|
|
|
|
p = [1; 2; 5];
|
2018-04-30 15:42:43 +00:00
|
|
|
T = RpToTrans(R, p)
|
2017-01-16 18:06:15 +00:00
|
|
|
%}
|
|
|
|
|
% Output:
|
|
|
|
|
% T =
|
|
|
|
|
% 1 0 0 1
|
|
|
|
|
% 0 0 -1 2
|
|
|
|
|
% 0 1 0 5
|
|
|
|
|
% 0 0 0 1
|
|
|
|
|
|
|
|
|
|
T = [R, p; 0, 0, 0, 1];
|
|
|
|
|
end
|