Вы находитесь на странице: 1из 148

. .

- . , .
. .

3-,

-

2013
621.86/.87
32.816
53

.. . .: ,
2013. 319 .

ISBN 978-5-02-038-200-8

, -
, , .
. -
Lego ,
: -
Lego Mindstorms NXT, ,
.
-
Lego, -
, . ,
NXT-G, Robolab RobotC,
.

, : , -
, . -
: - - -
-.
,
.


- . , . . .

ISBN 978-5-02-038-200-8 .. , 2013


, 2013

..............................................................................................................8

............................................................ 10

1. ................................................................ 11

............................................................................................................... 11
..................................................................... 12
................................................................................... 14
: ? ........................................................... 15
................................................................................................................15
.....................................................................................18
? .................................................................................................18
................................................................ 19
................................................................................... 20
..............................................................................................20
.........................................................................................23

2. .................................................................................... 24

................................................................................ 24
RIS NXT..................................................24
: ....................................................................25
............................................................................................................26
......................................................................................26
....................................................................................... 28
...........................................................................................29
..........................................................................................................................33
.......................................................................................................................36

3. ........................................................................................ 38

!.................................................................................................... 38
NXT Program................................................................................................................38
NXT-G ..........................................................................................................................39
Robolab 2.9 ...................................................................................................................40
RobotC ..........................................................................................................................40
................................................................................................................ 41
...............................................................................................41
...........................................................................................44
........................................................................45
...................................................50
- ..................................................................................................................52

3
............................................................................................... 57
......................................................................................................................57
...............................................................................................59
NXT 2.0...........................................................................66
.................................................................................................. 73
......................................................................................... 75
....................................................................................................75
...................................................................................................76
..........................................................................82
...................................................................................................89
............................................................................................................91

4. NXT-G ................................................................ 93

............................................................................................................... 93
NXT-G ............................................................................................ 93
.........................................................................................................94
NXT-G ......................................................................................................95
.....................................................................................................................97
...........................................................................................................................98
.................................................................................................................98
Robo Center........................................................................................................... 99
TriBot..........................................................................................................................100
RoboArm.....................................................................................................................101
Spike ...........................................................................................................................103
Alpha Rex ...................................................................................................................104

5. Robolab............................................................. 107

............................................................................................................. 107
................................................................................... 108
....................................................................................... 109
..........................................................................................................110
.....................................................................................111
NXT.............................................................................................112
...................................................................................................... 113
.............................................................................................. 114
.......................................................................................................115
........................................................................116
NXT .............................................................................................................119
............................................................................................ 120
..................................................................................120
..................................................................................122
..............................................................................123
....................................................................................123

4
................................................................................... 124
...........................................................................................125
...................................................................................................................126
......................................................................................................................130
.........................................................................................................................131
.....................................................................................................................135
................................................................................................... 135
- .......................................................................................137
........................................................................................................ 138
........................................................................................143
NXT.................................................................................................. 145
................................................................................... 147

6. RobotC.............................................................. 148

............................................................................................................. 148
Firmware.....................................................................................................................148
Hello, world! ...............................................................................................................149
...............................................................................................150
........................................................................................ 150
...................................................................................................150
..................................................................................151
...........................................................................................152
................................................................................153
...........................................................................................154
.............................................................................................................. 154
................................................................................154
...............................................................................................................156
........................................................................................... 157
....................................................................................................................157
.....................................................................................................................157
......................................................................................... 158
................................................................................................158
............................................................160
.......................................................................160
NXT............................................................................................162
.....................................................................................................................165
.................................................................................................167

7. ....................................................................... 170

........................................................................................... 170
................................................................................................171
...........................................................172
.........................................................174
........................................................................... 176

5
....................................................................................................................176
................................................................................................176
...........................................................................................180
..............................................................................................................181
......................................................................184
...................................................................................................185
..................................................................187
............................................................................................188
- ............................................ 190
-.............................................................190
...................................................................................................193
................................................................................. 194
.................................................................................. 195
-................................................................................................... 196
RAW .............................................................................................................198
.................................. 200

8. ................................................................................. 204

......................................................................... 204
.......................................204
...................................................................................................................207
..............................................................................................208
.......................................................................... 209
...........................................................................................................209
................................................................................................209
.......................................................................................................... 210
.............................................................................................................210
.....................................................................................................212
...............................................................................................212
....................................................................................215
...............................................................................................220
....................................................................................... 224
...............................................................................................................224
................................................................................................................232
........................................................................................................................247
.......................................................................................................248
.................................................................................... 250
........................................................................................250
..............................................................................................251
...........................................................................................253
.............................................................................................. 256
....................................................................................................256
.........................................................................................................257
..................................................................................................260

6
- ......................................................................................... 262
..............................................................................................................262
.....................................................................................................263
..............................................................................265
....................................................................................................266
...............................................................................268
- ...................................................................................269
...................................................................................................270
............................................................................................................ 272
.......................................................................................272
......................................................................................................................272
.................................................................................................273
.................................................................................................276
................................................................................................279
....................................................................................... 281
.......................................................................................................281
.......................................................................................286
........................................................................292
RobotC.......................................................................................295
- ....................................................................................... 296
................................................................................................296
..........................................................................................298
................................................................................................300
............................................................................................. 304

........................................................................................................... 309

............................................................................................................ 310

.......................................................................................................... 311

.1. ...................................................................................... 311


.2. .................................................................................. 312
....................................................312
.3. - Lego Mindstorms NXT............................................ 314
Lego Mindstorms NXT.............................314
....................................................................................314
Lego Mindstorms NXT ....................................315

7

,
, , -
. .
-
, ,
(). -
- .
Lego -
,
: -
Lego Mindstorms. -
, -
, , ,
.. ,
,
810 . -
, Lego Mindstorms NXT, :
Bluetooth, ,
. -
?
:
. -
, , .
, -
. ,
, .
-
-. -
- , , -
.
1. , -
, , .
, ,
, -
,
, .

1
2012 . - Hand-Friend -
. .
. -, ,
. : , , -
.

8
, -
: , , -
,
.
, -

, 2008 . - 239
- -
-
( )

-
.
-
, 1999 .
. ,
www.cyber-net.spb.ru.
. . , ,
, -
- ,
,
. ,
, ,
, -
: , , -
.
, , -
,
, XXI .
20112013 . -
:
. . .
,
. . .
,
. . , 2- 3-
,
- 19992012.

.

,
. .

9

,
, ,
RobotC, -
.
: -
, ,
, -, ,
RobotC. -
.
,
. -
,
.
, , -
.
:
robobook@mail.ru.

10
1.

,
, -
, (, , -
).
.
,
, : . :
. -
, . .
, .
? .
. , -
, !
,
, -
. -
Lego Mindstorms
, .
Mindstorms -
1998 .
(Robotics In-
vention System RIS),
RCX. -
,

Lego -
(. 1.1). RIS
- . 1.1. RCX.
, -
RCX.
2006 . Lego Mindstorms NXT -

RIS, .
NXT -
. -
.

11


RIS RCX, . -
, -
NXT.
Lego Technic1, -
-
.

. 1.2. Lego Minstorms NXT Alpha Rex :


8527, 8547 NXT 2.0.

Lego
Lego Mindstorms NXT 8527 8547 (. 1.2). -
, :
, ,
NXT . , :
Alpha Rex,
,
. -

-. ,
-
, .

1
Lego Technic, : Lego Mindstorms
.

12
8547 NXT 2.0, -
: ,
-
. -
, .
Lego, -
.
- -
1, .
Lego, .
Lego, -
Lego Education.
. Lego Mindstorms NXT Edu
9797 -
Lego Education . ,
( 9695) -
-, ,
. , -
http://www.legoeducation.us -
Lego ( ,
), , ,
, -
-. , 9797
. .
-
, ,

Lego Mindstorms NXT: HiTechnic (www.hitechnic.com),
MindSensors (www.mindsensors.com), Vernier (www.vernier.com) .
-, , -
, . -
-
Lego (http://shop.lego.com), , , -
Lego .

1
8527 -
, -
. 8547 .

13

, Lego Mindstorms NXT :


(9797) (8527, 8547). (. 1.3)

:
; ,
. ,
.

, .

. 1.3. Lego Mindstorms NXT 9797 () -


9648 ().

-
, .
-
, -
. , -
, , -
.
9797 9695 ( 9648),
(. 1.3).
,
. . -
, Lego, -
, -
(

14
). -, - -
RCX . , -
, , ,
.
Bluetooth- -
, .
, -
: NXT Lego 1.
, NXT :
USB-.

: ?

Lego ,
NXT. -
, , . -
() NXT,
, , -
.
, ,
. -
Lego,
Mindstorms -
.
NXT (. 1.4) ,
.

USB-. , -
NXT.
Bluetooth,
,
, Bluetooth, BT-

1
Bluetooth
Widcomm Bluetooth Windows v.1.4.2.10 SP5
Bluetooth, Microsoft Windows XP Service
Pack 2 Service Pack 3, Windows Vista Vista Service Pack 1, Apple MacOS X
10.3.9, 10.4 10.5.

15
. -
NXT HS485.
LCD- -
, (
RCX), . -
,
! ? . -

.

. 1.4. NXT.

NXT :
//;
-
NXT;
- //.
-
NXT .
, -
, ,
NXT. ,

,
.
A, B C ,
, .
NXT . ,
RCX,
. , -
( ),
.

16
NXT -
: 1) (Touch Sensor), 2) (Sound Sensor), 3)
(Light Sensor), 4) (Ultrasonic Sensor) (. 1.4).
8547 (Color Sensor), -
, , -
. .
, ,
, . -
, -
.
.

.
,
, -
. -
, ,
. -
.
8547

. , , -
.
, -
, , -
.
, ,
, ,
.

NXT
32- ARM7: 48,
(RAM) 64 , (FLASH) 256 ;
8- AVR: 8, -
(RAM) 512 , (FLASH) 4 ;
Bluetooth ( -
Bluetooth Class II V2.0);
USB (12 /);
, -
( , -
IEC 61158 Type 4/EN 50 170 );

17
, -
;
- 100 64 ;
8 , 8-
216 ;
: AA 1
Lego.


NXT -
, Lego.
Lego: -
. ,
NXT Technic. , -
, -
, .
Technic, ,
, , NXT ,
RIS. , Lego, -
. -
Technic,
. 8547,
9797 v.95 , -
.
,
, -
. ,
612 ( !)
.

?
, 6- (
12-) AA -
. ,
, .
,
, , -
.

1
Lego Mindstorms NXT 9797.

18
NXT, -
. ,
. -
, : Varta High Energy ( -
), Energizer Ultimate Lithium ( -
, ). -
Energizer Maximum Duracel Turbo,
.
-
1 2 (, ), -
: , -
, , - .. ,
, ,
.

, -
, , ,
, ,
, . Lego -
-, HiTechnic (http://www.hitechnic.com)
Mindsensors (http://www.mindsensors.com),
, NXT (. 1.5). -
.
?
NXT

Mindsensors NXTServo.
2013 .
Lego Mindstorms EV3,
NXT,
. . 1.5.
, Hitechnic.
, -
NXT, ,
, . Lego
Mindstorms -
, ,
, .

19


Lego Mindstorms
, ,
, . -
NXT
.
-
Lego Mindstorms NXT. Lego
Mindstorms NXT Edu, , -
-
. NXT, -
NXT-G, , drag-and-drop ,
, . -
ROBOLAB RCX, ,
.
, ,
ROBOLAB 2.9, -
NXT. NXT-G: -
-
. NXT-G
. -
,
LabVIEW, . LabVIEW, , -

, -
1. Robolab Lab-
VIEW , NXT-G. -
Robolab 2.9
-. , , -
Lego Education http://www.legoeducation.us. -
http://www.legoengineering.com;
, Robolab,
.
, NXT-G ,
. , -
, . Lego -

1
2010 . NXT
LabVIEW [8], .

20
-
; -
, -
, ,
.
, , , -
,
. , -
( , ,
), NXT-G ,
-
, , 8527
8547 .
NXT
. NBC, NXC RobotC. NBC
NXC , .
, NXC (NXC Not
eXactly C ).
http://bricxcc.sourceforge.net/nbc. , -
NXT. RobotC
, ,
. Carnegie Mellon Universitys Robot-
ics Academy http://www.robotc.net. -
30- RobotC ,
(80$ ).
NXT-G, Robolab 2.9
RobotC, -
, . 1.1.
1.1. NXT


Lego Mindstorms NXT-G 812
NXT Software ( ) ,
Robolab 2.9.41 Robolab 816 , -
(, , ,
)
RobotC for RobotC 1499 -
Mindstorms ( -
) C

1
Robolab 2.9 2.9.4.

21
Lego Education -
.
http://www.legoengineering.com, -
Lego Mindstorms NXT (. 1.6).

. 1.6. Mindstorms 2006 .

2010 Lego National Instruments


LabView for Mindstorms ,

Lego Mindstorms NXT
LabView, (. 1.7).

. 1.7. 2010 .

Robolab 2.9.4

NXT-. ,

22
LabVIEW , - Robolab, -
, -
. Robolab
LabView,
Robolab 2.9.4d.
, -
RobotC . ,
-
.
. -
, . ,
: , ,
, . -

. , -
, , , -
.


.
, -

,
. , -
- - -
. QReal:Robots -
,
, -, -
.
-
nxtOSEK,
NXT.
nxtOSEK -
.
QReal:Robots -
, -
. -
,
. , QReal -
.
Microsoft Robotics Studio, RobotC Virtual Worlds MatLab
.

23
2.

Lego
Technic,
. -
, , Quick Start,
Lego.

RIS NXT
NXT ,
RIS, , , -
.
NXT (-
). RIS -
Lego, -
( ,
, Lego).
NXT Technic
. , , -
,
Technic! -
, ,
. , , ,

.
Technic -
; -
NXT-
.
RIS, , -
, ,
Lego ( -
). NXT, , ,
, -
, . , NXT -
.

24

RCX. :

. ! NXT Technic -
; , , ,
, -
.
Technic
,
.

:
. .
( -
, ).
.
.
-
, .
, .
(. 2.1). .

. 2.1. , - .

25
, .
, .
-
, . -
. , -
. , -
. -
1.


-
-
, -
. -
,
-
, -
-
.
, . ,
,
-
,
. -

-
. :
, -
. -
-
, - -
. 2.2. !
(. 2.2).


-. -
, -
.
, -
.
.

26
. 2.3. ,
.

.
(. 2.3).
:


-
;
-
,
,
, -
;
-


(,
)
.
- . 2.4. -
: ,
[3].

27
: .
. -
,
(. 2.4).
, ,
, -
. ,

.

. 2.5.
.

, -
(. 2.5). -
.
.


. :
, , . ,
-
. -
, -
180 90 .

28


( ),
.

. :
, Z40 .
.
, . -
, -
. -, ,

. ?
.
.

. 2.6. ,
. [3].

:
- . . -
? , .
(. 2.6). -
, ,
.
, ?
, .
:

29
z2 ,
i=
z1
i , z2
, z1 .
, i < 1 , -
(. 2.7); i > 1 , -
. , i = 1 , .

.

. 2.7. : i = 3 : 1, i = 5 : 3 [3].


,
, -
(. 2.8).
-
. .

. 2.8. [3].

,

, .

. -
-
.

30
z2 z4 z6
i = i12 i34 i56 ... , i12 = , i34 = , i56 =
z1 z3 z5
, , ,

. , -
(. 2.9).

. 2.9. [3].

, , . -
,
. ,

u = i / 1 u = 1 / i. ,
: i 1. ,
i = 1 : 15, i = 15 : 1, u = 15 (. 2.10).

. 2.10. 15.

(. 2.11).
. -
, -
. , -
: z = 1. -, -

31

.
. -
. , -
8527 ,
( ) 2 . ,
, . ,
2 . -
.

. 2.11. :
[3].

. 2.12. 135.

-
9, 27, 45, 135 (. 2.12). , -
. , -
.

32
3.

,
. -
. -
. , ,
,
NXT.

NXT Program
NXT
B C 75 %, (. 3.1).
(Firmware) -
, .
, . -
. , -
Lego Mindstorms NXT -
. .
, -
(. . 3.1):
1) Forward (Backward),
2) Empty,
3) Forward (Backward),
4) Empty,
5) Loop.

. 3.1. B C.

38
, -
. Forward Backward
.
,
NXT Files, My Files.
, A -
.
, - -
-
. NXT, -
Stop (. 3.2).

. 3.2. Stop .

Loop Stop,
- , ,
Stop. Run. -

NXT Program, , -
.
NXT Program
.

NXT-G
, A ,
, .3.3.

. 3.3. NXT-G.

, ,
. -
A,
.

39
NXT ,

(. 3.4), -
NXT
.
NXT
My Files Software Files ,
-
. , Untitled. . 3.4. -
NXT.

Robolab 2.9
Robolab A .
Inventor 4
, . 3.5.

. 3.5. A Robolab.

NXT
. NXT
, .
My Files Software Files rbl.

RobotC
:
task main()
{
while(1)
motor[motorA] = 100;
}
F5, ,
, NXT My Files Software Files.
-
, ,
.

(Firmware) NXT.

40

-
. : ,
, , , . .
, ,
, , ,
, . -
, -
. .
:
, ,
; ;
, -
;
,
/ ;

;

.


, -
(. 3.63.11).

. 3.6. .
.

41
. 3.7. 3 5 .

. 3.8. 12- ,
.

. 3.9. .

42
. 3.10. , .

. 3.11. , .

, , ,
. ,
, . -
.

43

. 3.12. -
.

. 3.13. , .

44
. 3.14. -
.

1 : 1,

(. 3.13). -
.
-
.
(. 3.14), -
, -
. :
12- 8-,
, .
.
, .


. -
, .
NXT .
(. 3.153.20). -
.

45

,
(. 3.21-3.23).

. 3.15. .

. 3.16. NXT .

46
. 3.17. NXT .

. 3.18. .

47
. 3.19. .

. 3.20. B.

48
. 3.21. .

. 3.22. .

49
NXT,
-
.
!

. 3.23. .


, , .
. , -
.
(. 3.26).
. -
, (. 3.24),
(. 3.253.26).
. , -

: .
-. ?
, . ,
. -
. -
. .

50



. -
,
, -
, -
(. 3.71). -

8527 9797.
. -
-
, , . 3.71.

-
.
, .

8527
9797 (. 3.72). -
, .

. 3.72. 9797.

, ,
NXT.
. -
-
http://www.legoengineering.com [4].

75


NXT.
(. 3.73).

. 3.73. .

. 3.74. .

(. 3.743.81)
. -
.
, , , B
, C . -
.

76
. 3.75.
.

. 3.76. .

77
. 3.77. 6- ,
.

. 3.78. NXT 15-


, 2 .

78
. 3.79. . 3 5 .

. 3.80. . -
.

. 3.81,
.
. -
, , -
: .
.

79
. 3.81. . .


. 3.823.85. 16- -
, -
.

. 3.82. , -
.

80
. 3.83. , .

. 3.84. .

81
(. 3.92),
(. 3.93).
-
-
(. 3.94).
-
. ,
Lego- -
-
,
-
NXT.
-
, -
. . 3.94. [4].


,
, . -
- .
-
: . -
.

. 3.95. [4].

91
-
,
(. 3.95).
, , ,
- . ,
L
D: L D.
, -
,
. .
,
.
NXT Program,

: -
(NXT-G 4, Robolab 5, RobotC 6), ,
, -
7, 8.

92
4. NXT-G

NXT- ,
, , ,
.
, , ; -
. NXT -
,
, .
NXT, ,
, . .
NXT, -
NXT-G, Lego Mind-
storms NXT, . NXT-G -
, -

(G graphical, ). NXT-G
,
.
NXT, ,
.
, -, NXT-G,
. -, -
NXT-G, -
. -,
Robo Center.

NXT-G

Lego Mindstorms NXT


(. 4.1), . -

Getting Started Software Overview.
NXT-G , -
.

93
. 4.1. Lego Mindstorms NXT

. , -
, NXT-, -
USB- Bluetooth-
NXT. -

Tools Update NXT Firmware.


,
Start New Program Go>>.
, ,
Open
Recent Program Go>>.
, First
Program Start New Program
Go>>, Test Program.
. , File New,
CtrlN ( Windows)
CMDN ( Mac).

94
NXT-G
NXT-G ,
(Robo Center ,
). , -
: 1) , -
; 2) ; 3) -
; 4)
(. 4.2). ,
,
, Robo Center.
. 4.2
.
,
. -
, Technic, -
. , -
Shift,
.

. 4.2. NXT-G.

,
, -

95
( -).

.

Move block (.
4.3),
(. 4.2).

(1) , -
NXT . -
. 4.3. (2)
. . -
(3)
. ,
, ,
. (4) ,
: -
, , .
,
.
,
(. 4.4).

. 4.4. .

96
,
. -

, -
. -
, ,
, -
. -
(. 4.5):
(A) ,
(B) , . 4.5.
(C) (), .
(D) (),
(E) (),
(F) ().

, -
. , .

. 4.6. : (), -
().

(. 4.6, ) -
(1) (2 -
), (3 ).

. , -
(. 4.6, ),
.
- .

97

: 1)
( , ), .
4.6; 2)
, . 4.7.
-
, NXT-
G .
Flat
view -
. . 4.7. -
.

, , .
, NXT-G , -
.

. 4.8. (), -
().

(1) -
,
(. 4.8). , -
, , , .
(. 4.8, ) B C
, 3- -
50.
, -
.

NXT-G
Variable, Data (. 4.9).

98
(1) -
, -
(. 4.10).
(2)
(3) -
.
(1): ,
. 4.9. -
. -
, .

Edit Define Variables.

. 4.10. .

,
. , -
, ,
. NXT-G -

NXT-.
, Robo
Center!

Robo Center

Robo Center , -
Lego NXT.
, -
.
,
, -
, Lego Mindstorms NXT
.
, Robo
Center , .

99
5. Robolab

Robolab 2.9 -
, LabView 7.0
. -
Robolab -
Control Lab, RCX, NXT,
. , RCX,
(Firmware) 100 ,
(45 ). NXT
.
:
RCX, NXT.
Robolab : -
, (. 5.1).

. 5.1. Robolab 2.9.

107
-
.
-
.
, -
, -
. .

, -
-
RCX (-
NXT). :
1)
; 2)

( NXT
, , Firmware); 3) -
. . 5.2. NXT -
NXT USB.
, -
Select COM Port USB-, -
, NXT, , ,
(. 5.2).

. 5.3. , .

108
NXT
RCX/NXT.
NXT, NXT . -
rbl.
NXT-
( NXT begin).
Robolab (RCX, NXT,
Control Lab), Choose Hardware -
. -
NXT, (. 5.3). ,
.

: Pilot Inventor,
(. 5.4).

. 5.4. : Inventor 4.

.
,
.
, Inventor 4,

109

Robolab.
Inventor 4, .


, (. 5.5).
, : Front Panel Block
Diagram. ( ) -
, . , -
(
), . -
.

. 5.5. Robolab.

Tools Palette Functions Palette


. -
Windows -
.
Robolab -,
. ,
. Functions Palette ( -
). (. 5.6),
, Tools Palette (-
).

110
. 5.6. .

Functions Palette
, . ,
Search (), -
.
, -
(. 5.7).
,
Search.

. 5.7. .


Robolab 2.9 -
Behaviors (. 5.8). ,
. , Go
Straight ( ) A C 1 -
(. 5.9, ). -
,
(. 5.9, ).

111
. 5.8. .

. 5.9. .

Behaviors -
Robolab, -
. .

NXT
-
USB-
NXT (
Bluetooth )
.
Projects, -
-
.
. 5.10. NXT
.
Project Select COM Project Detective.
Port USB-
NXT .
Project Detective -
NXT, Firmware,
(. 5.10). -

112
NXT ,

1.
,
, NXT,
My Files Software Files
rbl.
, Robolab -
- . 5.11. -
NXT NXT. .
-
-
,
(. 5.11).
, -
. -
, :
,
Window Show Block Diagram.

Functions Palette -
:
,
,
,
.
. :
1) 2) .

, , -
, , , -
, .. , , -
( ),
. ,

1
NXT,
, . -
, Firmware RobotC.

113
6. RobotC

RobotC C
-
. -
, . ,
C,
.

.

Firmware
, NXT
, RobotC, -
Robolab NXT-G.
. , -
, .
-
Firmware (. 6.1).

. 6.1. NXT.

148
Hello, world!

: Hello, world!. -
NXT, :
task main()
{
nxtDisplayTextLine(0, "Hello, world!");
wait1Msec(5000);
}
nxtDisplayTextLine(0, "Hello world!");
NXT Hello world!.
5 . -
"hello.c".
,
NXT F5.
,
Program Debug (. 6.2).

. 6.2. .

Start, NXT.
,
hello .
.
:
task main()
{
nxtDisplayCenteredTextLine(3, "Hello world!");
wait1Msec(5000);
}

NXT .

149
NXT,
, -
. .


.
, RobotC, -
task main().
: .
.

.


: C 3 :

task main()
{
motor[motorC] = 100;
wait1Msec(3000);
}

motor[] , -
A,
B C. 100,
100, 0.
.
, -
.
wait1Msec()
(1 = 1/1000 ). , wait1Msec(3000)
3 .
:
2 .
C B 50,
2 , . -

150
,
:
task main()
{
motor[motorC] = 50;
motor[motorB] = 50;
wait1Msec(2000);
motor[motorC] = 0;
motor[motorB] = 0;
}
-
while. ,
NXT:

task main()
{
while (true)
motor[motorA]=100;
}
:

task main()
{
motor[motorA]=100;
while (true)
wait1Msec(1);
}

.


nMotorEncoder[]
, . -
16- ,
32768...32767, 95
(360 ) . -

.

nMotorEncoder[motorA] = 0;

151
A 1000 -
.
task main()
{
motor[motorA]=50;
while (nMotorEncoder[motorA] < 1000)
{
//
}
}

nMotorEncoderTarget[]
. -
, , -
.

task main()
{
nMotorEncoderTarget[motorA] = 1000;
motor[motorA] = 50;
wait1Msec(10000);
}


,
. -
, . . nSyncedMotors -
, ,
( , ):

nSyncedMotors = synchNone; //
nSyncedMotors = synchAC; // C A

-
: .
nSyncedTurnRatio
.
100 100 %. -
. -
. -
100, .
,
:

152
nSyncedMotors = synchAC; // C A

//
nSyncedTurnRatio = +100; //
nMotorEncoder[motorA] = 0;
// 1000
nMotorEncoderTarget[motorA] = 1000;
motor[motorA] = 100;

while (nMotorEncoder[motorA] < 1000) //


{}

//

nSyncedTurnRatio = -100; //
// 200
nMotorEncoderTarget[motorA] = 200;
motor[motorA] = 50;
wait1Msec(3000);


-
(, pulse width modulation PWM). -
. -
, -
(on-time) (off-time).
,
. on-time ,
, -
.
off-time, ,
: . -
, -
. RobotC
,
bFloatDuringInactiveMotorPWM. -
:

bFloatDuringInactiveMotorPWM = false; //
bFloatDuringInactiveMotorPWM = true; //

NXT ,
.

153
7.

-
.
[1]:
( ,
) , ;
,
, .. ;
( ) , -
;
( ) , -
, .
, -
,
. , -
.
( -
), .
, -
. -
-
.
-
, -
.
,
. -
-
.
.
, ()
-
. -
, , -
[1].
, -
, .

170
,

: .

.


! .
. - -
?
.

. . ,
45
, (. 7.1).

. 7.1. 45 .

, -
, .
: , -
45 -
, . -
45, .
. 1 .

. 7.2. .

171
task main()
{
int alpha=45;
nMotorEncoder[motorA]=0;
while(true)
{
if(nMotorEncoder[motorA]>alpha)
motor[motorA]=-100;
else
motor[motorA]=100;
wait1Msec(1);
}
}

? . -
, - :
. , .
.
,

. , .


Lego-
,
(. 7.3).

. 7.3. .

172
-
,
.

,
.
,
.
, -

-
.
B, -
C (. 7.4).
. 7.4.
. - -
, - .
,
, , .
-
. RobotC:

task main()
{
int grey=45;
while (true)
{ // grey -
if (SensorValue[S1]>grey)
{
motor[motorB]=100;
motor[motorC]=0;
}
else
{
motor[motorB]=0;
motor[motorC]=100;
}
wait1Msec(1);
}
}
(grey) -

.

, ,
. , , -

173
. -
.
-
Robolab . 7.5.

. 7.5.
.



.
, -
,
- ( ).

,
-
(. 7.6):

;
(S1) , -
(S2) -
;
, . 7.6.
;
.
.

:

task main()
{
int grey1=45, grey2=45;
while(true) {
if(SensorValue[S1]>grey1) {
if(SensorValue[S2]>grey2) { //
motor[motorB]=100;
motor[motorC]=100;

174
}
else { //
motor[motorB]=100;
motor[motorC]=-100;
}
}
else {
if(SensorValue[S2]>grey2) { //
motor[motorB]=-100;
motor[motorC]=100;
}
else { //
motor[motorB]=100;
motor[motorC]=100;
}
}
wait1Msec(1);
}
}
Robolab (. 7.7):

. 7.7. -
.

,
Lego-
.
, , -
, , -
. -
, , -
. ,
.

175

u(t)
e(t)
x(t) x0(t):

e(t) = x0(t) x(t).

- ,
.
u0(t)
-
, .
,

:

u0(t) = ke.

k .
x0 ,
e .
err ( error ).


,
. ,
, , (.
7.1). -.
e1 1 A
. x0 = 45, e = 45 e1.

u = k (45 e1).
k , 5,
.

1
e ( error) -
e1 ( encoder), Robolab.

176
-
, .

1-10 , (. 7.8).

. 7.8. .

5 100, -
,
- .
RobotC -
Robolab, :

task main()
{
int k=5, u;
nMotorEncoder[motorA]=0;
while(true)
{
u=k*(45-nMotorEncoder[motorA]);
motor[motorA]=u;
wait1Msec(1);
}
}

, , , -
45 , , , -
. , -
8.
,
, . -
, , ,
. -
, . -

.
NXT ,
, -
. , 10 -
. Robolab T1 Timer100ms1, RobotC
timer100[T1].

177
alpha ,
45, -
k2:

alpha = k2 T1.

-
k1:

u= k1 (alpha e1).

Robolab
,
(. 7.9).

. 7.9. .

k2 = 36 , alpha
360, :
task main()
{
int k1=2, k2=36, u, alpha;
nMotorEncoder[motorA]=0;
ClearTimer(T1);
while(true)
{
alpha=timer100[T1]*k2;
u=k1*(alpha-nMotorEncoder[motorA]);
motor[motorA]=u;
wait1Msec(1);
}
}
, C ( Robo-
lab) , -
, .. :

alpha = T1 / 10 k2.

k2 = 60 -
.

178
. k2 = 30,
12 30 . -

,
(. 7.10).

. 7.10. .

, , . -
-
-. -
, C %.
2 0 1:

alpha = T1 % 2 k2.

k2=15 ,
alpha, 5 0,
15 . .
RobotC:

task main()
{
int k1=3, k2=15, u, alpha;
nMotorEncoder[motorA]=0;
ClearTimer(T1);
while(true)
{
alpha=timer100[T1]%2*k2;
u=k1*(alpha-nMotorEncoder[motorA]);
motor[motorA]=u;
wait1Msec(1);
}
}

-
. , .
,
, (. 7.1):

alpha = T1 % 5 % 2 k2.

179
center = S3.

k1 = c + (S3 - center) / k2.

. 7.36.
.


,
, (. 7.36).

-- () -

, -
.
, -
. 7.37.

. 7.37. -.

196
. -
e(t),
u(t):
t
de
u(t) = p + i + d = kp e(t) + ki e ()d + kd
.
0
dt
, -
, -
. -
. - -
.

( ) .
-
, -
, .
(-)

. - -
, .
, -
6. .
, -
:

i = i + k i e(t ) dt .

e(t ) dt , -
.
ki , -
i . ,
.
- , -
.
. -

-.
.

197
RAW
NXT -
. -
0 1023, -
(
0...255, 0...100, 0 1 . .).
, , .
RAW ( . ). -
. , , -
10
. .
RAW Robolab, RobotC.
, -
-
.


- . 7.38:
, -
, . .

. ,
.
,
.

. -
. -
.

. 7.38. -.

198
. 7.39 Robolab.
.
c RAW,
float.
- .

. 7.39. -.

, -
grey -
. scale
. , ,

NXT. -
, RobotC , -
.

.
. -
. -
,
.
RobotC
. -, NXT -
1.4 , Robolab, scale -
. -, RAW-

:

199
task main()
{
int grey=SensorRaw[S3];
int err, errold=0;
float kp=25, ki=350, kd=0.3;
float scale=14;
float dt=0.001;
float p, i=0, d, u;
while (true)
{
err= grey-SensorRaw[S3]; //
p=kp*err;
i=i+ki*err*dt;
d=kd*(err-errold)/dt;
errold=err;
u=(p+i+d)/scale;
motor[motorB]=u;
motor[motorC]=u;
wait1Msec(1);
}
}


, -
,
.. ,
. -
, -
, -
. , -
,

.
, , ()
- ()
. -
xt , t
, ut
t, , t = 0, 1, 2, -
1
. . , . . .

200
. , -

h. Lego NXT ,
-
, :

t + 1 = t + ut hr / b, (1)

r , b (
). ,
h h sin t, ..

xt + 1 = xt + vt h sin t . (2)

t =0 , -
: vt=v, -
-
:

xt + 1 = xt + vht , t + 1 = t + ut hr / b. (3)

t, 2-
, -
:

xt + 2 2 xt +1 + xt = gut , (4)

g = h2vr / b.
x*>0
()

xt x* t. (5)


,
(4), (5) -
, . ,
ut = 0 (4)
xt = x*. (4),
( ), -
, (5) -
. -

201
, , -
.
-
-
. -
(-):

ut = K0(x* xt), (6)

K0 . (6) (4) -

xt +2 2 xt +1 + (1 + gK0 )xt = gK0x*. (7)

yt =x* xt , -

yt+2 2 yt+1 + (1+ gK0 )yt = 0. (7a)

(7)
2- :

xt+2 + a1xt+1 + a0xt = 0, (8)

-
1 2 (, ) -
2 + a1 + a0.
|1| < 1, |2| < 1, -
, -
. -

a0 < 1, 1+ a0> | a1| (9)

.
(9) - (7),
, (9) , .. -
K0, (7) . -
, - , -
.
-,

202
ut = K0(x* xt) + K1(xt+1 xt), (10)

K1 (). -
t xt+1 ,
(10)

xt+1 xt = vht = vht1 + ut1 vh2r / b.

(10), -
ut = [K0(x* xt) + K1 vh(t1 + ut1 hr / b)], (11)

. . (11)
.
- (10) (4).
:

xt+2 (2 + gK1 )xt+1 + (1 + gK0 + gK1)xt = gK0x*. (12)

(9), -
, -

K0 > 0, K0 + K1 < 0. (13)

, -
, -
-
. -
.

-
, ,
.

203
8.

: -
.
,
.
(. 8.1).

. 8.1. .


,
().
, -
.
, ,
. .
Robolab 2.9.4 -
RobotC . -
.


-
. . NXT -
,
,
. , -
(. 8.2).

. 8.2. .

204
task main()
{
motor[motorB] = 100; //
motor[motorC] = 100; //
}
.
, -
(. 8.3):

. 8.3. .

task main()
{
motor[motorB] = 100;
motor[motorC] = 100;
motor[motorB] = 0; //
motor[motorC] = 0;
}
,
. -
, -
(. 8.4):

. 8.4. .

task main()
{
motor[motorB] = 100;
motor[motorC] = 100;
wait1Msec(1000); // 1000
motor[motorB] = 0;
motor[motorC] = 0;
}

, ,
(. 8.5). -
:

. 8.5. , .

205
task main()
{
motor[motorB] = 100;
motor[motorC] = 100;
wait1Msec(1000);
motor[motorB] = -100; //
motor[motorC] = -100;
wait1Msec(1000);
motor[motorB] = 0;
motor[motorC] = 0;
}

-
. .

(. 8.6).

. 8.6. .

, 1 , -
N/100 . Robolab 2.9.4
N/1000:
task main()
{
motor[motorB] = 100;
motor[motorC] = 100;
wait1Msec(1000);
//
bFloatDuringInactiveMotorPWM = true;
motor[motorB] = 0;
motor[motorC] = 0;
wait1Msec(500);
motor[motorB] = -100;
motor[motorC] = -100;
wait1Msec(1000);
//
bFloatDuringInactiveMotorPWM = false;
motor[motorB] = 0;
motor[motorC] = 0;
}

Robolab
, RobotC ,

206
. Robolab

100...100.


.
.

(. 8.7). -
:

. 8.7. .

task main()
{
motor[motorB] = 100; //
motor[motorC] = -100; //
wait1Msec(300);
motor[motorB] = 0;
motor[motorC] = 0;
}

. -
, , -
. (. 8.8):

. 8.8. .

task main()
{
motor[motorB] = 100;
motor[motorC] = 0;
wait1Msec(1000); // B
motor[motorB] = 0;
}

207

, -

(. 8.9):

. 8.9. .

task main()
{
while (true){
motor[motorB] = 100;
motor[motorC] = 100;
wait1Msec(1000);
motor[motorC] = 0;
wait1Msec(1000);
motor[motorB] = 0;
}
}

, -
1 (. 8.10).
. -
:

. 8.10. 90 -
.

task main()
{
for(int i=0;i<4;i++){ // 4
motor[motorB] = 50;
motor[motorC] = 50;
wait1Msec(1000);
motor[motorC] = -50;
wait1Msec(400);
motor[motorB] = 0;
}
}

208


,

(. 8.11).

. 8.11. .

, -
, , . , -
.


, -
, , -
1 .
Robolab -
, 90
250 (. 8.12):

. 8.12. .

task main() {
nMotorEncoder[motorB]=0; //
motor[motorB] = 100;
motor[motorC] = -100;
//
while(nMotorEncoder[motorB]<250);
motor[motorB] = 0;
motor[motorC] = 0;
}

209


,
, .
,
. -
: ,

(. 8.32).

. 8.32. -
.

:
. ( -
) ,
. ,
. -
. 8.338.35, -
. 8.36. , -
,
.

. 8.33. .

224
. 8.34. .

. 8.35. 5 10 .

. 8.36. .

,
. , -
5 ( ). -
, 5 .
.


, :
, . -
,
;
, . -
;
, -
. (, 5,

225
8 ). , . -
, ,
. , (56 40) / 2 = 8.
. 8.37.

. 8.37. :
, .

,
100...100. -

(. 8.38).

. 8.38. :
.

-
, 20 .
, -
. 80 20 ,
.

-
, , ,
- . -
7. (. 8.39).

. 8.39.
.

226
48, u,
-
, (40 + 56) / 2 = 48. -
: , -
, ..
-
, . . .
. -

. ,
, -
. ,
56 7 = 49 (. 8.40).

. 8.40.
(-
).

task main()
{
int u, v=50;
float k=2;
int red=SensorValue[S1]-7;
while(true)
{
u=k*(SensorValue[s1]-red);
motor[motorB]=v+u;
motor[motorC]=v-u;
wait1Msec(1);
}
}

1 -
, 7,
u
red. ,
, . 8.41.

227
. 8.41.
.

,
,
. , ,
-
(. 8.42).

. 8.42.
.

task main()
{
int u, v=50;
float k=2;
int c4=SensorValue[S1];
PlaySound(soundBeepBeep);
wait1Msec(2000);
int c5=SensorValue[S1];
PlaySound(soundBeepBeep);
int grey=(c4+c5)/2;
while(true)
{
u=k*(SensorValue[S1]-grey);
motor[motorB]=v+u;
motor[motorC]=v-u;
wait1Msec(1);
}
}
:

, , -
. ,

228
. 4
( c4) ,
5 (c5) . grey -
, .
.
.
-
, , -

NXT.
-
, .
, -
(. 8.43).

. 8.43. .

task main()
{
int u, v=50;
float k=2;
int c4=SensorValue[S1];
PlaySound(soundBeepBeep);
while(SensorValue[S2]==0); // ,
wait1Msec(100); //
while(SensorValue[S2]==1); // ,
wait1Msec(100);
int c5=SensorValue[S1];
PlaySound(soundBeepBeep);
int grey=(c4+c5)/2;
while(SensorValue[S2]==0);
wait1Msec(100);
while(SensorValue[S2]==1);
while(true)
{

229
u=k*(SensorValue[S1]-grey);
motor[motorB]=v+u;
motor[motorC]=v-u;
wait1Msec(1);
}
}
,
.
( -
) .
,
. ,
.
. -
(. 8.44).

. 8.44. ().

(black white),
, -
. ,
,
.
-
, . -
, . 8.31.


, , -

.
, ,

230
. ,
100 150 .
20 ,
.
, , -
. -
, ,
. -
. ,
.
.
. , , -
.
400 . 1 2. -
. 8.45.

. 8.45. .

. 8.46 -
(. ).
5 ,
30 .
http://railab.ru.
http://myrobot.ru1.

. 8.46. .

1
http://myrobot.ru/sport/index.php?n=Reglaments.LineFollowing

231


, ,
, .

,

.

-
-
-
(. 8.78).
-

, -
-

, ,
- - . 8.78.
9797 .
.
(. 8.79)
, 3.
.
(. 8.80).

. 8.79. , , -
.

250
. 8.80. .

, -
:
(. 8.81).

. 8.81. .

, -
, . ,
-
.


, -
, . -
, ,
.
, . . -
.
( ), -
. -
, , -
. ,
10 .
, , -
. ?
. .
(. 8.82). -
.

251
. 8.82. 10 ,
.

-
. ,
(. 8.83). ,
: 1) ,
2) .

. 8.83. .

.
.
, -
. - .
.

252



. -
-.
.
-
.
.
,

, -
. -
, -
.
-,
, -
. -
. -
,
-

(. 8.89). -
: -
. . 8.89. -
, -
.
, (.
8.908.91). . -,
; -,
, -
.
.
.
, -
.

256
. 8.90. . -
, .

. 8.91. -
.

, -
k1 k2. -
. -
, -
.



. , ,
NXT 250 255 .
, -

257
. , ,
.

:
, -
-
.
(. 8.92).
L , , ,
L.

. 8.92. .

,
, L.
. -
k = 16 , d = 16 / 2 = 8 . -
, -
, R1 = L + d R2 = L d.
, , -
v1 v2 :
v1 R1
= .
v2 R2
v
x, L, :
v+x L+d
= , vL + xL - vd - xd = vL + vd - xL - xd , 2 xL = 2vd ,
v-x L-d
vd vd d vd d
x= , v1 = v + = v(1 + ) , v2 = v - = v(1 - ) .
L L L L L

258
v ,
, -
( ). -
, -
. ,
.
u=v*8/L;
motor[motorB]=v+u;
motor[motorC]=v-u;

2L ( -
), . . ,

(. 8.93).

. 8.93. .

task main()
{
float u, k1=2, k2=10;
int v=50, d=8, Sold, L, Snew;
Sold=L=SensorValue[S1]; //
while(true) {
Snew=SensorValue[S1]; //
if (Snew>L*2) {
u=v*d/L;
Sold=L*2;
}
else {
u = k1*(Snew-L) + k2*(Snew-Sold);
Sold=Snew;
}
motor[motorB]=v+u;
motor[motorC]=v-u;
wait1Msec(1);
}
}

259
task main()
{
float u, k1=2, k2=10, a=0.2, Snew;
int v=50, d=8, Sold, L;
Snew=Sold=L=SensorValue[S1];
while(true)
{
Snew=(1-a)*Snew+a*SensorValue[S1];
if (Snew>L*2) {
u=v*d/L;
Sold=L*2;
}
else {
u = k1*(Snew-L) + k2*(Snew-Sold);
Sold=Snew;
}
motor[motorB]=v+u;
motor[motorC]=v-u;
wait1Msec(1);
}
}
,
-
. , , -
. ,
. , ,
.

- Lego 2009
- 239
. -.
, , -
, , -
midi-
. 10 - -
(

).
, , .

262
. 8.96. -
.

Lego
Robolab. -
(. 8.96). - -
(. 8.97), -
, RobotC Java.

. 8.97. -.

-
-, -
. .



. 7.1. ,
(. 8.98). .

263
, , -
. . -
.

. 8.98. .

-
, 2 (. 8.99). -
, , ,
. -
.
.

. 8.99. .


15 () -
(). , Lego,
, ,
, 10 .

,
. -
.

264

,
(. 8.100). -
, .

. 8.100. .


: ,
(. 8.101).

. 8.101. .

, -
. -
. -

. -
,
510 %.
,
A B (. 8.102).

265
. 8.102. .

. 8.103. -:
, .

-

(. 8.103, ). , .
-

(. 8.103, ).


.
, -
. ,
(. 8.104). ,
0.2 : 20 , 40 , 60 . .
, ,
.
.
,
, .

266
. 8.104. .

,
. -
.
,
(. 8.105).

. 8.105. .

: -
A, -
, .

267


-
1, . . .
-
. , , -
. -
-
.
.
2
. . - 239
-.
RobotC.
-
3, ,
. -
, . -
-
() -
.
.

, -
, .
,
, .
Micromouse
. , Lego,
.
16 16 .
, , 5 5
, Lego-:
30 30 . , ,
28 30 .
1
http://kpolyakov.narod.ru/school/robots/robots.htm
2
http://inform239.narod.ru/robot.html
3
http://www.niisi.ru/kumir/

272
.
150 150 , 5 5 .
. -
, 16 , , 10
(. 8.110).
, ,
, .

. 8.110. .


?
, . -
90
, . -
, -
. , -
. -
, ,
,
5 .
, -
.
8547 9797
9695.
8547 .
-
(. 8.1118.117). -
, -
.

273
. 8.111. 11- -
.

. 8.112. 3 5 NXT.

. 8.113. 8-
.

274
. 8.114. NXT -
. 10- .

. 8.115. .

. 8.116. 16- .

275
. 8.117. .

-
, B () C ().
NXT Program.


, , -
. : ,
90 , 90 . -
(. 8.118). , -
, . .
- , ,
. -
.
,
. . .
B, C
1000 B

. 8.118. Robolab.

276
,
30 1000 .
90
500 , 500 .
Robolab
(. 8.119). -
, .

. 8.119. .

, , ,
.
, -
NXT 2.0.
(. 8.120).

. 8.120.
.

-
-
.
, , -
,
5 5,
Robolab. ,

277
, -
.
, !
-
: , ,
.
.
.
90
. ,
, .
NXT
: 3 , 2 -
, 1 . ,
, -
: , .
, -
(. 8.121).
,
,
.

. 8.121. -
.

278
void left() //
{
motor[motorB]=-100;
motor[motorC]=100;
nMotorEncoder[motorC]=0;
while(nMotorEncoder[motorC]<500);
motor[motorB]=motor[motorC]=0;
PlaySound(soundUpwardTones);
wait1Msec(1000);
}
task main() //
{
while(true) {
if(SensorValue[S1]>30) { //
right();
forward();
}
else
if(SensorValue[S2]>30) //
forward();
else
left();
}
}
.
, -
.
, , -
.


NXT
Bluetooth . ,
10 .
,
. -
,
, Bluetooth. -
, -
NXT -

281
: , . -
- NXT-, -
. ,
,
.
:
1) ,
2) ,
3) ,
4) .
Bluetooth-, , -
(master). , , -
(slave).
NXT, (-
1-, 2- 3-).
, -
, RobotC.

, .
. (-
)
.
.
1. NXT , .
2. Bluetooth,

.
3. (Visi-
bility Visible).
4.
(Search).
5. -
.
6. (
1234) .
-
My Contacts.
7. : 1, 2 3.
8.
( ) -
Bluetooth <>. -
, <, . . -
.

282
, ,
, .
, master, slave
.
RCX 1
, NXT : 215 215 1, .. -
32768...32767. ,
, .
NXT- NXT- -
(. 8.125).

. 8.125. 5 () -
().


(. . ) ,
, .
(Wait for mail)
. , -
.

(. 8.126).

. 8.126. 4 5
.


4 5 ,
. -
. -
-
. ,

283

.
, -
0.03 0.05 .
, , ,
, . -
. .
-
,
.
, -
(. 8.127).
, -
, A (8.128).

. 8.127.
.

A -
(Value of Encoder A NXT Commands),
0.05
.
(Value of Mail Modifiers),
(. . ).
A.

. 8.128. ,
.

284
. 8.129. : , -
.

,
(. 8.130).
. 8.129 ,

. ,
.
. 8.129
,
.
100 , 2
100...100, m -
. X -
50 (-
), (
) 0...100.

. 8.130. NXT.

-
, . 8.129, .

(. 8.131). -
-, .

. 8.131. .

285

,

. , -


, ,
,
(-)
. -
-
, -
(. 8.143).
.
. 8.143.
. .
8
, -
. 1 ,
: 0 () 1 (). -
, 2 , -
(. 8.144).


0 ...65535
6444474444 8
00110100
142431001001
142431{
, 7 , S1
e1+ 128
0 ... 255 ( e1+ 128 ) / 2 2

. 8.144. S1.

, -
: 2
2. , -
, S1:

L = (e1 + 128) 256 + (e2 + 128) / 2 2 + S1 32 768.


, :

292
v = (m + 32 768) / 256 128,
u = (m + 32 768) % 256 / 2 2 128,
k = (m + 32 768) % 2,
v = v (k + 1),
u = u (2 k) / 2.

k S1. -
, , . . v -
u (. 8.145).
, ,
.

. 8.145. .

-
.
, 2011 . -
-
(), -
22 22 .
, ,

, .
-
, .

,
. -
. 8.146.
(. 8.145).

293
. 8.146. .

-
, - udar.

.
. 8.147.
- 239 -
. 3 3
5 5 4 6 .
.
, 9797.

. 8.147. .


, (-
, nxtremote). .
.
, , -
, -
.

294
ClearMessage(); // RobotC 3.0
temp = message;
}
if (message!=0)
{
k=message-1; // 1
v=messageParm[1];
u=messageParm[2];
motor[motorA]=v+u;
motor[motorB]=v-u;
nxtDisplayTextLine(0, "k=%d", k);
nxtDisplayTextLine(1, "v=%d", v);
nxtDisplayTextLine(2, "u=%d", u);
wait1Msec(10);
}
}
}
RobotC -
,
Bluetooth, . -
Sample Programs\NXT\Bluetooth Communication.


20- . -
. , -
, -
. -
,
.
, , -
, -
. , -
.


-
-,
.
(. 8.1488.149).

296
. 8.148. NXT -
. - .

. 8.149. .

.
.
-, alpha.
alpha (. 8.150).

. 8.150. .

, ,
-
. , -
.

297

. 8.151. .

. 8.152. .

(.
8.1518.152) . beta
. , -

(. 8.153). , .

. 8.153. --
. .

298

, , -
, , -
.
, -
.
, -
, . , -
,
.


robobook@mail.ru.

309

1. . ., . ., . ., . ., -
. ., . . - -
. . . ., . . .: , 2006.
2. Boogaarts M., Torok R., Daudelin J., et al. The LEGO Mindstorms NXT
Idea Book. San Francisco: No Starch Press, 2007.
3. Isogawa Y. LEGO Technic Tora no Maki, Version 1.00 Isogawa Studio,
Inc., 2007, //
[http://www.isogawastudio.co.jp/legostudio/toranomaki/en/].
4. Constructopedia NXT Kit 9797, Beta Version 2.1, Center for Engineering
Educational Outreach, Tufts University, 2008, //
[http://www.legoengineering.com/library/doc_download/150-nxt-
constructopedia-beta-21.html].
5. Kelly J. F. Lego Mindstorms NXT. The Mayan adventure. Apress, 2006.
6. Wang E. Engineering with LEGO Bricks and ROBOLAB. Third edition.
College House Enterprises, LLC, 2007.
7. Perdue D. J. The Unofficial LEGO MINDSTORMS NXT Inventor's Guide.
San Francisco: No Starch Press, 2007.
8. .., ..
NXT LabVIEW. : , 2010.
9. . , . : . : , 2002.

310

.1.

311
.2.

1
( )

10. :
, ,
, ;
;
5 -
, ;
-
, .

. .2.1. .

11. :
;
;
1 ( );
50 ;
12. :
, -
, ;

1
http://www.myrobot.ru

312
70 ;
120 ;
50 .
13. :
20 , 20 ;
;
;
-
20 20 ;
-
(, , ,
.);
;
-
.
14. :
.
.
.
.
12 15 .

. -
;
,
, ;
,
, ;

;
-
, -
.
.
15. :
( -
);

;
,
, -
,
.

313
.3. - Lego Mindstorms NXT

http://www.mindstorms.com ( Lego)
http://www.mindstorms.su ( Lego
Mindstorms)
http://learning.9151394.ru ( Lego
Mindstorms NXT )
http://www.lugnet.com ( Lego Mindstorms
NXT)
http://www.nxtprograms.com ( Lego
Mindstorms NXT)
http://www.legoengineering.com ( Mind-
storms)
http://nnxt.blogspot.ru/ (
)
http://www.isogawastudio.co.jp/legostudio/toranomaki/en/ (LEGO
Technic Tora no Maki, )

Lego Mindstorms NXT


RobotC: http://www.robotc.net
NBC/NXC (Next Byte Codes & Not eXactly C): -
NBC
http://bricxcc.sourceforge.net/nbc/
Bricxcc
http://bricxcc.sourceforge.net/
LEJOS: Java for Lego Mindstorms: http://lejos.sourceforge.net/
LabVIEW Lego Mindstorms NXT:
www.ni.com/mindstorms
Robolab 2.9 2.9.4:
http://www.legoengineering.com/patches/RL294PowerPatch_PC.zip
Robolab 2.9.4 -
: http://legoengineering.com/library/cat_view/41-
applications-patches-a-firmware/43-robolab.html
QReal Robots, 2D--
, : http://qreal.ru


http://www.myrobot.ru/sport ( : , ,
)
http://railab.ru/ ( -
)
http://wroboto.ru/ ( )

314
http://www.wroboto.org/ ( )
http://239.ru/robot ( -
239 -)

Lego Mindstorms NXT

- Lego Mindstorms NXT David Perdue,


The Unofficial Lego Mindstorms NXT Inventor's Guide. .
http://nxtguide.davidjperdue.com/



(http://mindstorms.lego.com/en-us/support/files/default.aspx)
LUGNET (http://www.lugnet.com)
MOC pages (http://www.mocpages.com)
Brickshelf (http://www.brickshelf.com)
Peeron LEGO Inventories (http://www.peeron.com)
Brickset (http://www.brickset.com)
NXT Programs: Fun Projects for your LEGO MINDSTORMS NXT
(http://www.nxtprograms.com/index.html)
MINDSTORMS NXT Building Instructions
(http://ricquin.net/lego/instructions/)
Technica (http://isodomos.com/technica/technica.html)
Blackbird's Technicopedia (http://www.ericalbrecht.com/technic)


Programming Solutions for the LEGO MINDSTORMS NXT: Which
approach is best for you? NBC and NXC (http://bricxcc.sourceforge.net/nbc)
NBC Debugger for NXT (http://www.sorosy.com/lego/nxtdbg)
BricxCC (http://bricxcc.sourceforge.net)
Programmable Brick Utilities
(http://bricxcc.sourceforge.net/utilities.html)
leJOS NXJ (http://lejos.sourceforge.net)
RobotC (http://www.robotc.net)
Writing Efficient NXT-G Programs:
http://www.firstlegoleague.org/sitemod/upload/Root/WritingEfficientNXTGProg
rams2.pdf
OnBrick NXT Remote Control
(http://www.pspwp.pwp.blueyonder.co.uk/science/robotics/nxt/)
NXTender (http://www.tau.ac.il/~stoledo/lego/NXTender)

315
NXT Programming Software
(http://www.teamhassenplug.org/NXT/NXTSoftware.html)

Bluetooth
MINDSTORMS Bluetooth Resources
http://www.mindstorms.com/bluetooth
NXTBluetoothCompatibilityList:
http://www.vialist.com/users/jgarbers/NXTBluetoothCompatibilityList
Analysis of the NXT Bluetooth-Communication Protocol:
http://www.tau.ac.il/~stoledo/lego/btperformance.html

NXT-
The NXT STEP (http://www.thenxtstep.com)
nxtasy.org (http://www.nxtasy.com)


(LEGO computer-aided design resources):

LEGO Digital Designer (http://ldd.lego.com)


Google SketchUp NXT Parts Library:
http://groups.google.com/group/LegoTechnicandMindstormsNXTParts
LDraw (http://www.ldraw.org)
Tutorial: Setting up LDraw to Create Virtual NXT Robots: from
http://nxtblog.davidjperdue.com
LeoCAD (http://www.leocad.org)
Bricksmith (http://bricksmith.sourceforge.net)
L3P (http://www.hassings.dk/l3/l3p.html)
LDView (http://ldview.sourceforge.net)

(Building techniques)
NXT-based Creations
(http://legoengineering.com/library/cat_view/30-building-instructions/38-nxt-
based-creations.html)
LEGO Education Constructopedia:
http://legoengineering.com/library/doc_details/150-nxt-constructopedia-beta-
21.html

Lego:
http://www.syngress.com/book_catalog/174_lego_robo/chapter_01.htm
LEGO Design (http://www.owlnet.rice.edu/~elec201/Book/legos)

316
Sergei Egorovs LEGO Geartrains
(http://www.malgil.com/esl/lego/geartrains.html)


LEGO Education (http://www.legoeducation.com)
MINDSTORMS Education NXT blog:
http://www.legoeducation.com/community/9/blogs/nxt/default.aspx
LEGO ED West (http://www.legoedwest.com)
LEGO Engineering (http://www.legoengineering.com)
FIRST LEGO League (http://www.firstlegoleague.org)
US FIRST Curriculum Collection:
http://www.usfirst.org/community/
Robotics Academy (http://www-education.rec.ri.cmu.edu)

Lego, Lego (custom hardware)


LEGO Store (http://shop.lego.com)
LEGO Education Store (http://www.legoeducation.us)
BrickLink (http://www.bricklink.com)
HiTechnic (http://www.hitechnic.com)
Mindsensors.com (http://www.mindsensors.com)

Lego

Robotics Learning Store (http://www.roboticslearning.com/store)


Plano Molding Company (http://www.planomolding.com)


David J. Perdue (http://www.davidjperdue.com)
Philippe Hurbain (http://www.philohome.com)
Dave Astolfo (http://www.astolfo.com)
Daniele Benedettelli (http://daniele.benedettelli.com)
Michael Gasperi (http://extremenxt.com/lego.htm)
Matthias Paul Scholz (http://mynxt.matthiaspaulscholz.eu)
Steve Hassenplug (http://www.teamhassenplug.org)
Laurens Valk (http://www.laurensvalk.com)
Jrgen Stuber (http://www.jstuber.net)
Mario Ferrari (http://www.marioferrari.org/lego.html)
Miguel Agullo (http://miguelagullo.net/technicpuppy/)

317
Lego
World Robot Olympiad (http://www.wroboto.org)
LEGO World (http://www.legoworld.nl)
BrickFest (http://www.brickfest.com)
NWBrickCon (http://www.nwbrickcon.org)
BrickFair (http://www.brickfair.com)

318


3-,

. .
.
-,

-
199034, -, , 1
E-mail: main@nauka.nw.ru
Internet: www.naukaspb.spb.ru
02980 06 2000 .
30.01.2013. 70 90 1/16.
. . .
20 . . . 3000 . . 319


-, . ., 60,
.: (812) 333-15-42
: (812) 333-15-41

319

Вам также может понравиться