1 |
kaklik |
1 |
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
|
|
|
2 |
<!-- saved from url=(0054)http://www.cs.uu.nl/people/markov/lego/tips/index.html -->
|
|
|
3 |
<HTML><HEAD><TITLE>Lego Robots: Tips and Tricks</TITLE>
|
|
|
4 |
<META http-equiv=Content-Type content="text/html; charset=windows-1250">
|
|
|
5 |
<META content="MSHTML 6.00.2800.1226" name=GENERATOR></HEAD>
|
|
|
6 |
<BODY background="Lego Robots Tips and Tricks_soubory/back.jpg">
|
|
|
7 |
<TABLE>
|
|
|
8 |
<TBODY>
|
|
|
9 |
<TR vAlign=top>
|
|
|
10 |
<TD>
|
|
|
11 |
<P><IMG src="Lego Robots Tips and Tricks_soubory/logo.gif"></P>
|
|
|
12 |
<P><A href="http://www.cs.uu.nl/people/markov/lego/index.html"><IMG
|
|
|
13 |
height=58 alt=[Home] src="Lego Robots Tips and Tricks_soubory/homeoff.gif"
|
|
|
14 |
width=78 align=ABSCENTER border=0></A></P>
|
|
|
15 |
<P><A
|
|
|
16 |
href="http://www.cs.uu.nl/people/markov/lego/challenge/index.html"><IMG
|
|
|
17 |
height=58 alt=[Challenge]
|
|
|
18 |
src="Lego Robots Tips and Tricks_soubory/challengeoff.gif" width=78
|
|
|
19 |
align=ABSCENTER border=0></A></P>
|
|
|
20 |
<P><A href="http://www.cs.uu.nl/people/markov/lego/rcxcc/index.html"><IMG
|
|
|
21 |
height=58 alt=[RcxCC]
|
|
|
22 |
src="Lego Robots Tips and Tricks_soubory/rcxccoff.gif" width=78
|
|
|
23 |
align=ABSCENTER border=0></A></P>
|
|
|
24 |
<P><A href="http://www.cs.uu.nl/people/markov/lego/robots/index.html"><IMG
|
|
|
25 |
height=58 alt=[Robots]
|
|
|
26 |
src="Lego Robots Tips and Tricks_soubory/robotsoff.gif" width=78
|
|
|
27 |
align=ABSCENTER border=0></A></P>
|
|
|
28 |
<P><A href="http://www.cs.uu.nl/people/markov/lego/tips/index.html"><IMG
|
|
|
29 |
height=58 alt=[Tips] src="Lego Robots Tips and Tricks_soubory/tipson.gif"
|
|
|
30 |
width=78 align=ABSCENTER border=0></A></P>
|
|
|
31 |
<P><A href="http://www.cs.uu.nl/people/markov/lego/links/index.html"><IMG
|
|
|
32 |
height=58 alt=[Links]
|
|
|
33 |
src="Lego Robots Tips and Tricks_soubory/linksoff.gif" width=78
|
|
|
34 |
align=ABSCENTER border=0></A></P></TD>
|
|
|
35 |
<TD><FONT size=+4>Lego Robots Tips and Tricks</FONT>
|
|
|
36 |
<P><IMG src="Lego Robots Tips and Tricks_soubory/divide.gif"></P>
|
|
|
37 |
<P>
|
|
|
38 |
<H2>Sensors</H2>
|
|
|
39 |
<H3>Putting light and touch sensors on one input</H3>It is easy to put
|
|
|
40 |
touch and light sensors on one sensor input. In this case better set the
|
|
|
41 |
sensor mode to raw. In nqc this can be done as follows: <PRE> SetSensor(SENSOR_2,_SENSOR_CFG(SENSOR_TYPE_LIGHT, SENSOR_MODE_RAW));
|
|
|
42 |
</PRE>Now a value below 100 is a touch sensor event. Values above this
|
|
|
43 |
correspond to light levels (the higher the darker).
|
|
|
44 |
<H3>Using the IR port for proximity detection</H3>It turns out that the
|
|
|
45 |
light sensor is very sensitive to the infra-red light produced by the the
|
|
|
46 |
IR port on the robot. To uses this, mount the light sensor above the IR
|
|
|
47 |
port, pointing forward. Now regularly send messages. When there is a wall
|
|
|
48 |
close in front of the robot, you can notice this by high intensity changes
|
|
|
49 |
in the reading of the light sensor (preferably in raw mode). The closer
|
|
|
50 |
you get, the higher the fluctuations become. After a bit of tuning you can
|
|
|
51 |
rather accurately predict the distance. Here is a simple <A
|
|
|
52 |
href="http://www.cs.uu.nl/people/markov/lego/tips/ping.nqc">nqc
|
|
|
53 |
program</A> to demonstrate how this works. Thanks to Dave Chen and Simen
|
|
|
54 |
Svale Skogsrud for finding out about this.
|
|
|
55 |
<H2>Design</H2>
|
|
|
56 |
<H3>Front and back</H3>All designs that come with Lego MindStorms use the
|
|
|
57 |
IR-port side of the RCX as the front. This is not a good idea because you
|
|
|
58 |
normally add a lot of stuff at the front, making the IR-port almost
|
|
|
59 |
invisible. Also, for balance reasons, it is good to put the motors under
|
|
|
60 |
the middle of the RCX. Finally, if you use a swivelling wheel, put it at
|
|
|
61 |
the back, not at the front. Pulling a swivelling wheel gives a much
|
|
|
62 |
straighter motion than pushing it.
|
|
|
63 |
<H3>Drive-Steer mechanism</H3>
|
|
|
64 |
<P>
|
|
|
65 |
<TABLE>
|
|
|
66 |
<TBODY>
|
|
|
67 |
<TR vAlign=top>
|
|
|
68 |
<TD><IMG src="Lego Robots Tips and Tricks_soubory/step3.jpg"> </TD>
|
|
|
69 |
<TD>This mechanism is based on the adder-subtractors of <A
|
|
|
70 |
href="http://carol.wins.uva.nl/~leo/lego/diff.html">Leo </A>and <A
|
|
|
71 |
href="http://www.phred.org/~alex/lego/">Alex </A>. It must be driven
|
|
|
72 |
by two motors; one connected to one of the four gears on one side,
|
|
|
73 |
and the other connected to one of the three gears on the other side.
|
|
|
74 |
One motor makes the wheels move in the same direction. The other
|
|
|
75 |
sterrs by making the wheels move in opposite direction. My design is
|
|
|
76 |
acccording to me stronger than the other ones. More pictures can be
|
|
|
77 |
found <A
|
|
|
78 |
href="http://www.cs.uu.nl/people/markov/lego/tips/Differential1/index.html">here</A>.
|
|
|
79 |
</TD></TR></TBODY></TABLE>
|
|
|
80 |
<H3>Double motor power</H3>
|
|
|
81 |
<P>
|
|
|
82 |
<TABLE>
|
|
|
83 |
<TBODY>
|
|
|
84 |
<TR vAlign=top>
|
|
|
85 |
<TD><IMG src="Lego Robots Tips and Tricks_soubory/twomotors.jpg">
|
|
|
86 |
</TD>
|
|
|
87 |
<TD>If you need extra motor power, and you have enough motors,
|
|
|
88 |
connect two together. You can out them both on the same output to
|
|
|
89 |
drive them simultaneously. This is especially good for heavy robots
|
|
|
90 |
or if you want your robots to go fast. I assume you can do the same
|
|
|
91 |
with three or more motors, but I am not sure how many you can
|
|
|
92 |
connect to one output. </TD></TR></TBODY></TABLE>
|
|
|
93 |
<H3>Bumpers</H3>
|
|
|
94 |
<P>
|
|
|
95 |
<TABLE>
|
|
|
96 |
<TBODY>
|
|
|
97 |
<TR vAlign=top>
|
|
|
98 |
<TD><IMG src="Lego Robots Tips and Tricks_soubory/bumper1.jpg"> </TD>
|
|
|
99 |
<TD>Here is bumper I designed that uses only one touch sensor.
|
|
|
100 |
Instructions for building it can be found <A
|
|
|
101 |
href="http://www.cs.uu.nl/people/markov/lego/tips/bumper1/index.html">here</A>.
|
|
|
102 |
</TD></TR></TBODY></TABLE>
|
|
|
103 |
<H2>Internals</H2>
|
|
|
104 |
<H3>Free memory</H3>After loading the firmware, it seems that there is
|
|
|
105 |
about 6K of memory available for programs. You can use the <B>RCX Command
|
|
|
106 |
Center</B> to free this memory when required.
|
|
|
107 |
<H2>Programming with SPIRIT.OCX</H2>
|
|
|
108 |
<H3>Using the joystick</H3>Here is an <A
|
|
|
109 |
href="http://www.cs.uu.nl/people/markov/lego/tips/RCXJoystick.zip">example
|
|
|
110 |
program</A> (in Delphi 3) of how you can use the joystick to steer the
|
|
|
111 |
RCX. It comes with full source and is freeware. It is a simplified
|
|
|
112 |
stand-alone version of the joystick window in my RCX Command Center
|
|
|
113 |
version 2.0.
|
|
|
114 |
<H3>Registering SPIRIT.OCX</H3>If you don't want to install the lego
|
|
|
115 |
software on your system but still use programs like the <B>RCX Command
|
|
|
116 |
Center</B> you must register the OCX. Copy the spirit.ocx file from the
|
|
|
117 |
lego Cdrom to you harddisk and use the Run command in the windows Start
|
|
|
118 |
menu to execute <PRE> REGSVR32.EXE spirit.ocx
|
|
|
119 |
</PRE>This will register the ocx on your machine. (You might need to
|
|
|
120 |
specify the path of the ocx in the above command.)
|
|
|
121 |
<H3>Bugs</H3>There is a bug in the OCX: When polling the mode of a sensor
|
|
|
122 |
(e.g. Poll(11,0)) you don't get the right mode but 32* the mode.
|
|
|
123 |
<P>There is another bug in the polling command. Polling the watch gives
|
|
|
124 |
you the total time in minutes, and not divided in hours and minutes as the
|
|
|
125 |
doc suggests. </P></TD></TR></TBODY></TABLE></BODY></HTML>
|