How to convert polynomial trajectory block out to a 4×4 homogeneous transformation matrix
4 views (last 30 days)
Show older comments
I created 7 waypoints using inverse kinematics designer app and exported the configuration into a matrix (7×6 matrix) containg xyz position and respective euler angles. From this matrix i input only the xyz position data(3×7 matrix) as waypoints to a polynomial trajectory block with time. But when i run the simulink an error is showing up, saying that polynomial trajectory output should be 4x4 homogeneous matrix inorder to connect to the inverse kinematics block input (pose). How could I resolve this issue

0 Comments
Accepted Answer
Zinea
on 30 Mar 2025
The documentation of "Inverse Kinematics" block specifies that it expects a 4x4 homogeneous transform as input, which is the cause of the error. You can refer the documentation link given below:
To resolve the error as stated in the question, you need to follow these steps:
1) Create a function that converts XYZ positions into 4x4 homogeneous matrices.
function H = xyz2homogeneous(xyz)
H = eye(4); % Create 4x4 identity matrix
H(1:3,4) = xyz(:); % Set translation component
end
2) Add a "MATLAB Function" block after your "Polynomial Trajectory" block with the following code inside it:
function H = fcn(xyz)
H = eye(4);
H(1:3,4) = xyz;
H(1:3,1:3) = eye(3); % Identity rotation matrix
end
In this way you can get the correct 4x4 matrix format for the "Inverse Kinematics" block, while using the existing XYZ trajectory generation.
Best!
More Answers (0)
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!