Showing posts with label SVLab. Show all posts
Showing posts with label SVLab. Show all posts

Sunday, July 20, 2008

Codes for Blending Functions of NURBS

Recently I have been interested in computing the value of the blending functions of NURBS. I provided two codes for computing the blending functions here. One uses the recursive method and the other uses the non-recursive method.

Recursive Method
pros : Easier to implement; No need for extra loops
cons : Need extra memory for function calls

Non-recursive Method
pros : Faster than recursive method; No need for ask for extra memory for function calls
cons : Need an array and need to use for-loop

Files : main.m(for testing) , BlendingU.m(recursive) ,
BlendingFun.m(non-recursive)

In the following, I will show how to obtain Np3 (p=1,2,3, ..., 8) and get the plot of the Blending function which will be shown in the end. Note one can change the 3 to 1 and 2 to see the difference. I mean to obtain Np1 and Np2.

main.m
clear
clc

%% Knot vector & Normalization
U=[0 0 0 1 2 3 4 4 5 5 5];
U=U/max(U);

%% Non-recursive
for u=0:0.0001:1
for p=1:1:8
N=BlendingFun(p,3,u,U);
subplot(211),plot(u,N);hold on
end
end
hold off

%% Recursive
for u=0:0.0001:1
for p=1:1:8
N=BlendingU(p,3,u,U);
subplot(212),plot(u,N);hold on
end
end



BlendingU.m
%% Recursive method to compute the blending function
%% Pros : Easier to implement; No need for extra loops
%% Cons : Need extra memory for function calls

function N=BlendingU(n1,pp,uu,Ubar)

if pp==1
if uu>Ubar(1,n1) & uu<Ubar(1,n1+1)
N=1;
else
N=0;
end
else
N1N=BlendingU(n1,pp-1,uu,Ubar);
N2N=BlendingU(n1+1,pp-1,uu,Ubar);
N=0;
if N1N~=0 & Ubar(1,n1+pp-1)-Ubar(1,n1)~=0
N1=(uu-Ubar(1,n1))/(Ubar(1,n1+pp-1)-Ubar(1,n1));
N=N1*N1N;
end
if N2N~=0 & Ubar(1,n1+pp)-Ubar(1,n1+1)~=0
N2=(Ubar(n1+pp)-uu)/(Ubar(1,n1+pp)-Ubar(1,n1+1));
N=N+N2*N2N;
end
end



BlendingFun.m
%% None-recursive method to compute the blending function
%% Only the associated k elements in U are used in this function
%% Need a 1 by (1+k)*k*0.5 array, say ARRAY in this function
%% Pros : Faster than recursive method; No need for ask for extra memory for
%% function calls
%% Cons : Need an array and need to use for-loop

function N=BlendingFun(i,k,u,U)

U=U(i:i+k);
ARRAY=zeros(1,(1+k)*k*0.5);

for ind=0:1:k-1
if u>=U(ind+1) & u<U(ind+1+1)
ARRAY(ind+1)=1;
end
end

layer=2;
pt=k+1;

while layer<=k
for x=0:1:(k+1)-layer-1
if U(x+1+layer-1)-U(x+1)~=0 & ARRAY(pt+x-(k+1-layer)-1)~=0
ARRAY(pt+x)=((u-U(x+1))/(U(x+1+layer-1)-U(x+1)))*ARRAY(pt+x-(k+1-layer)-1);
end
if U(x+1+1+layer-1)-U(x+1+1)~=0 & ARRAY(pt+x-(k+1-layer))~=0
ARRAY(pt+x)=ARRAY(pt+x)+((U(x+1+1+layer-1)-u)/(U(x+1+1+layer-1)-U(x+1+1)))*ARRAY(pt+x-(k+1-layer));
end
if x==(k+1)-layer-1
layer=layer+1;
pt=pt+(k+2)-layer;
end
end
end

%% Return the last element of ARRAY
N=ARRAY((1+k)*k*0.5);



Saturday, September 8, 2007

The 2-Joint Robotic Manipulators



It has been 20 years or so since the end of 1980s on the research of the possible chaotic motions and bifurcation of the two-joint robotic manipulators. However, most studies mainly focus on the computer simulations and theoretical analysis. There are few to set up a real physical structure to observe its chaotic motion and bifurcation. In this case, I set up a real physical structure to do more research on it. Besides, in this project, it is worthy to note that only the first manipulator is actuated.

The video clip above shows the chaotic motion of this system. For more details, check the following report which can not be copied and spread with the authors' permission.

Full Article : click me

Robotics Operating System?



Full Article : http://www.spectrum.ieee.org/aug07/5391

(c) Adapted by http://www.spectrum.ieee.org/aug07/5391

Compared with the Microsoft's billion-dollar businesses—Windows, MSN, Xbox, and more, we don't hear much about the development of robotics. But indeed, the company has undergone a project which involves 11 of its 76000 employees to create Robotics Studio 1.0.

For now, the robotics world is rife with devices that don't easily work together or with standard programming tools. Take the Create for example. The Create is a generalized, programmable version of the popular Roomba vacuum-cleaning robot. To manipulate it, you have to write C or C++. If you want to add some additional devices to it, you still have write more code to integrate it on to the robot. Moreover, if you swap out the unit to a different kind of robot, you have to reprogram it all over again. It seems really troublesome, doesn't it?

Good robotics programming is far harder than writing a typical application for personal computers. Each component is expected to act autonomously and react to complicated events in the world of a kind that a printer or mouse never has to deal with.

Robotics Studio, released in December, aims to handle much of that complexity for robot programmers. It isn't an operating system. But manufacturers will use it to write software for their robotic components much as a maker of a device that hooks up to a PC does, whether it's a printer, an LCD display, or a data-acquisition sensor. Once such a service is written—telling, for example, a robotic arm to move up or down, grip or release, rotate n degrees, and so on—the action can be done with a single instruction. And when you substitute a new arm, the same commands work in the same way, so a minimum of reprogramming is needed. Microsoft's software, in other words, will do what MS-DOS and then Windows did: nurture an ecosystem in which new devices spawn new programs for more and more end users who in turn inspire yet more innovation—the same virtuous cycle that brought explosive growth to the cottage PC industry 25 years ago.

Are ubiquitous robots, dreamed of for millennia, in our immediate future, or are they still a number of years over the horizon? At least the world Mundie imagined seven years ago is here, with data centers filled with multiprocessor servers and desktops everywhere sporting multicore personal computers for less than $2000. We're about to see whether the other half of his and Trower's and Gates's vision is correct. Will the new processors lead us away from PCs and toward a future filled with robots—robots running Microsoft's software?