Trying to get the angles at each time step. The angles should be in radians 0 to pi. From my loop, the angles are qs, qe, qw. Each time we get a new angle by adding the q_dot. I am getting angle 10^4 , which does not make sense.
조회 수: 3 (최근 30일)
이전 댓글 표시
for i=1:length(t)
if i~=1
dxdqs=la*cos(qs)+lf*cos(qs+qe)+lh*cos(qs+qe+qw);
dxdqe=lf*cos(qs+qe)+lh*cos(qs+qe+qw);
dxdqw=lh*cos(qs+qe+qw);
dydqs=la*sin(qs)+lf*sin(qs+qe)+lh*sin(qe+qs+qw);
dydqe=lf*sin(qs+qe)+lh*sin(qe+qs+qw);
dydqw=lh*sin(qe+qs+qw);
dtdqs=1;
dtdqe=1;
dtdqw=1;
J=[dxdqs dxdqe dxdqw; dydqs dydqe dydqw; dtdqs dtdqe dtdqw];
end
w=[1 0 0;0 1 0;0 0 1];
Jcross=inv(w)*J'*inv(J*inv(w)*J');
Q_dot(:,i)=Jcross*dxdt(:,i);
Q_dot(1,i)=qs+Q_dot(1,i);
Q_dot(2,i)=qe+Q_dot(2,i);
Q_dot(3,i)=qw+Q_dot(3,i);
qs=Q_dot(1,i);
qe=Q_dot(2,i);
qw=Q_dot(3,i);
% qw=0;
end
댓글 수: 2
Jan
2021년 2월 15일
We cannot run the code due to the missing variables t, l1, qs, qe, qw, lf, lh and so on.
All we know is that you obtain "angle 10^4" and that you assume to get something else.
So what is your question? What do you expect? What are the values of the variables? How can we help you?
답변 (1개)
Image Analyst
2021년 2월 16일
If you want equal spaced angles, and a certain number of them, do this:
allAngles = linspace(startingAngle, endingAngle, numberOfAngles);
assign the 3 inputs to some actual numbers and it should work.
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!