You are on page 1of 50

| 

  
  
 

R  
   
      
]   
Introduction to Carotte
— R 
î  
  

 


 



 

!
 
   "
#
Introduction to Carotte
—  R$%&%$%
 ©  


  
    
  

   

  
 
 


  !     
"#
 © 
    

   #
 © 
  
  $
 %&'(%)*$++©,-.'/-01++.-2'+'&-)-©,-&0&-).+(-'&3&--%#
 %&'(%) $-2,.'/1++.-2'+'&-).4)55-&-%©2'+'&%)++©,&--2'+'&0-/0©0#

 © 
  
&3. 
$
 %&'(%)*$©,-'.6-2©01++.-2'+'&-)07-&©,-+&3-.'/#
 %&'(%) $0©,-&-&-* '.6-2©05'(&'.6-2©01++,8-09-2'+'&9:%3©,&--0-©0'55'(&
09+&'.6-2©0#
Introduction to Carotte
   

— © e dimensions of t e ROBO©
s ouldn¶t exceed 18cm x 18cm .
© ere is no limit on eig t.

— ©ry to put a color tag (minimum


8cm x 8cm) on top of t e robot so
t at you ave idea about t e
position of t e robot.
Introduction to Carotte
   è
© e arena will ave 12 similar objects aving same
color .
 © e robot as to detect t e object, find a s ortest pat to
t e object and put t en put it t e large box.
 W en one object is in old of t e robot , t en t e robot
s ouldn¶t interfere wit any ot er object in it¶s pat .
 © e team wit maximum objects in t e box wit in a
time interval of 20 min will be qualified for t e next
round.
 © e arena for round one is s own in t e next page.
Introduction to Carotte
6
Introduction to Carotte
   ¦
 |IMILAR ©O ©A© IN ROUND 1, WE WILL AVE 12 IDEN©I
CAL OBJEC©| PLACED IN ©E ARENA. ©E ONLY
DIFFERENCE ERE I| ©A© WE WILL AVE ©EM
COLORED IN RBG IN EQUAL NUMBER
 ©E ROBO© ERE A| ©O DE©EC© ©E COLOR OF
OBJEC© AND ©E COLOR OF ©E LARGE BOX IN WIC
I© A| ©O DROP ©I| BOX.
 ©E MAIN AIM WOULD BE ©O :
 MAKE |URE ©E ROBO© DE©EC©| ©E COLOR OF OBJEC© AND
BOX
 FIND |OR©E|© PA©, ©E |OR©E|© FROM ©EN PO|I©ION
©O ©E OBJEC© AND LA©ER FROM OBJEC© ©O ©E LARGE BOX.
 ©E ©IME DURA©ION FOR ©I| ROUND WILL BE 20 MIN.
Introduction to Carotte
8
ÿ  
x Controlled rotation required --
--------

| 


 are preferred
| 



xMore precise t an DC motor

xMeasured rotation and can be eld at a


particular position

xAlignation is muc better in differential drive


| 



xMore precise t an DC motor

xMeasured rotation and can be eld at a


particular position

xAlignation is muc better in differential drive


| 



 
º
 | 


mmmmmmmm  
    
         
 
 


x ©      

x      


          

x ©        


    

x          


    
a. |ingle-Coil Excitation ±
Eac successive coil is energized in turn.
|ingle coil excitation continue««

ÔÔ Ô

Ô ÔÔ

ÔÔÔ

ÔÔÔ
b. ©wo-Coil Excitation ± Eac successive
pair of adjacent coils is energized in turn.
0011 0110 1100 1001

À 
©  
     
  
  
©  
     
  
  
         
  
© e Coil Diagram
1000 1100 0100 0110 0010 0011 0001 1001

ÔÔÔ ÔÔ

ÔÔÔ
ÔÔ

ÔÔÔ ÔÔ

ÔÔ ÔÔÔ
|   

            


 
|
 
 ! " #   $ % 
 ! "& #   $ % &
 ! "' #   $ % (
 ! "( #   $ % )
|
 &
 ! " #   $ % *
 ! "& #   $ % '&
 ! "' #   $ % *(
 ! "( #   $ % &)
+,  

         


 
|

! " -& #   $%'
 ! "& -' #   $%*
 ! "' -( #   $%&
 ! "( - #   $%.
|
&
 ! " -& #   $%()
 ! "& -' #   $%.*
 ! "' -( #   $%.&
  ! "( - #   $%((
ÿ ,  

         


 
|

! "#  $%
! "-&#  $%'
 ! "&#  $%&
 ! "&-'#  $%*
 ! "'#  $%(
 ! "( -'#  $%&
 ! "(#  $%)
 ! "-( #  $%.
|/0#       /  1112
Comparison

— |   — Ñ  

— d   — ÿ 

—    
—   

— !    
— !   
25-way Female D-©ype Connector
PC parallel Port

— © e PC's Parallel Printer Port ad a total of


12 digital outputs and 5 digital inputs accessed via 3
consecutive 8-bit ports in t e processor's I/O space.
— 8 output pins accessed via t e Ñ  

— 5 input pins (one inverted) accessed via t e | º|


— å output pins (t ree inverted) accessed via t e
6  

— © e remaining 8 pins are grounded
|©EPPER DRIVER BOARD
Circuit Requirements«««««««

Ñ
: ©akes n inputs and gives 2 outputs .
«..«t e n inputs from t e parallel ports could
be used to generate 2 combination of outputs
to excite t e coils of stepper motors.
An introductory talk on Matlab

R         

   
         
  
 
©opics of discussions«
— u 12333

— ,## //-   2

—  4/"2/ $2

— | / 5 # 2

— | 6666
 

— ’   ! 7
44 
# #
 /482
— ’   "’ 9  0$/ #
# /4  /   :4   
 4//444 2
— ’    #   /    
0    /# / 0  5
     4//4
44 # ;<<;= 2
© e MA©LAB User Interface
O  
 

|ome points we s ould remember w ile start learning matlab««


x No need to define variables data type.
x One Variable can ave more t en two data types.
x By default matlab create ³!  as Most recent answer if expressions
! š
are not assigned to anyt ing else.
x Variable names can contain up to 63 c aracters (as of MA©LAB 6.5 and
newer) .
x Variable names must start wit a letter followed by letters, digits, and
underscores.
x If a statement is terminated wit a semicolon ( ; ), no results will be
displayed. Ot erwise results will appear before t e next prompt.
x By default matlab use å digits rounding after decimal.
ÈÈ a = 12 x Basic operator : ³ + š , š - š , š * š
,š/š
a=
x ³clcš : Clear command window.
12
CLC clears t e command
ÈÈ a = 12;
window and omes t e cursor.
ÈÈ a = 23.23å2å;
x ³ omeš :|end t e cursor ome.
ÈÈ a OME moves t e cursor to t e
a= upper left corner of t e
23.23å2 window.
ÈÈ a = 'swe' x ³w oš :List current variables.
a= x ³w osš: WO| is a long form
swe of WO. It lists all t e
ÈÈ a variables in t e current
=23å872387å 813 732 21 å2; workspace, toget er wit
ÈÈ a information about t eir size,
a= bytes, class, etc.
2.3å87e+02å x ³clearš :Clear variables and
functions from memory.
CLEAR delete all t e variable
w ic are present in
|ome special variables«.!!!

—
Mat ematical and logical Operators

— Power : a^b , a.^b


— Multiplication : a*b , a.*b
— Division : a/b , a./b
— \ or .\ are used w ile calculating solution of t e equation
A*x = b ; x = A\b = b/A;
— ~ : Logical NO©
—  : Element-wise logical AND
— | : Element-wise logical OR
—  : | ort-circuit logical AND
— || : | ort-circuit logical OR
— È= , <= , == ,~= , È , < t ese are relational operators.
for more detail : type elp ~
.m Files in matlab

© ere are two kinds of M-files:


— |  , w ic do not accept input arguments or
return output arguments. © ey operate on data in
t e workspace.
— M 
 , w ic can accept input arguments and
return output arguments. Internal variables are local
to t e function.

6 
   
.m Files in matlab

— M 
 : click on ³create new .m fileš
— function [output] = <function nameÈ(input)
— like function [a,b,c,«..] = multi(A,B,C)
Matrices in matlab
ÈÈ a = [1 2 3 å 5] Any floating point number is a
a=
matrix of size(1x1).
1 2 3 å 5
For writing a matrix we ave
ÈÈ a = [1,2,3,å,5] to use ³[³ š]š.
a=
A vector is also a matrix , can
1 2 3 å 5
ÈÈ a = [1;2;3;å;5] be a row matrix or a column
matrix.
a=

1 We can write a vector in 2


2
3 different ways
å
5
Matrices in matlab
— Operations and functions for matrices(suppose ³aš is a matrix)
1. transpose(a) = a¶;
2. identity matrix of size n = eye(n);
3. inverse(a) = inv(a) = eye(n)/a ((solution of a*b = eye(n));
å. size of a matrix = size(a);
5. A matrix wit only zeros(of size nxm) = zeros(n,m);
6. A matrix wit only ones(of size nxm) = ones(n,m);
7. Determinant of a matrix = det(a);
8. RREF of a matrix = rref(a);
. |quare root of a matrix = sqrtm(a);
10. rank of a matrix = rank(a);
11. If a is a vector t en maximum element is = max(a)  minimum element = min(a);
12. Diagonal of a matrix = diag(a);
13. norm of a matrix = norm(a);
1å. random matrix = rand(n,m) or randn(n,m);
15. Eigenvalues and eigenvectors of a matrix = [eigval , eigvec] = eig(a);
|ome known functions in Matlab.

— factorial(n) : factorial of number µn¶;


— diff(f,<orderÈ) : differentiation of a function;
— int(f) : integration of a function µf¶;
— magic(n) : Magic square of size nxn;
— sort(x) : |ort in ascending or descending order;
— power(a,b) : .^ Array power;
— trace(a) : |um of diagonal elements;
— gcd(a,b) : Greatest common divisor(lcm(a,b));
— roots(c) : Find polynomial roots;
— save : save workspace variable to file(.mat format);
Plot/Figure/|urface
Plot/Figure/|urface
— plot(X,Y) : plots vector Y versus vector X;

— Plot3(X,Y,Z) : Plot lines and points in 3-D space;

— zoom(factor) : Zoom in and out on a 2-D plot;

— surf(A) : 3-D colored surface;

— ezplot(FUN) : plots t e function FUN(X) over t e default


domain -2*PI < X < 2*PI;
— ezplot3(fx,fy,fz) : plots t e spatial curve fx(©), fy(©), and
fz(©) over t e default domain 0 < © < 2*PI;
— ezsurf(f) : plots a grap of t e function f(x,y) using surf;
|olving
— solve(eq1,eq2,..) : |ymbolic solution of algebraic
equations.
— dsolve(eq1,eq2,..) : |ymbolic solution of ordinary
differential equations.
— And muc more««««.
For any elp type
elp<spaceÈ<function nameÈ

like elp rref


For finding t e functions related to some
keyword type
lookfor<spaceÈ<functions properties È
like lookfor plot
For more info.
x 

|
  x 
  x   

x 
 !!"!
  x #
  x  $$% & '(

x 
  '
O   x )
O  x  &&&&%
QUE|©ION|«.????