Professional Documents
Culture Documents
This talk:
Motor
Basics
Ro
"$en %a
Ro
Motors+ Physics
Motor 'indings have a fi3ed resistance 4ignoring heating5 6oltage differential on &otor leads ca*ses c*rrent to flo'. 4"h&)s la'5 Magnetic field $ro$ortional to c*rrent Tor7*e $ro$ortional to &agnetic field strength 4and th*s c*rrent5 Tor7*e ca*ses rotor to egin rotating.
Which
is the voltage 'e *sed 'hen deter&ining ho' &*ch c*rrent flo's
Motors as #nd*ctors
Another co&$lication: &otors 'indings are ind*ctors #nd*ctors o$$ose changes in c*rrent
They
store energy When c*rrent 'o*ld other'ise change, ind*ctors eco&e voltage so*rces s*ch that the c*rrent re&ains constant
69%d#.dt
9= d#.dt 9 infinity This &akes 6 1really ig2 Makes a ig s$ark so that dt isn)t 7*ite =
,on)t *n$l*g a r*nning &otor ,on)t ra$idly change the voltage on a &otorA slo'ly increase.decrease it to avoid a c*rrent s$ike
When
accelerating, accelerate in a co*$le ste$s: @BC for D= &s, B=C for D=&s, EBC for D=&s, then F==C. This goes for changing direction and decelerating too8 Go*r 'heels are less likely to sli$ too8
Po'ering Motors
$ins *s*ally can so*rce.sink H F=&A $ins are 1F2s and 1=2s
*P
Motors: -+ ridges
Vmotor
Motor
-+ ridge allo's idirectional control A I , on: for'ard C I B on: ack'ards A I B on or C I , on: horri le8 "*r -+ ridges have direction ? ena le What 'o*ld B I , on do0
Motors: PWM
-o' do 'e r*n at fractional $o'er0 Consider ra$idly toggling -+ ridge on I off
K=C $o'er0
Scenario:
Motor 'ill r*n f*ll last for F@ ho*rs, then sto$ for F@ ho*rs
of ti&e it takes for rotor to achieve MD.@C of its final velocity after a ste$ in$*t.
of ti&e it takes for c*rrent to achieve MD.@C of its final val*e after a ste$ in$*t with rotor locked in position.
Motor drivers take ti&e to s'itch. #f $eriod is too short, drivers 'ill s$end the 'hole ti&e s'itching and not cond*cting 9: lo' efficiency.
Mechanical ti&e constant N F= &sec Electrical ti&e constant: N F &sec PWM must e faster than &ech ti&e constant, or &otor 'ill vi rate (aster than electrical ti&e constant ens*res PWM 'avefor& is effectively an analog voltage
Why
do 'e care0
Avoid fre7*encies H @=O-> d*e to h*&an hearing8 4&agnetostriction5 Avoid fre7*encies : driver s'itching fre7*ency 4NF==O->05
C*rrent Sensing
Tells yo* ho' &*ch torque the &otor is $rod*cing. Pot directly related to angular velocity
,e$endent
on terrain8
Back EM(
&*st e >ero
M*st disconnect $o'er and 'ait8 4a co*$le electrical ti&e constants5 "RC oard can &eas*re, *t re7*ires great care and s$ecial ca le.
Tacho&eter
Add an additional little &otor to the o*t$*t shaft 'ith very lo' inertia This &otor generates a ack EM( This voltage $ro$ortional to rotational velocity.
Si&$le Encoders
Attach a disk to the &otor shaft and attach a reak+ ea& sensor across the teeth.
time
"*t$*t of Encoder
"r, *se a reflectivity sensor and a disk 'ith lack I 'hite colored 'edges. Are 'e going for'ards or ack'ards0
time
time
(or'ard
Back'ard
Servo Motors
Servo &otors seek and hold a s$ecific angle a*to&atically8 -ave integrated gearhead I control electronics !se PWM as interface8
-*h0
A o*t FJ= degrees of rotation, to 'ithin NF degree Pretty good tor7*e, *t take it easy on the&8
Po'er dissi$ation can e ad Plastic gears are 'i&$y #nter&ittent d*ty only
PWM is not *sed in the sa&e 'ay as nor&al &otors. Servo *ses PWM to *ild an analog voltage that is co&$ared to a $otentio&eter on the o*t$*t 4feed ack5. S*st send a PWM 'ith a d*ty cycle $ro$ortional to the desired angle8 P*lse 'idths that are too short.long ca*se servo to shake violently8
Pot
"ther Act*ators
Solenoids M*scle Wire Chea$ si&$le ,C &otors 4B or F@65 Electro&agnetic Hsoðing: An act*ator ? a s$ring is a different act*ator !se &echanical advantages 'hen yo* can: levers, $*lleys, ra&$s, 'inches Servos have a fair a&o*nt of tor7*e for a &otor their si>e, *t can easily e over'orked8 ,esign so that act*ators e3$end $o'er only intermittently!
Ro ot Control Strategies
-o' do yo* &ake yo*r ro ot do 'hat yo* 'ant0 Co&&on design: *ild ehaviors, then coordinate ehaviors fro& a 1$lanner2
Control Logic
Turn
Go Straight
Follow Wall
Close Claw
Control Strategies
E.g., #f #)& looking for a target and # hit a 'all, t*rn right.
Presents so&e a ility to co$e 'ith the *n*s*al B*t still can)t co$e 'ith things you haven)t considered
A# Planner
Might e a le to fig*re a 'ay o*t of a ind that yo* hadn)t considered. Co&$licated, so&eti&es slo'. Assigning scores to agree 'ith ho' yo* 'o*ld decide can e really hard.
Control Strategies
-y rid
Co&
the first &in*te, r*n the 1find a target2 (SM (or the second &in*te, r*n the 1search for and go to a scoring area2 Release the target (or the third &in*te, try to go ho&e
Philoso$hy of Control
Ono' Everything
1My c*rrent $osition is 4@.M,D.E5, #)& facing e3actly east. There)s a target ehind &e at 4F.B,D.M5 and a 'all et'een *s. The follo'ing series of $recise &oves 'ill get &e there.2 Ro ot &aintains a lot of state 4infor&ation a o*t the 'orld5
Very $o'erf*l. Very hard. 1/ee, /eorge. That s*re is a $retty target over there. M&&&, $retty red color. # sho*ld go there.2 4LlaterL5 1Ah, # have a red thing. # feel ha$$y. B*t #)d feel ha$$ier if # sa' so&e yello' right a o*t no'L so #)ll s$in82 Pot &*ch state to &aintain.
Ono' Pothing
as &*ch state as yo* can, *t *nderstand the &argin of errors in yo*r state and take this into acco*nt. E3$ect to e 'rong. Maintain only a little state. ,o lots of 'andering, *t try to re&e& er 'here yo*)ve e3$lored so yo* &a3i&i>e the gro*nd yo*)ve covered. /ather infor&ation a o*t $artic*lar $laces. When yo* get to one, kno' ho' to recogni>e it. Then fig*re o*t 'hat the ne3t fe' things yo* sho*ld try to do are. As yo* 'ander, yo*)ll get lostA ada$t and si&$lify yo*r $lan ased on what goes 'rong.
B*ilding Behaviors
E3a&$le:
F. @. D.
#f #)& getting farther a'ay fro& the 'all, t*rn a *nit to the right #f #)& too close to the 'all, t*rn a *nit to the left /o for'ard a it, then ack to ste$ F.
What if 'e)re getting farther a'ay fro& the 'all 4a 'heel is sli$$ing, for e3a&$le5 faster than 'e are t*rning to the right0
Co&$*te so&e f*nction of error, and *se this to deter&ine ho' shar$ly 4and in 'hat direction5 to t*rn.
Rich
P#, control
#f yo*)re really far a'ay fro& the 'all, t*rn shar$ly. #f yo*)re only slightly veering, t*rn <*st a it.
That)s Pro$ortional
#f yo*)re ra$idly getting farther a'ay fro& the 'all, start t*rning harder.
That)s ,erivative
#f, des$ite yo*r efforts, yo* kee$ getting farther a'ay for a long ti&e, start t*rning harder.
That)s #ntegral
T*rnrate9C$e ? Ci Te ? Cdde.dt ,iscrete+ti&e calc*l*s This is act*ally 'hat a servo &otor does to hold a $artic*lar angle
Patches co&e o*t $eriodically. Each version is ti&e sta&$ed. E.g., orc=F=J=D.tg>. Co$y it so&e'here *sef*l !ntar it 4tar ;3>vf orc=F=J=D.tg>5 Edit.co$y the hello'orld e3a&$le to get started 7*ickly
%argely self e3$lanatory #t)s 'orth sitting do'n and reading thro*gh
/etting started
Go*
&*st call orcUinitiali>e45 efore anything else. Go* &*st link 'ith li orc.a after yo*r .o files
E.g.: g?? ;o &y$rogra& &ain.o li orc.a !se g??, not gcc
"RC Co&&*nication
transaction can take :F=&s %ost o$$ort*nity for co&$*tation Consider doing co&&*nication asynchronously or heavy co&$*tation in se$arate thread.
%C, co&&ands
AP#:
orcUlcd-o&e orcUlcdPrint, orcUlcd/oto
orcUlcdPrintf
Analog Co&&and
AP#:
orcUanalog orcUanalogSetResol*tion orcUanalogSetMa3Port orcUc*rrentSense
,igital Co&&ands
AP#
orcU
yo* $l*g in sensor that o*t$*ts a val*e into a digital o*t $ort, yo* can da&age yo*r "RC. Ask a TA if yo* need this, and al'ays e caref*l8
Motor Co&&ands
AP#:
orcU&otorPWM orcU&otor,ir
Motors are inde3ed VF,KW; different than other $orts 'hich are V=,3W8 !se sy& olic directions: MOTOR_FORWARD
MOTOR_R!V!RS! MOTOR_BRA"!
These
&ay not corres$ond to 1for'ard2.2 ack'ard2 for yo*r ro ot Motors have different strengths for'ard and ack'ard
Servo Co&&ands
AP#:
orcUservoPWM orcUservoSetProfile orcUservoSeek hitecD==$rofile
Servos sho*ld not e seeked o*t of range for e3tended $eriods of ti&e 4:@ seconds05 Servos s*$$ort profiles, allo'ing yo* to s$ecify an angle, rather than a $*lse 'idth.
P*rely
!ltraso*nd Co&&ands
AP#:
orcU*ltraso*ndPing orcU*ltraso*ndRead
Can only *se one *ltraso*nd at a ti&e M*st 'ait for the sonar to echo efore reading8
F@6 %ead Acid Battery, B Ah Battery recharges 'henever "RC is $l*gged into AC I attery is connected Recharging attery can *se lots of c*rrent
,on)t
dee$ly discharge attery. #t)s ad for it any'ay8 ,isconnect geode if reg*lator gets hot
That frees *$ =.EA for attery charging8
#f
reg*lator still too hot, disconnect attery. Recharge 'ith a ench s*$$ly.
#&&ediately tin 4cover 'ith solder5 ne' ti$s. When soldering, if ti$ isn)t shiny, it needs to e cleaned
S$onge Re+tin
Oee$ solder on ti$ 'hen storing to $revent o3idation of ti$ Pever, ever, shar$en the ti$8
Ti$
it8
Talk
to yo*r advisor8