“Dimensions of arrays being concatenated are not consistent”
1 次查看(过去 30 天)
显示 更早的评论
I am getting said error even thoug I don't think I am not concatenating any array.
wallCordsReal = [];
homoVecSen = [sonars(1); 0; 0; 1];
poser = gtposes(1,:);
transMatrix = Tsonar2univ(poser);
tempWall = transMatrix * homoVecSen;

And here is the function Tsonar2univ:
function transfMatrix = Tsonar2univ(poser)
global measured_offsx;
global measured_offsy;
global measured_offsphi;
%sonar origin relative to robot
RorgS = [measured_offsx; measured_offsy; 0];
UorgR = [poser(1); poser(2); 0];
RrS = [cos(measured_offsphi), sin(measured_offsphi), 0; -sin(measured_offsphi), cos(measured_offsphi), 0; 0, 0, 1]
UrR = [cos(poser(3)), -sin(poser(3)), 0; sin(poser(3)), cos(poser(3)), 0; 0, 0, 1];
RtS = zeros(4,4);
RtS(1:3, 1:3) = RrS;
RtS(1:3, 4) = RorgS;
UtR = zeros(4,4);
UtR(1:3, 1:3) = UrR;
UtR(1:3, 4) = UorgR;
UtR(4,4) = 1;
transfMatrix = UtR * RtS;
end
0 个评论
回答(1 个)
James Tursa
2020-4-28
TYpe this at the command line:
dbstop if error
then run your code. When the error occurs the code will pause with all current variables intact. Examine measured_offsphi and you will probably see it is not a scalar. Then backtrack in your code and figure out why.
6 个评论
James Tursa
2020-4-30
Well, did you do what I suggested in my very first post? That puts you in the debugger where you can figure things out.
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Robotics 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!