⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 introductionhardwaresoftwareresu.htm

📁 机器人应用的全套实例寻机小车
💻 HTM
📖 第 1 页 / 共 5 页
字号:
  80.  When they output low, as it does over dark paper, the ADC reading is 
  never above 40.  If every sensor is giving a reading above 80, then the 
  car is over white paper and does not move.  If any one of the sensors 
  reads below 40, then the program turns on the rear motors first and then 
  transitions to state <I>straight</I>.&nbsp; </FONT></SPAN></P>
  <P class=MsoNormal style="TEXT-INDENT: 0.5in"><SPAN 
  style="FONT-FAMILY: Palatino Linotype"><FONT size=4>We use the timer0 PWM to 
  power the rear motors.&nbsp; Fast PWM mode is enabled and the compare output 
  mode is set to clear OC0 when the timer0 counter equals OCR0, and to set OC0 
  at top.&nbsp; With the timer0 clock set at a prescaler of 256 and OCR0 set to 
  128, we will get a PWM signal with a period of 256/16MHz x 256 = 4 msec and a 
  duty cycle of 50%.&nbsp; The PWM waveform is output through port B3, which is 
  connected to the gate of the two BJTs that turn on the rear motors.&nbsp; 
  Therefore, the rear motors turn on and off in equal measure.&nbsp; 
  </FONT></SPAN></P>
  <P class=MsoNormal style="TEXT-INDENT: 0.5in"><SPAN 
  style="FONT-FAMILY: Palatino Linotype"><FONT size=4>While the car is moving, 
  the program returns to reading the sensors.&nbsp; A full sweep of the three 
  sensors reveals any changes in the course of the path.&nbsp; In general, a low 
  output from one of the two non-center sensors and a high output from the other 
  reveal a turn.&nbsp; For left turns, the program sends a high signal to 
  transistors 3 and 4 while for right turns, transistors 5 and 6 turn on.&nbsp; 
  Immediately afterwards, the program transitions into state <I>left_turn </I>or 
  state <I>right_turn</I> depending on the turn.&nbsp; In either state, if the 
  sensors detect that the middle sensor is not over a path, the car will 
  continue to turn.&nbsp; As a self-adjusting measure, the program checks if the 
  other non-centered sensor every outputs low.&nbsp; If so, then the car has 
  turned too much in one direction and will start to turn in the other 
  direction.&nbsp; Once the middle sensor reads low again, the car will stop the 
  steering motor and return to state <I>straight</I>.&nbsp; If all three sensors 
  read high, the program will turn off the PWM and transition to state 
  <I>stop</I>.&nbsp; </FONT></SPAN></P>
  <P class=MsoNormal style="TEXT-INDENT: 0.5in" align=center><IMG height=400 
  src="IntroductionHardwareSoftwareResu.files/state_machine_2.bmp" width=640 
  border=0></P>
  <P class=MsoNormal style="TEXT-INDENT: 0.5in" align=center>Figure 6: State 
  Machine for Car Movement</P>
  <P class=MsoNormal><I><SPAN style="FONT-FAMILY: Palatino Linotype"><FONT 
  size=4>&nbsp;Issues: </FONT></SPAN></I><SPAN 
  style="FONT-FAMILY: Palatino Linotype"><FONT size=4>We had a number of issues 
  reconciling how we wanted the program to work with the mechanics of the toy 
  car.&nbsp; The car’s speed became the first issue we encountered.&nbsp; In an 
  earlier version of the program, we sent the motor a constant logical high 
  signal.&nbsp; During testing, we noticed that the car would travel so fast 
  that it would overshoot turns.&nbsp; The sensors would detect the turn but by 
  the time the program could initiate a turn, the car had already driven off the 
  road and would stop.&nbsp; At Professor Land’s suggestion, we instead used the 
  PWM to drive the rear motors.&nbsp; This slowed the car to half its original 
  speed, which is not surprising considering our PWM waveform’s 50% duty 
  cycle.&nbsp; </FONT></SPAN></P>
  <P class=MsoNormal><SPAN style="FONT-FAMILY: Palatino Linotype"><FONT 
  size=4>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
  Slowing the car allowed more time for the program to react to turns but the 
  car’s inherent turning radius is fairly wide.&nbsp; The car was likely to go 
  off the road and stop even at the slower speed.&nbsp; The program addresses 
  this by initiating a turn first and then waiting 1.5 seconds before reading 
  the sensor data again.&nbsp; The car will therefore continue to turn during 
  the delay even if it has gone off the road; this hopefully gives the car 
  enough time to readjust itself to the course.&nbsp; </FONT></SPAN></P>
  <P class=MsoNormal><FONT size=4><SPAN 
  style="FONT-FAMILY: Palatino Linotype">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
  </SPAN></FONT><A 
  href="http://instruct1.cit.cornell.edu/courses/ee476/FinalProjects/s2007/bl222_wh84/bl222_wh84/index.html#top">Back 
  to Top</A> </P></BLOCKQUOTE></DIV>
<H1><FONT face="Palatino Linotype"><A id=res></A>Result</FONT></H1>
<BLOCKQUOTE>
  <P class=MsoNormal 
  style="TEXT-JUSTIFY: inter-ideograph; TEXT-INDENT: 0.5in; TEXT-ALIGN: justify"><SPAN 
  style="FONT-FAMILY: Palatino Linotype"><FONT size=4>The car is able to follow 
  a straight path without much trouble.&nbsp; It performs less well on turns, 
  particularly turns sharper than 45°.&nbsp; The turn radius of the car is not 
  wide enough for it to consistently make sharp turns.&nbsp; The car can make 
  turns wider than 45°, especially with the 1.5 second delay added.&nbsp; 
  However, one will notice after making a turn, the car will oscillate around 
  the track rather than follow it completely straight.&nbsp; Due to the car’s 
  tendency to overshoot the track and then turn back into it, the car turns back 
  to the road at an angle.&nbsp; For example, look at the diagram to the left 
  where the car is making a right turn. &nbsp;The middle sensor will eventually 
  detect the path and the program will turn off the turn motor but because the 
  <IMG height=169 src="IntroductionHardwareSoftwareResu.files/index1.gif" 
  width=197 align=left border=0>car will be moving straight at an angle to the 
  road, the left sensor will go over and the middle sensor will go off the 
  track.&nbsp; This tells the car to make a left turn.&nbsp; The car will 
  continue to adjust itself in this wobbling manner, although each time the 
  angle at which it comes into the path is reduced.&nbsp; Therefore, we found 
  that the path after a turn should be sufficiently long to allow for this 
  adjusting.&nbsp; &nbsp;&nbsp;</FONT></SPAN></P>
  <P class=MsoNormal 
  style="TEXT-JUSTIFY: inter-ideograph; TEXT-INDENT: 0.5in; TEXT-ALIGN: justify"><SPAN 
  style="FONT-FAMILY: Palatino Linotype"><FONT size=4>The photosensors also were 
  the source of some errors.&nbsp; The sensors work best when placed 0.8 cm off 
  the surface; at this level, the sensors can clearly distinguish between a 
  light and dark colored background and the output is a stable high for light 
  and stable low for dark.&nbsp; At a distance higher than 0.8 cm, the sensor 
  output begins to fluctuate.&nbsp; The output voltage levels over light and 
  dark surfaces begin to overlap so that the program cannot properly discern if 
  the car is over a path.&nbsp; At a distance lower than 0.8 cm, the sensors 
  tend only to output low.&nbsp; We also found that the sensors work best with 
  black and white, and placing the sensors over a different color leads to a 
  fluctuating output.&nbsp; We believe this occurs because colors other than 
  black would absorb some infrared waves while reflecting others.&nbsp; If the 
  amount of reflected infrared varies, then the output will fluctuate.&nbsp; 
  This behavior unfortunately rules out the prospect of using backgrounds and 
  tracks of different colors. &nbsp;</FONT></SPAN></P>
  <P class=MsoNormal 
  style="TEXT-JUSTIFY: inter-ideograph; TEXT-INDENT: 0.5in; TEXT-ALIGN: justify"><SPAN 
  style="FONT-FAMILY: Palatino Linotype"><FONT size=4>This project is 
  essentially a toy so anyone can use it.&nbsp; All one needs to do is place the 
  car over a track and turn it on.&nbsp; It is, however, unlikely to be a very 
  marketable toy because it requires three 9 V batteries to run and the motor 
  consumes battery power too quickly.&nbsp; We noticed that if the battery 
  voltage for the turn motor drops below 7 V, the car will not be able to turn 
  at all.</FONT>&nbsp; </SPAN></P>
  <P class=MsoNormal 
  style="TEXT-JUSTIFY: inter-ideograph; TEXT-INDENT: 0.5in; TEXT-ALIGN: justify"><A 
  href="http://instruct1.cit.cornell.edu/courses/ee476/FinalProjects/s2007/bl222_wh84/bl222_wh84/index.html#top">Back 
  to Top</A> </P></BLOCKQUOTE>
<H1><FONT face="Palatino Linotype"><A id=concl></A>Conclusion</FONT></H1>
<BLOCKQUOTE>
  <BLOCKQUOTE>
    <P class=MsoNormal align=justify><SPAN 
    style="FONT-FAMILY: Palatino Linotype"><FONT size=4>&nbsp;A line-following 
    car is certainly not the most nefarious project that has ever been 
    undertaken but we must still consider the IEEE Code of Ethics 
    nonetheless.</FONT></SPAN></P>
    <P class=MsoNormal style="MARGIN-LEFT: 0.5in; TEXT-INDENT: -0.25in"><SPAN 
    style="FONT-FAMILY: Palatino Linotype"><FONT size=4>1)</FONT><SPAN 
    style="FONT-WEIGHT: normal; FONT-STYLE: normal; FONT-FAMILY: Times New Roman; FONT-VARIANT: normal"><FONT 
    size=4>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN></SPAN><I><SPAN 
    style="FONT-FAMILY: Palatino Linotype"><FONT size=4>To accept responsibility 
    in making decisions consistent with the safety, health and welfare of the 
    public, and to disclose promptly factors that might endanger the public or 
    the environment: </FONT></SPAN></I><SPAN 
    style="FONT-FAMILY: Palatino Linotype"><FONT size=4>Even at its original 
    fast speed, the car does not have enough mass to hurt someone if it were to 
    run into him or her.&nbsp; However, we certainly did not want someone to 
    trip over it so we tested the car in a safe area in the Phillips Hall, away 
    from heavy foot traffic.&nbsp; Also, we tested the circuitry to make sure no 
    component would get hot enough to hurt anyone using the 
    car.</FONT></SPAN></P>
    <P class=MsoNormal style="MARGIN-LEFT: 0.5in; TEXT-INDENT: -0.25in"><SPAN 
    style="FONT-FAMILY: Palatino Linotype"><FONT size=4>2)</FONT><SPAN 
    style="FONT-WEIGHT: normal; FONT-STYLE: normal; FONT-FAMILY: Times New Roman; FONT-VARIANT: normal"><FONT 
    size=4>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN></SPAN><I><SPAN 
    style="FONT-FAMILY: Palatino Linotype"><FONT size=4>To avoid real or 
    perceived conflicts of interest whenever possible, and to disclose them to 
    affected parties when they do exists: </FONT></SPAN></I><SPAN 
    style="FONT-FAMILY: Palatino Linotype"><FONT size=4>No conflicts of 
    interests arose during this project</FONT></SPAN></P>
    <P class=MsoNormal style="MARGIN-LEFT: 0.5in; TEXT-INDENT: -0.25in"><SPAN 
    style="FONT-FAMILY: Palatino Linotype"><FONT size=4>3)</FONT><SPAN 
    style="FONT-WEIGHT: normal; FONT-STYLE: normal; FONT-FAMILY: Times New Roman; FONT-VARIANT: normal"><FONT 
    size=4>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN></SPAN><I><SPAN 
    style="FONT-FAMILY: Palatino Linotype"><FONT size=4>To be honest and 
    realistic in stating claims or estimates based on available data: 
    </FONT></SPAN></I><SPAN style="FONT-FAMILY: Palatino Linotype"><FONT 
    size=4>All data, schematics, hardware/software descriptions, costs, and 
    results in this report are correct.</FONT></SPAN></P>
    <P class=MsoNormal style="MARGIN-LEFT: 0.5in; TEXT-INDENT: -0.25in"><SPAN 
    style="FONT-FAMILY: Palatino Linotype"><FONT size=4>4)</FONT><SPAN 
    style="FONT-WEIGHT: normal; FONT-STYLE: normal; FONT-FAMILY: Times New Roman; FONT-VARIANT: normal"><FONT 
    size=4>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN></SPAN><I><SPAN 
    style="FONT-FAMILY: Palatino Linotype"><FONT size=4>To reject bribery in all 
    its forms:&nbsp; </FONT></SPAN></I><SPAN 
    style="FONT-FAMILY: Palatino Linotype"><FONT size=4>Nobody would have bribed 
    us for this project.&nbsp; </FONT></SPAN></P>
    <P class=MsoNormal style="MARGIN-LEFT: 0.5in; TEXT-INDENT: -0.25in"><SPAN 
    style="FONT-FAMILY: Palatino Linotype"><FONT size=4>5)</FONT><SPAN 
    style="FONT-WEIGHT: normal; FONT-STYLE: normal; FONT-FAMILY: Times New Roman; FONT-VARIANT: normal"><FONT 

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -