Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
iterative convergence technique for kinematic solution

Subject: iterative convergence technique for kinematic solution

From: jjspierx Spiering

Date: 1 Jun, 2010 21:55:05

Message: 1 of 10

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.

Subject: iterative convergence technique for kinematic solution

From: Alfredo Rojas

Date: 1 Jun, 2010 22:20:21

Message: 2 of 10

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)

Subject: iterative convergence technique for kinematic solution

From: jjspierx Spiering

Date: 1 Jun, 2010 22:40:21

Message: 3 of 10

"Alfredo Rojas" <asdrojas@gmail.com> wrote in message <hu4135$nu2$1@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.

Subject: iterative convergence technique for kinematic solution

From: jjspierx Spiering

Date: 1 Jun, 2010 23:19:05

Message: 4 of 10

"jjspierx Spiering" <jjspierx@gmail.com> wrote in message <hu428l$bai$1@fred.mathworks.com>...
> "Alfredo Rojas" <asdrojas@gmail.com> wrote in message <hu4135$nu2$1@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.

Subject: iterative convergence technique for kinematic solution

From: Alfredo Rojas

Date: 1 Jun, 2010 23:27:05

Message: 5 of 10

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

Subject: iterative convergence technique for kinematic solution

From: Matt J

Date: 2 Jun, 2010 08:54:05

Message: 6 of 10

"jjspierx Spiering" <jjspierx@gmail.com> wrote in message <hu3vjp$f8c$1@fred.mathworks.com>...
> 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.
=================

It's not entirely clear to me from the description what the given inputs are and what you are trying to compute. As best I can tell, you know the planes and axes of rotation of both A and B. Also, the rotation trajectory A(t) of point A is known as a function of time. The task isthen to compute B(t) subject to the constraint
norm(A-B)=X where X is also known a priori.

It seems to me like you can solve this analytically, rather than iteratively. In particular, the equations that B(t) must satisfy are

dot(N,B(t))=d; %equation for plane of rotation of B

(B(t)-A(t))'*(B(t)-A(t))=X^2; %B is fixed distance from A

(B(t)-Bc)'*(B(t)-Bc)=Rc^2; %Bc,Rc are the center and radius of rotation for B

This gives you 3 equations in 3 unknowns which you can use to solve for B(t). It is the intersection of 2 spheres and a plane.

Subject: iterative convergence technique for kinematic solution

From: jjspierx Spiering

Date: 2 Jun, 2010 13:20:08

Message: 7 of 10

"Matt J " <mattjacREMOVE@THISieee.spam> wrote in message <hu567d$b5a$1@fred.mathworks.com>...
> "jjspierx Spiering" <jjspierx@gmail.com> wrote in message <hu3vjp$f8c$1@fred.mathworks.com>...
> > 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.
> =================
>
> It's not entirely clear to me from the description what the given inputs are and what you are trying to compute. As best I can tell, you know the planes and axes of rotation of both A and B. Also, the rotation trajectory A(t) of point A is known as a function of time. The task isthen to compute B(t) subject to the constraint
> norm(A-B)=X where X is also known a priori.
>
> It seems to me like you can solve this analytically, rather than iteratively. In particular, the equations that B(t) must satisfy are
>
> dot(N,B(t))=d; %equation for plane of rotation of B
>
> (B(t)-A(t))'*(B(t)-A(t))=X^2; %B is fixed distance from A
>
> (B(t)-Bc)'*(B(t)-Bc)=Rc^2; %Bc,Rc are the center and radius of rotation for B
>
> This gives you 3 equations in 3 unknowns which you can use to solve for B(t). It is the intersection of 2 spheres and a plane.

What I am trying to do is plot the movement (not just end result) of 3 points. 2 of the points, A and B rotate about their own respective axis. Point C rotates about the Instant Axis created by the planes of rotation of points A and B. What I was originally doing, was described above by finding the instant center, and rotating the points about their own respective axis in order to keep the distance between them the same. I am fairly certain this was a "valid" way to do it, but it forced me to create an iterative approach to make this happen. I have since, figured out a better way to do it. Now I am finding the instant center, and then rotating points A, B and C a tiny increment about the IC. Then I recalculate the new IC created by points A and B moving, and I move another tiny increment, until I arrive at the desired location. I am rotating by an angle theta with each
iteration, and I simply decrease theta to increase the accuracy of the calculation.

Now, I know that points A and B technically still have to rotate about their own respective axis (since rotating them about the IC is only valid for infinitely small rotations as the IC constantly changes), so I verified that end result of the above technique, matches point coordinates for A and B if I rotate them around their respective axis as well. Thanks for the ideas! Both techniques work and give me the same results, but the 2nd way, allows me to easily fine tune the accuracy and doesn't require me to iteratively guess the correct angle.

Subject: iterative convergence technique for kinematic solution

From: Roger Stafford

Date: 2 Jun, 2010 18:27:20

Message: 8 of 10

"Matt J " <mattjacREMOVE@THISieee.spam> wrote in message <hu567d$b5a$1@fred.mathworks.com>...
> ........
> This gives you 3 equations in 3 unknowns which you can use to solve for B(t). It is the intersection of 2 spheres and a plane.
- - - - - - - - - -
  You would do well to follow up on Matt's excellent advice. You are starting with three equations in the cartesian coordinates of the unknown point. One of them is linear and two are second degree equations. By subtracting appropriately to eliminate the squared terms you can obtain a second linear equation from the two second degree equations. The solution to the two linear equations is a line in which you can express each coordinate linearly in terms of a common parameter. When you substitute these into one of the second degree equations, the result will be a quadratic equation with the single parameter as the unknown. As is true of all quadratic equations, it will have either two roots, one double root, or no real roots. As Matt has said, there is no need to use iteration to solve this elementary problem.

Roger Stafford

Subject: iterative convergence technique for kinematic solution

From: Walter Roberson

Date: 2 Jun, 2010 18:31:45

Message: 9 of 10

Roger Stafford wrote:
> When you substitute these into one of the second degree
> equations, the result will be a quadratic equation with the single
> parameter as the unknown. As is true of all quadratic equations, it
> will have either two roots, one double root, or no real roots.

Perhaps I missed an assumption in my reading, but

(X-1)*(X-5i) = X^2 - 5i*X - X + 5i is an example of a quadratic equation with
one real root that is not a double root

?

Subject: iterative convergence technique for kinematic solution

From: Roger Stafford

Date: 2 Jun, 2010 19:25:23

Message: 10 of 10

Walter Roberson <roberson@hushmail.com> wrote in message <hu684v$3br$2@canopus.cc.umanitoba.ca>...
> Roger Stafford wrote:
> > ...... As is true of all quadratic equations, it
> > will have either two roots, one double root, or no real roots.
>
> Perhaps I missed an assumption in my reading, but
>
> (X-1)*(X-5i) = X^2 - 5i*X - X + 5i is an example of a quadratic equation with
> one real root that is not a double root

  Thank you for catching me up, Walter. There was the tacit assumption made that the quadratic equation in question would have real coefficients, which of course is true for the problem.

Roger Stafford

Tags for this Thread

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us