From: jjspierx Spiering on
I am trying to find an iterative convergence technique for a kinematic solution.

A brief description of the problem...

I have 2 points in space(A and B) connected by an imaginary rigid body. Each point rotates about a different axis. As one point rotates about its axis, the other point has to rotate about its axis at a different rate so that the distance between the points remains the same(since connected by rigid body).

An arbitrary example...

Using norm(A-B), I determine the distance between A and B to be X
I then rotate point A about its axis 'theta' degrees and call this new point A'
Then I rotate point B about its axis 'beta_initial' degrees and call it B'
Then I use norm(A'-B') to find the new distance between points
I then increase or decrease beta_initial until norm(A'-B')=norm(A-B)

Does anybody have an idea of how I might do this using a smart approach instead of just manually doing it? I could write a loop that starts at beta_intial=0 and increases by 0.000001 with each iteration until a solution is found, but of course that seems absurd.

Thanks in advance.
From: Alfredo Rojas on
Use a Rotation matrix
http://en.wikipedia.org/wiki/Rotation_matrix
For example if it is in 2D, and you want to rotate the points A and B 30º around the point P qyou can make
R=[cos(30) -sin(30); sin(30) cos(30)]
A2=R*(A-P) (Here A and B, P are column vectors)
B2=R*(b-P)
From: jjspierx Spiering on
"Alfredo Rojas" <asdrojas(a)gmail.com> wrote in message <hu4135$nu2$1(a)fred.mathworks.com>...
> Use a Rotation matrix
> http://en.wikipedia.org/wiki/Rotation_matrix
> For example if it is in 2D, and you want to rotate the points A and B 30º around the point P qyou can make
> R=[cos(30) -sin(30); sin(30) cos(30)]
> A2=R*(A-P) (Here A and B, P are column vectors)
> B2=R*(b-P)

Each points rotates about a different axis, not the same axis. Doing the rotations is not a problem for me. The problem is that since they rotate about different axis, they revolve at different rates in order to keep them the same distance apart. I can determine manually how much to rotate each one with respect to the other to keep them the same distance apart, but I am looking for a convergence method that will approach the solution without just using a linearly incremental counter.
From: jjspierx Spiering on
"jjspierx Spiering" <jjspierx(a)gmail.com> wrote in message <hu428l$bai$1(a)fred.mathworks.com>...
> "Alfredo Rojas" <asdrojas(a)gmail.com> wrote in message <hu4135$nu2$1(a)fred.mathworks.com>...
> > Use a Rotation matrix
> > http://en.wikipedia.org/wiki/Rotation_matrix
> > For example if it is in 2D, and you want to rotate the points A and B 30º around the point P qyou can make
> > R=[cos(30) -sin(30); sin(30) cos(30)]
> > A2=R*(A-P) (Here A and B, P are column vectors)
> > B2=R*(b-P)
>
> Each points rotates about a different axis, not the same axis. Doing the rotations is not a problem for me. The problem is that since they rotate about different axis, they revolve at different rates in order to keep them the same distance apart. I can determine manually how much to rotate each one with respect to the other to keep them the same distance apart, but I am looking for a convergence method that will approach the solution without just using a linearly incremental counter.

Ok, I have figured out a method that works, but I would still like to optimize it as this code is specific to this one rotation and I want make it generic for several rotations about different axes... Here is pseudo code...


iterationCounter = 1;
new_try = 0;

while delta >= 1e-6

theta_initial = new_try;

iterationCounter = iterationCounter + 1;

....determine transformation matrix
....apply transformation
....check for new length between points
delta = abs(Links(1)-check_length); % determines difference between new length and original length
new_try = theta_initial+(5.65)*delta;

disp(['Iteration ' num2str(iterationCounter) ': theta ' num2str(theta_initial) ': Length = [' num2str(check_length), '], |deltaX| = ' num2str(delta)]);

end

This code works in 5 iterations for my specific example, the iterations vary as I change the "5.65" from the code above. If my first guess is 5.7, then the guess is too large and convergence is never found and the loop is infinite. If I guess 5.4 initially, it takes longer than 5 iterations. I would like to find a way to find a good initial guess, and change the initial guess to find the solution with the smallest amount of iterations. Instead of having to manually figure out a good guess and use that same guess for each iteration.
From: Alfredo Rojas on
Every motion of a rigid body is equivalent to a traslation plus a rotation (I guess that is a Euler's theorem). In fact if a linear map holds the distances beetween any pair of poitns is equivalent to a rotation plus a translation so you can totate the point around the same axes using rotations matrix like this
A2=R*(A-P)+T