- #1
sprince09
- 8
- 0
Hi guys,
I've got some MATLAB code that calculates the forward kinematics for a robotic arm. This calculation relies on the successive multiplication of a series of 4x4 matrices, and currently I have this coded (more or less) as:
T0 and Tlocal are both known quantities, and their calculation is trivial in comparison to the above code. T is a series of 4x4 matrices. This code needs to be run every time I change the configuration of the robotic arm (ie, change a joint angle), so it get's evaluated very frequently in my program.
What I am hoping to do is somehow eliminate the for loop, either by vectorizing this code (which I don't think is possible) or somehow use sparse matrices to perform this calculation. I'd like to stay away from big paradigm shifts, like writing a MEX function or switching to quaternion representation, as I'm trying to keep this code as human-readable as possible.
Anyone have any suggestions?
I've got some MATLAB code that calculates the forward kinematics for a robotic arm. This calculation relies on the successive multiplication of a series of 4x4 matrices, and currently I have this coded (more or less) as:
Code:
...
T(:,:, 1) = T0;
for i = 2:njoints
T(:,:, i+1) = T(:,:, i-1) * Tlocal(:,:, i);
end
...
T0 and Tlocal are both known quantities, and their calculation is trivial in comparison to the above code. T is a series of 4x4 matrices. This code needs to be run every time I change the configuration of the robotic arm (ie, change a joint angle), so it get's evaluated very frequently in my program.
What I am hoping to do is somehow eliminate the for loop, either by vectorizing this code (which I don't think is possible) or somehow use sparse matrices to perform this calculation. I'd like to stay away from big paradigm shifts, like writing a MEX function or switching to quaternion representation, as I'm trying to keep this code as human-readable as possible.
Anyone have any suggestions?
Last edited: