0,0 → 1,125 |
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> |
<!-- saved from url=(0054)http://www.cs.uu.nl/people/markov/lego/tips/index.html --> |
<HTML><HEAD><TITLE>Lego Robots: Tips and Tricks</TITLE> |
<META http-equiv=Content-Type content="text/html; charset=windows-1250"> |
<META content="MSHTML 6.00.2800.1226" name=GENERATOR></HEAD> |
<BODY background="Lego Robots Tips and Tricks_soubory/back.jpg"> |
<TABLE> |
<TBODY> |
<TR vAlign=top> |
<TD> |
<P><IMG src="Lego Robots Tips and Tricks_soubory/logo.gif"></P> |
<P><A href="http://www.cs.uu.nl/people/markov/lego/index.html"><IMG |
height=58 alt=[Home] src="Lego Robots Tips and Tricks_soubory/homeoff.gif" |
width=78 align=ABSCENTER border=0></A></P> |
<P><A |
href="http://www.cs.uu.nl/people/markov/lego/challenge/index.html"><IMG |
height=58 alt=[Challenge] |
src="Lego Robots Tips and Tricks_soubory/challengeoff.gif" width=78 |
align=ABSCENTER border=0></A></P> |
<P><A href="http://www.cs.uu.nl/people/markov/lego/rcxcc/index.html"><IMG |
height=58 alt=[RcxCC] |
src="Lego Robots Tips and Tricks_soubory/rcxccoff.gif" width=78 |
align=ABSCENTER border=0></A></P> |
<P><A href="http://www.cs.uu.nl/people/markov/lego/robots/index.html"><IMG |
height=58 alt=[Robots] |
src="Lego Robots Tips and Tricks_soubory/robotsoff.gif" width=78 |
align=ABSCENTER border=0></A></P> |
<P><A href="http://www.cs.uu.nl/people/markov/lego/tips/index.html"><IMG |
height=58 alt=[Tips] src="Lego Robots Tips and Tricks_soubory/tipson.gif" |
width=78 align=ABSCENTER border=0></A></P> |
<P><A href="http://www.cs.uu.nl/people/markov/lego/links/index.html"><IMG |
height=58 alt=[Links] |
src="Lego Robots Tips and Tricks_soubory/linksoff.gif" width=78 |
align=ABSCENTER border=0></A></P></TD> |
<TD><FONT size=+4>Lego Robots Tips and Tricks</FONT> |
<P><IMG src="Lego Robots Tips and Tricks_soubory/divide.gif"></P> |
<P> |
<H2>Sensors</H2> |
<H3>Putting light and touch sensors on one input</H3>It is easy to put |
touch and light sensors on one sensor input. In this case better set the |
sensor mode to raw. In nqc this can be done as follows: <PRE> SetSensor(SENSOR_2,_SENSOR_CFG(SENSOR_TYPE_LIGHT, SENSOR_MODE_RAW)); |
</PRE>Now a value below 100 is a touch sensor event. Values above this |
correspond to light levels (the higher the darker). |
<H3>Using the IR port for proximity detection</H3>It turns out that the |
light sensor is very sensitive to the infra-red light produced by the the |
IR port on the robot. To uses this, mount the light sensor above the IR |
port, pointing forward. Now regularly send messages. When there is a wall |
close in front of the robot, you can notice this by high intensity changes |
in the reading of the light sensor (preferably in raw mode). The closer |
you get, the higher the fluctuations become. After a bit of tuning you can |
rather accurately predict the distance. Here is a simple <A |
href="http://www.cs.uu.nl/people/markov/lego/tips/ping.nqc">nqc |
program</A> to demonstrate how this works. Thanks to Dave Chen and Simen |
Svale Skogsrud for finding out about this. |
<H2>Design</H2> |
<H3>Front and back</H3>All designs that come with Lego MindStorms use the |
IR-port side of the RCX as the front. This is not a good idea because you |
normally add a lot of stuff at the front, making the IR-port almost |
invisible. Also, for balance reasons, it is good to put the motors under |
the middle of the RCX. Finally, if you use a swivelling wheel, put it at |
the back, not at the front. Pulling a swivelling wheel gives a much |
straighter motion than pushing it. |
<H3>Drive-Steer mechanism</H3> |
<P> |
<TABLE> |
<TBODY> |
<TR vAlign=top> |
<TD><IMG src="Lego Robots Tips and Tricks_soubory/step3.jpg"> </TD> |
<TD>This mechanism is based on the adder-subtractors of <A |
href="http://carol.wins.uva.nl/~leo/lego/diff.html">Leo </A>and <A |
href="http://www.phred.org/~alex/lego/">Alex </A>. It must be driven |
by two motors; one connected to one of the four gears on one side, |
and the other connected to one of the three gears on the other side. |
One motor makes the wheels move in the same direction. The other |
sterrs by making the wheels move in opposite direction. My design is |
acccording to me stronger than the other ones. More pictures can be |
found <A |
href="http://www.cs.uu.nl/people/markov/lego/tips/Differential1/index.html">here</A>. |
</TD></TR></TBODY></TABLE> |
<H3>Double motor power</H3> |
<P> |
<TABLE> |
<TBODY> |
<TR vAlign=top> |
<TD><IMG src="Lego Robots Tips and Tricks_soubory/twomotors.jpg"> |
</TD> |
<TD>If you need extra motor power, and you have enough motors, |
connect two together. You can out them both on the same output to |
drive them simultaneously. This is especially good for heavy robots |
or if you want your robots to go fast. I assume you can do the same |
with three or more motors, but I am not sure how many you can |
connect to one output. </TD></TR></TBODY></TABLE> |
<H3>Bumpers</H3> |
<P> |
<TABLE> |
<TBODY> |
<TR vAlign=top> |
<TD><IMG src="Lego Robots Tips and Tricks_soubory/bumper1.jpg"> </TD> |
<TD>Here is bumper I designed that uses only one touch sensor. |
Instructions for building it can be found <A |
href="http://www.cs.uu.nl/people/markov/lego/tips/bumper1/index.html">here</A>. |
</TD></TR></TBODY></TABLE> |
<H2>Internals</H2> |
<H3>Free memory</H3>After loading the firmware, it seems that there is |
about 6K of memory available for programs. You can use the <B>RCX Command |
Center</B> to free this memory when required. |
<H2>Programming with SPIRIT.OCX</H2> |
<H3>Using the joystick</H3>Here is an <A |
href="http://www.cs.uu.nl/people/markov/lego/tips/RCXJoystick.zip">example |
program</A> (in Delphi 3) of how you can use the joystick to steer the |
RCX. It comes with full source and is freeware. It is a simplified |
stand-alone version of the joystick window in my RCX Command Center |
version 2.0. |
<H3>Registering SPIRIT.OCX</H3>If you don't want to install the lego |
software on your system but still use programs like the <B>RCX Command |
Center</B> you must register the OCX. Copy the spirit.ocx file from the |
lego Cdrom to you harddisk and use the Run command in the windows Start |
menu to execute <PRE> REGSVR32.EXE spirit.ocx |
</PRE>This will register the ocx on your machine. (You might need to |
specify the path of the ocx in the above command.) |
<H3>Bugs</H3>There is a bug in the OCX: When polling the mode of a sensor |
(e.g. Poll(11,0)) you don't get the right mode but 32* the mode. |
<P>There is another bug in the polling command. Polling the watch gives |
you the total time in minutes, and not divided in hours and minutes as the |
doc suggests. </P></TD></TR></TBODY></TABLE></BODY></HTML> |