Professional Documents
Culture Documents
on
S.No. TOPIC
1 Introduction
5 Introduction to Project
The project deals with a robot that locates and follows a ball across mounted with
a web camera above and being controlled by a pc.
The robot specified uses a Atmel microcontroller ATMega16 with a web camera
mounted on it which is having video stream in a running mode where actually it
sees the ball and where ever the ball is moving it just follows it automatically
without any external control.
For using a web cam we need to include a software which is MATLAB, it helps in
taking images in current stream and allows camera to locate the ball and follow it
using the concept of threshold.
Introduction to Robot and Robotics:
Robotics - Robotics is the science and technology of robots, and their design,
manufacture, and application. Robotics is related to electronics, mechanics, and
software.
Although the appearance and capabilities of robots vary vastly, all robots share
the features of a mechanical, movable structure under some form of autonomous
control. The structure of a robot is usually mostly mechanical and can be called a
kinematic chain (its functionality being similar to the skeleton of the human body).
The chain is formed of links (its bones), actuators (its muscles) and joints which
can allow one or more degrees of freedom. Most contemporary robots use open
serial chains in which each link connects the one before to the one after it. These
robots are called serial robots and often resemble the human arm. Some robots,
such as the Stewart platform, use closed parallel kinematic chains. Other
structures, such as those that mimic the mechanical structure of humans, various
animals and insects, are comparatively rare. However, the development and use
of such structures in robots is an active area of research (e.g. biomechanics).
Robots used as manipulators have an end effector mounted on the last link. This
end effector can be anything from a welding device to a mechanical hand used to
manipulate the environment.
Components of robots
Actuation
• Motors: By far the vast majority of robots use electric motors, of which
there are several kinds. DC motors, which are familiar to many people,
spin rapidly when an electric current is passed through them. They will
spin backwards if the current is made to flow in the other direction.
• Stepper motors: As the name suggests, stepper motors do not spin
freely like DC motors, they rotate in steps of a few degrees at a time,
under the command of a controller. This makes them easier to control, as
the controller knows exactly how far they have rotated, without having to
use a sensor. Therefore they are used on many robots and CNC
machining centres.
Manipulation
Robots which must work in the real world require some way to manipulate
objects; pick up, modify, destroy or otherwise have an effect. Thus the 'hands' of
a robot are often referred to as end effectors, while the arm is referred to as a
manipulator. Most robot arms have replaceable effectors, each allowing them to
perform some small range of tasks. Some have a fixed manipulator which cannot
be replaced, while a few have one very general purpose manipulator, for
example a humanoid hand.
A simple gripper
The study of motion can be divided into kinematics and dynamics. Direct
kinematics refers to the calculation of end effector position, orientation, velocity
and acceleration when the corresponding joint values are known. Inverse
kinematics refers to the opposite case in which required joint values are
calculated for given end effector values, as done in path planning. Some special
aspects of kinematics include handling of redundancy (different possibilities of
performing the same movement), collision avoidance and singularity avoidance.
Once all relevant positions, velocities and accelerations have been calculated
using kinematics, methods from the field of dynamics are used to study the effect
of forces upon these movements. Direct dynamics refers to the calculation of
accelerations in the robot once the applied forces are known. Direct dynamics is
used in computer simulations of the robot. Inverse dynamics refers to the
calculation of the actuator forces necessary to create prescribed end effector
acceleration. This information can be used to improve the control algorithms of a
robot.
Requisites of Project
Software used:
BASCOM-AVR
MATLAB
Programming language:
Key Features
• High-level language for technical computing
• Development environment for managing code, files, and data
• Interactive tools for iterative exploration, design, and problem solving
• Mathematical functions for linear algebra, statistics, Fourier analysis,
filtering, optimization, and numerical integration
• 2-D and 3-D graphics functions for visualizing data
• Tools for building custom graphical user interfaces
• Functions for integrating MATLAB based algorithms with external
applications and languages, such as C, C++, Fortran, Java, COM, and
Microsoft Excel
Hardware used:
$regfile = "m16def.dat"
$crystal = 4000000
$baud = 9600
$prog &HFF , &HC3 , &HD9 , &H00 ' generated. Take care that the
chip supports all fuse bytes.
Config Lcd = 16 * 2
Config Lcdpin = Pin , Db4 = Portb.4 , Db5 = Portl = B.5 , Db6 = Portb.6 , Db7 =
Portb.7 , E = Portb.3 , Rs = Portb.2
Dim A As String * 10
Start Adc
Start Timer1
Cls
Do
A = Waitkey()
If A = "l" Then
Cls
Print " moving left "
Lcd "left"
Lowerline
Lcd "NEXTSAPIENS"
Pwm1b = 0
Portd.3 = 0
Pwm1a = 200
Portd.6 = 0
Waitms 180
Pwm1b = 0
Portd.3 = 0
Pwm1a = 0
Portd.6 = 0
Pwm1b = 0
Portd.3 = 0
Pwm1a = 0
Portd.6 = 0
Pwm1b = 0
Portd.3 = 0
Pwm1a = 0
Portd.6 = 0
End If
Loop
End
Code for making a ballfollower robot using color recognition principle
function ballfollower
pause(1)
Vid=video input(‘winvideo’);
Preview(vid);
Im=get snapshot(vid);
%vfm('show');
v%fm('preview');
%Im=vfm('grab');
[a b c]=size(im);
im1=im(:,:,1);
im2=im(:,:,2);
im3=im(:,:,3);
for m=1:a
for n=1:b
if(im1(m,n)>80 && im1(m,n)<160 && im2(m,n)>40 && im2(m,n)<80
&& im3(m,n)<75 && im3(m,n)>40)
I(m,n)=1;
else
I(m,n)=0;
end
end
end
[x,y]=centroid(I)
X=160;
Y=120;
Xmin=X-40;
Xmax=X+40;
Ymin=Y-40;
Ymax=Y+40;
ser=serial('com6');
fopen(ser);
if (x<Xmax && x>Xmin)
if(y<Ymax && y>Ymin)
fprintf(ser,'s');
disp('success!!!');
else if(y<Ymin)
fprintf(ser,'f');
else if(y>Ymax)
fprintf(ser,'b');
end
end
end
else if(x<Xmin)
fprintf(ser,'l');
else if(x>Xmax)
fprintf(ser,'r');
end
end
end
fclose(ser);
Explanation
First of all for running the function it is necessary to calibrate I.e. know the exact
values of pixel elements of the ball to be followed.
This is done by capturing the image of ball and checking the value of its pixels
at various points bu using command imview
Imview(i)
Shows the image just like imshow
But it also displays the value of pixel where the cursor is currently located at the
bottom of the screen.
For more accuracy take atleast ten images at different angles and find minimum
and maximum pixel value for the ball and put it in the code given.
The camera attached to the robot takes images at frequent intervals and
processes it by converting the image to binary image such that image is white if
pixel value lies in desired range and black otherwise.
Next we determine the centroid of the image so that robot moves towards the
centroid as found out.
The algorithm for finding the centroid is self explanatory .
Next after finding the centroid we open the serial port for communication with the
robot. This is achieved by command
Ser(’com1’);
Fopen(ser);
Note:- after your work with serial port is over always close the port using
command fclose(ser);
When the serial port is open and we know the centroid, we send the direction to
be followed by robot over the serial port and the robot follows accordingly when
programmed as a simple pc controlled algorithm.