+ All Categories
Home > Documents > LEGO MINDSTORMS qSimulink Support Package b ; ` hM ...

LEGO MINDSTORMS qSimulink Support Package b ; ` hM ...

Date post: 15-Oct-2021
Category:
Upload: others
View: 1 times
Download: 0 times
Share this document with a friend
8
LEGO MINDSTORMS ͱ Simulink Support Package Λ ར༻ޚڭҭίϯςϯπͷ։ ˓ণʢಠߦ๏ਓߴ ߏػߍߴۀߍʣ Development of Educational Contents for Control Engineering Using LEGO MINDSTORMS and Simulink Support Package M. Kawata (National Institute of Technology, Maizuru College) Abstract– This paper discusses the development of a rotary inverted pendulum using the new LEGO MINESTORMS EV3 for control engineering education. We use Power Functions XL motor with GlideWheel- M (rotary encoder) instead of EV3 motors, and we use GlideWheel-M for detection of a pendulum angle. As a software in order to implement Simulink model, we use “Simulink Support Package for LEGO MIND- STORMS EV3 Hardware” which is provided free of charge. We verify whether it is possible to use our proposed inverted pendulum in order to study the basis of control system analysis/design. Key Words: LEGO MINDSTORMS, Simulink support package, Inverted pendulum, Education 1 Ίʹ LEGO MINDSTORMS LEGO ͱ MIT ʹΑ Γڞಉ։Εڭҭ༻ϩϘοτ۩ͷΩοτͰΓɼ LEGO ςΫχοΫύʔπͰͳɼϞʔλɼηϯαɼ ΠϯςϦδΣϯτϒϩοΫ·ΕΔɽಛผͳ Λʹɼ༰қʹᝑମΛΈΔͱͰΔ ΊɼখߍΒେ·Ͱͷଟͷڭҭػͷतۀ ۀاͷݚमʹར༻ΕΔ 1) ɽଟͷફ PBL ڭҭͰΓɼϥΠϯτϨʔαϩϘίϯͳͲͷڝΛɼ άϧʔϓϫʔΫͰΔɽ ͷ LEGO MINDSTORMS NXT ɼଐ ΔϞʔλϩʔλϦΤϯίʔμΛଂαʔϘϞʔ λͰΔͷͰɼϞʔγϣϯίϯτϩʔϧͷجͰΔ ޚΛ༰қʹߦͱͰΔɽɼαʔϘ Ϟʔλͷߏతͳ LEGO ७ਖ਼ͷηϯαͷछ ͷগͳཁҼͰɼʮޚʯͷڭҭʹ׆ۃΊগͳ 2)–4) ɽͰɼචɼNXT Ͱ ͳ LEGO Power Functions ͷϞʔλɼαʔυύʔ ςΟͷηϯαΛซ༻ΔͱͰɼճసܕTable 1: NXT and EV3 intelligent brick NXT EV3 Main processor ARM7 48MHz ARM9 300MHz Operating system Proprietary Linux-based Main memory 256KB flash 64KB RAM 16MB flash 64MB RAM Motor ports 3 (with encoders) 4 (with encoders) Sensor ports 4 4 USB communication 12 Mbit/s 480 Mbit/s USB host Wi-Fi dongle, Ethernet adaptor, USB storage SD card Micro SD card (up to 32 GB) Communication USB, Bluetooth USB, Bluetooth, Wi-Fi (Ethernet) User interface 4 Buttons 6 Buttons with backlight ΛΔͱΛఏҊ 5), 6) ɽ·ɼͷճసܕ ΛͱɼPID ޚɼύϥϝʔλಉఆɼঢ় ଶϑΟʔυόοΫ ޚ(ۃஔɼ దϨΪϡϨʔλ)ɼΦ ϒβʔόͳͲΛՌతʹशͰΔڭҭίϯςϯπΛ 5), 6) ɽιϑτΣΞͱɼޚͷ Ͱඪ४తͳ MATLAB ͷ Simulink Support Package (MathWorks ΒແঈͰఏڙ) Λར༻ɼSimulink ϞσϧΒ NXT ΛతʹۦಈΔɽ ߘͰɼͷڭҭίϯςϯπΛୈͷ LEGO MINDSTORMS EV3 ʹுΔͱΛ౼ݕΔɽ 2 LEGO MINDSTORMS ͱ Simulink Support Package 2.1 LEGO MINDSTORMS 2.1.1 ΠϯςϦδΣϯτϒϩοΫ LEGO MINDSTORMS ʹϚΠίϯɼηϯαɾϞʔ λۦಈ༻ͷճ࿏ͳͲΛඋΠϯςϦδΣϯτϒϩοΫ ·ΕΔɽNXT ͱ EV3 ͷΠϯςϦδΣϯτϒϩο ΫͷΛൺͷΛ Table 1 ʹɽ NXT ઐ༻ͷ OS ΕΓɼΘඵ Ͱ OS ͷى(starting) (shutting down) Մ ͰΔɽɼޙड़ͷ Simulink Support Package Λར༻Ε Simulink ϞσϧΛΤΫελʔ φϧϞʔυ ( 1) ͰߦΔͱɼߦऴΔͱʹ ಈతʹݯ OFF ʹͳΔɽΕʹରɼEV3 OS ͰΔ Linux ΕΓɼOS ͷىಈʹ 30 [s] ఔɼऴʹ 50 [s] ఔͷΛཁΔɼ Simulink Ϟσϧͷߦݯ ON ͷ·· ͰΔɽͷΊɼMATLAB Ͱ for i = 1:5 set_param(’hoge’, ’SimulationCommand’, ’start’) pause(10) end ( 1) Simulink ϞσϧͷߦϞʔυʹɼϊʔϚϧϞʔυͱΤΫε λʔφϧϞʔυΔɽϊʔϚϧϞʔυ Simulink Ϟσϧ ͷߦϑΝΠϧΛΠϯςϦδΣϯτϒϩοΫʹసૹɼΠϯς ϦδΣϯτϒϩοΫଆͰߦΔɽΕʹରɼΤΫελʔ φϧϞʔυύιίϯଆͰߦΔΊɼSimulink ϒϩοΫ Scope, Display ʹΑΓϦΞϧλΠϜͰ৴߸Λ؍ଌΓɼTo Workspace ʹΑΓ MATLAB ͷϫʔΫεϖʔεʹ৴߸ͷ ΛอଘΔͱͰΔɽ 1D07-1 第57回自動制御連合講演会 2014年11月10日ー12日 群馬伊香保 ホテル天坊 14PR0002/14/0000-0598 ¥400 © 2014 SICE 598
Transcript
Page 1: LEGO MINDSTORMS qSimulink Support Package b ; ` hM ...

LEGO MINDSTORMS Simulink Support Package

Development of Educational Contents for Control Engineering

Using LEGO MINDSTORMS and Simulink Support Package

∗M. Kawata (National Institute of Technology, Maizuru College)

Abstract– This paper discusses the development of a rotary inverted pendulum using the new LEGOMINESTORMS EV3 for control engineering education. We use Power Functions XL motor with GlideWheel-M (rotary encoder) instead of EV3 motors, and we use GlideWheel-M for detection of a pendulum angle.As a software in order to implement Simulink model, we use “ Simulink Support Package for LEGO MIND-STORMS EV3 Hardware ” which is provided free of charge. We verify whether it is possible to use ourproposed inverted pendulum in order to study the basis of control system analysis/design.

Key Words: LEGO MINDSTORMS, Simulink support package, Inverted pendulum, Education

1

LEGO MINDSTORMS LEGO MIT

LEGO

1) PBL

LEGO MINDSTORMS NXT

LEGO

2)–4) NXTLEGO Power Functions

Table 1: NXT and EV3 intelligent brick

NXT EV3

Main processor ARM7 48MHz ARM9 300MHzOperating system Proprietary Linux-based

Main memory 256KB flash64KB RAM

16MB flash64MB RAM

Motor ports 3 (with encoders) 4 (with encoders)

Sensor ports 4 4USB communication 12 Mbit/s 480 Mbit/s

USB host —Wi-Fi dongle,Ethernet adaptor,USB storage

SD card — Micro SD card(up to 32 GB)

Communication USB, BluetoothUSB, Bluetooth,Wi-Fi (Ethernet)

User interface 4 Buttons6 Buttons withbacklight

5),6)

PID( )

5),6)

MATLAB Simulink Support Package(MathWorks ) Simulink

NXT

LEGOMINDSTORMS EV3

2 LEGO MINDSTORMS Simulink

Support Package

2.1 LEGO MINDSTORMS

2.1.1

LEGO MINDSTORMS

NXT EV3Table 1

NXT OSOS (starting) (shutting down)

Simulink Support PackageSimulink

( 1)

OFF EV3OS Linux OS

30 [s] 50 [s]Simulink ON

MATLAB

for i = 1:5

set_param(’hoge’, ’SimulationCommand’, ’start’)

pause(10)

end

( 1) SimulinkSimulink

SimulinkScope, Display ToWorkspace MATLAB

1D07-1第57回自動制御連合講演会2014年11月10日ー12日 群馬伊香保 ホテル天坊

14PR0002/14/0000-0598 ¥400 © 2014 SICE598

Page 2: LEGO MINDSTORMS qSimulink Support Package b ; ` hM ...

Simulink hoge.slx

NXT Simulink SupportPackage 3

EV3USB

microSD( ) NXT

A∼C 3 EV3 A∼D4 ( )

NXT, EV3 1∼ 4 4

NXT, EV3 USB Bluetooth( 2)

EV3USB Wi-Fi ( )

Ethernet ( ) LAN( 3)

2.1.2

NXT

• 2

• 1

• 1

• 1

EV3

• 2

• 1

• 1

• 1

EV3NXT

( 4)

2.1.3

Fig. 1 (a) NXT EV3

NXT

• NXT 3

EV3

• EV3 L 2

• EV3 M 1

1180 A, B

Simulink Support PackageA, B 2 1360 1 [deg]

NXT EV3 L

EV3 M

(3.1 )

( 2) Bluetooth Bluetooth

( 3) LAN Wi-Fi Ethernet

( 4)

EV3

L servo motor

EV3

M servo motor

NXT

servo motor

(a) LEGO MINDSTORMS

PF

XL motor

PF

L motor

PF

M motor

PF

E motor

(b) LEGO Power Functions

Fig. 1: LEGO motors

PF XL motor GlideWheel-M(rotary encoder)

Servo motor

Fig. 2: PF XL motor with GlideWheel-M

3.1Fig. 1 (b) LEGO Power Functions

(PF E/M/L/XL )DC

Fig. 2 mindsen-sors.com GlideWheel-M( 5)

GlideWheel-M1 180 A, B

21 [deg]

2.2 Simulink Support Package

2.2.1

LEGO MINDSTORMSNXT/EV3

C ROBOTC

• NXT/EV3

• ROBOTC

MATLAB/SimulinkWindows R2012a

( 5) TechShare (http://store.techshare.jp/)ROBO Product (http://www.roboproduct.com/)

599

Page 3: LEGO MINDSTORMS qSimulink Support Package b ; ` hM ...

( )Simulink Support Pack-

age R2014aArduino (Uno/Nano/Mega2560 7) Due)

LEGO MINDSTORMS (NXT 5) EV3) Bea-gleBoard, Gumstix Overo, PandaBoard, RaspberryPi, Samsung GALAXY Android

Simulink

2.2.2 Simulink Support Package for LEGOMINDSTORMS NXT Hardware

NXT Simulink Support Package R2012bFig. 3

LEGOHiTechnic (

)

✿✿✿✿✿✿✿✿✿✿✿✿✿✿✿✿✿✿✿✿✿✿✿✿✿✿✿✿✿✿✿✿✿✿✿✿✿✿✿✿✿✿✿✿✿✿✿✿✿✿✿

Bluetooth

✿✿✿✿✿✿✿✿✿✿✿✿✿✿✿✿✿✿✿✿✿✿✿

NXTBluetooth

COM5)

Fig. 4 PI–D ( PID) Simulink hoge NXT.slx

“ ”“ ode1 (Euler) ” ( ) “

( ) ” 0.01( 6)

• Simulink Encoder int32double

Simulink Data Type Conversion

double ( )

• Simulink Encoder “ Sampletime ” 0.1

0.01

• MATLAB

0 [s] 1∼ 2[s]

2.2.3 Simulink Support Package for LEGOMINDSTORMS EV3 Hardware

EV3 Simulink Support Package R2014a(R2013b

)✿✿✿✿

USB✿✿✿✿✿✿✿✿✿✿✿✿✿

Bluetooth✿✿✿✿✿✿✿✿✿✿✿✿✿✿

✿✿✿✿✿✿✿✿✿✿✿✿✿✿✿✿✿✿✿✿✿✿✿✿✿✿✿

Wi-Fi✿✿✿✿✿✿✿✿✿✿✿✿✿✿✿✿✿✿✿✿

Ethernet✿✿✿✿

✿✿✿✿✿✿✿✿✿✿✿✿✿✿✿✿✿✿✿✿✿✿✿✿

LAN✿✿✿✿✿✿✿✿✿✿✿✿✿✿✿✿✿✿✿✿✿✿✿✿✿

MAT-LAB

Windows/ /

( )( ) MATLAB

( 6) 10 [ms]

LEGO MINDSTORMS NXT

Copyright 2011-2013 The MathWorks, Inc.

Freq

Vol

LEGO

Speaker

Port A

LEGO

Motor

Line 1

LEGO

LCD

Mailbox 1

Data

Size

LEGO

Receive via Bluetooth(R) Connection

Port 1

X

Y

Z

LEGO

Acceleration Sensor

LEGO

Timer

Port 1

LEGO

Gyro Sensor

Port 1

LEGO

Sound Sensor

Mailbox 1

LEGO

Send via Bluetooth(R) Connection

Port A

LEGO

Encoder

Port 1

R

G

B

LEGO

Color Sensor

Port 1

LEGO

Ultrasonic Sensor

LEGO

Battery

LEGO

Button

Port 1

LEGO

Touch Sensor

Port 1

LEGO

Light Sensor

Port 1

LEGO

Compass Sensor

Port 1

LEGORed

Blue

IR Receiver Sensor

Examples forLEGO MINDSTORMS

NXT

[Examples]

Port 1

Lat

Lon

LEGO

GPS Sensor

Fig. 3: Simulink Support Package for LEGO MIND-STORMS NXT Hardware (R2014a)

In1 Out1

Subsystem

(Motor)

In1

In2

Out1

Subsystem

(PI-D Controller)

Step

Clock

t

To Workspace

y

To Workspace1

Scope

Line 1

LEGO

LCD

(a) hoge NXT.slx

Port A

LEGO

Encoder

Port A

LEGO

Motor

Saturation

double

Data Type Conversion

1

In1

1

Out1

(b) Subsystem (Motor)

1

In1

1

Out1

2

In2

kP

Gain

kI

Gain1

1s

Integrator

du/dt

Derivative

1

0.025s+1

Transfer Fcn

kD

Gain2

(c) Subsystem (PI-D Controller)

Fig. 4: Example of Simulink model (NXT Hardware)

Fig. 6 PI–D Simulinkhoge EV3.slx

Subsystem (PI-D Controller) Fig. 6 (c)NXT

GlideWheel-M SimulinkEncoder Encoder “ Resetmode ” No reset GlideWheel-M No reset

600

Page 4: LEGO MINDSTORMS qSimulink Support Package b ; ` hM ...

LEGO MINDSTORMS EV3

Copyright 2013 The MathWorks, Inc.

Freq

Vol

LEGO EV3

Speaker

Port 1

LEGO EV3

Touch Sensor

Port 1

LEGO EV3

Ultrasonic Sensor

Port 1

LEGO EV3

Gyro Sensor

Port 1

LEGO EV3

Color Sensor

Port A

LEGO EV3

Motor

Port A

LEGO EV3

Encoder

Up

LEGO EV3

Button

Line 1

LEGO EV3

Display

Port 1

LEGO EV3

Infrared Sensor

LEGO EV3

Status Light

Examples forLEGO MINDSTORMS

EV3

[Examples]

Fig. 5: Simulink Support Package for LEGO MIND-STORMS EV3 Hardware (R2014a)

In1 Out1

Subsystem

(Motor)

In1

In2

Out1

Subsystem

(PI-D Controller)

Step

Clock

t

To Workspace

y

To Workspace1

Scope

Line 1

LEGO EV3

Display

(a) hoge EV3.slx

Saturation

double

Data Type Conversion

1

In1

1

Out1Port A

LEGO EV3

Encoder

Port A

LEGO EV3

Motor

Clock

> 0

Switch

1

Constant1

0

Constant

int8

Data Type Conversion1

(b) Subsystem (Motor)

Fig. 6: Example of Simulink model (EV3 Hardware)

OFF“ Reset

mode ” Reset by external signal

Fig. 6 (b)Encoder 0

3

3.1

Fig. 1 (a) NXTEV3 L/M Fig. 1 (b) PFXL/L/M/E

GlideWheel-MLEGO 8)

LEGO (NXT, EV3)

Table 2: Comparison of LEGO motors (no load)

(a) NXT intelligent brickMotor Dead zone ymax [deg/s] α β

NXT |u(t)| ≤ 3 942 9.5 −12.6

EV3 L |u(t)| ≤ 4 977 9.8 −16.3

EV3 M |u(t)| ≤ 19 1,434 16.0 −133.4

PF XL |u(t)| ≤ 6 1,250 12.7 −33.9

PF L |u(t)| ≤ 12 2,142 23.6 −213.4

PF M |u(t)| ≤ 16 2,268 23.4 −101.4

PF E |u(t)| ≤ 4 4,298 43.7 −82.7

(b) EV3 intelligent brickMotor Dead zone ymax [deg/s] α β

NXT — 950 9.1 23.8

EV3 L — 974 9.4 21.1

EV3 M — 1,458 13.1 174.7

PF XL |u(t)| ≤ 3 1,250 12.3 8.5

PF L |u(t)| ≤ 6 2,087 21.7 −104.2

PF M |u(t)| ≤ 16 2,288 23.2 −89.0

PF E |u(t)| ≤ 2 4,234 41.7 74.9

1000

--100

Dead zone

1000

--100

(a) NXT intelligent brick (b) EV3 intelligent brick

Fig. 7: Motor velocity

u(t) = uc (uc 1 ∼ 100 )h = 0.01 [s] y(t) [deg]

Table 2ymax [deg/s] (uc = 100

)y∞ [deg/s] 1

y∞ = αuc + β (1)

α, β

NXT Table 2 (a)β

(Fig. 7 (a)) β NXT, EV3L PF XL/E

y(s) = P (s)u(s), P (s) =b

s(s + a)(2)

NXT, EV3 L

PF ENXT

PF XL

EV3 Table 2 (b)NXT ymax

601

Page 5: LEGO MINDSTORMS qSimulink Support Package b ; ` hM ...

Pendulum

Arm

GlideWheel-Mfor pendulum

PF XL motorwith

GlideWheel-M

NXT intelligentbrick

Pendulum

PF XL motorwith

GlideWheel-M

EV3 intelligentbrick

Arm

GlideWheel-Mfor pendulum

Wi-Fidongle

(a) NXT version5) (b) EV3 version

Fig. 8: LEGO rotary inverted pendulum

βFig. 7

(b) PF XLβ 0

EV3 Mβ ( )

3.2

GlideWheel-M ( 7)

3.1GlideWheel-M PF XLFig. 8 NXT EV3

90 GlideWheel-M GlideWheel-M

3

3.3

3.3.1

J2 = J2 + m2l22

θ1 = − aθ1 − asgnsgn θ1 + bv (3)

m2L1l2 cos θ2 · θ1 + J2θ2

= J2θ21 sin θ2 cos θ2 + m2gl2 sin θ2 − c2θ2 (4)

5) θ1 [rad]θ2 [rad] ( ) v

(−100 ∼ 100)L1 = 7.10×10−2 [m]

m2 = 4.00×10−3 [kg] l2 = 7.10×10−2

[m] g = 9.81 [m/s2]a, asgn, b

J2 [kg·m2]

( 7) GlideWheel-MTechShare

c2 [kg·m2/s]

3.3.2

(a) NXT

(3)asgnsgn θ1 (2)

u = v, y = θ1 P

u(s) = kPe(s), e(s) = r(s) − y(s) (5)

y rr y G(s) 2

G(s) =ω2

n1

s2 + 2ζ1ωn1s + ω2n1

,

{ω2

n1 = bkP

2ζ1ωn1 = a(6)

Amax

kP, r Amax

Tp ζ1, ωn1

a, b Fig. 9 (a)NXT a, b

NXTFig. 9

(a)

NXTasgnsgn θ1

M f1(t)p1 = Nf1(t) (7)

M f1(t) = Gf1(s)M1(t), Nf1(t) = Gf1(s)N1(t),

M1 =[−θ1 −sgnθ1 v

], p⊤

1 =[a asgn b

], N1 = θ1

( 8)

J = ‖M fs1p1 − Nfs1‖ (8)

p1

p1 = (M⊤

fs1M fs1)−1M⊤

fs1Nfs1 (9)

( )5) Gf1(s) =1/(1+Tf1s)

3 3t = t1, . . . , tk

M fs1 =

M f1(t1)

...M f1(tk)

, Nfs1 =

Nf1(t1)

...Nf1(tk)

0 0.2 0.4 0.6 0.8 10

30

60

t [s]

θ1(t)[deg]

ExperimentSimulation

0 0.2 0.4 0.6 0.8 10

30

60

t [s]

θ1(t)[deg]

ExperimentSimulation

(a) NXT version (b) EV3 version

Fig. 9: Arm parameter identification (2nd order lagsystem)

( 8) θ1 θ1 θ1

602

Page 6: LEGO MINDSTORMS qSimulink Support Package b ; ` hM ...

0 0.2 0.4 0.6 0.8 10

30

60

t [s]

θ1(t)[deg]

ExperimentNonlinearSimulation

Fig. 10: Arm parameter identification using NXTversion (least square method)

Table 3: Identification result of armNXT version EV3 version

Method 1 Method 2 Method 1

a 1.32 × 101 1.28 × 101 1.42 × 101

asgn 0 6.96 × 100 0

b 2.97 × 100 3.14 × 100 3.45 × 100

Method 1: identification based on 2nd lag system responseMethod 2: identification based on least square method

«

Fig. 10 asgnsgn θ1

NXT asgn

NXTTable 3

(b) EV3

Fig. 9 (b) EV3 2a, b

EV3

Fig. 9 (b)0

EV3

2

EV3Table 3

3.3.3

NXT EV3

(θ2 = φ2 + π)(4)

J2φ2 + c2φ2 + m2gl2 sinφ2 = 0 (10)

sin φ2 ≃ φ2 (10) 2

φ2 + 2ζ2ωn2φ2 + ω2n2φ2 = 0,

{ω2

n2 = c2/J2

2ζ2ωn2 = m2gl2/J2

(11)

Ti λi T , λ

1 2 3 4 5 60

0.25

0.5

0.75

1

i

TiandT

[s]

1 2 3 4 5 60

0.25

0.5

0.75

1

i

λiandλ

(a) Ti and T (b) λi and λ

0 1 2 3 4 5

−90

−45

0

45

90

t [s]

φ2(t)[deg]

ExperimentLinear Simulation

0 1 2 3 4 5

−90

−45

0

45

90

t [s]

φ2(t)[deg]

ExperimentNonlinear Simulation

(c) Linear simulation (d) Nonlinear simulation

Fig. 11: Pendulum parameter identification (2nd or-der lag system)

0 1 2 3 4 5

−90

−45

0

45

90

t [s]φ2(t)[deg]

ExperimentNonlinear Simulation

Fig. 12: Pendulum parameter identification (leastsquare method)

Table 4: Identification result of pendulum

Method 1 Method 2

J2 1.33 × 10−5 9.27 × 10−6

c2 1.58 × 10−5 1.33 × 10−5

Method 1: identification based on 2nd lag system responseMethod 2: identification based on least square method

«

ζ2, ωn2

J2, c25) Fig. 11

Fig. 11 (a), (b)Ti, λi

Fig. 11 (c), (d)sinφ2 ≃ φ2

sinφ2

NXT

M f2(t)p2 = Nf2(t) (12)

M f2(t) = Gf2(s)M2(t), Nf2(t) = Gf2(s)N2(t),

M2 =[φ2 φ2

], p⊤

2 =[J2 c2

], N2 = −m2gl2 sinφ2

sinφ25) Fig. 12

Table 4

603

Page 7: LEGO MINDSTORMS qSimulink Support Package b ; ` hM ...

3.3.4

(a) NXT

NXT asgnsgn θ1

v = u +asgn

bsgn θ1 (13)

(3)

θ1 = − aθ1 + bu (14)

cos θ2 ≃ 1, sin θ2 ≃ θ2

(4)

m2L1l2θ1 + J2θ2 = m2gl2θ2 − c2θ2 (15)

x =[x1 x2 x3 x4

]⊤ =

[θ1 θ2 θ1 θ2

]⊤ (16)

x = Ax + Bu (17)

(b) EV3

EV3 asgnsgn θ1

asgn = 0 u = v(14) NXT

(4) x

(16) (17)

3.4 ( )

(a) NXT

(17)

J =

∫∞

0

(x⊤Qx + Ru2

)dt (18)

u = Kx (19)

Q = diag{50, 2000, 0.01, 0.01

}, R = 1 K

h = 0.01[s]

ωi(s) =s

1 + Tisθi(s) (Ti = 0.06, i = 1, 2) (20)

1 ωi(t) = θi(t)

0 2 4 6 8−60

−30

0

30

60

t [s]

θ1(t)[deg]

withnonlinear

compensator

withoutnonlinear

compensator

0 2 4 6 8−10

−5

0

5

10

t [s]

θ2(t)[deg]

Fig. 13: State feedback control using NXT version(effectiveness of nonlinear compensator)

0 1 2 3 4 5 6−90

−45

0

45

90

t [s]

θ1(t)[deg]

0 1 2 3 4 5 0−20

−10

0

10

20

t [s]

θ2(t)[deg]

(a) NXT version

0 1 2 3 4 5 6−90

−45

0

45

90

t [s]

θ1(t)[deg]

0 1 2 3 4 5 0−20

−10

0

10

20

t [s]

θ2(t)[deg]

(b) EV3 version

Fig. 14: State feedback control (impression of im-pulse disturbance to pendulum at t = 3 [s])

(13) t =4 [s] v = u Fig. 13

(13)Fig. 14 (a)

t = 3 [s]

(b) EV3

NXT Q, R(17) (18)

(19)Fig. 14 (b) t = 3 [s]

NXT EV3

EV3

3.5

(a) NXT

ωi(t) = θi(t)

˙x = Ax + Bu − L(y − Cx

)(21)

x =[x1 x2 x3 x4

]⊤ x

y

y =[θ1 θ2

]⊤ = Cx, C =

[1 0 0 00 1 0 0

](22)

(21) x3

(13)

v = u +asgn

bsgn x3 (23)

x (19)

{˙x = Ax + By

u = Cx,

{A = A + BK + LC

B = −L, C = K(24)

604

Page 8: LEGO MINDSTORMS qSimulink Support Package b ; ` hM ...

0 2 4 6 8−60

−30

0

30

60

t [s]

θ1[deg]

withnonlinear

compensator

withoutnonlinear

compensator

0 2 4 6 8−10

−5

0

5

10

t [s]

θ2[deg]

Fig. 15: Observer based output feedback control us-ing NXT version (effectiveness of nonlinearcompensator)

(24)1

h = 0.01 [s]{

x[k + 1] = Adx[k] + Bdy[k]

u[k] = Cdx[k] + Ddy[k](25)

f [k] := f(kh) (k = 0, 1, 2, . . .)

K

L A+BK

−16± 8j, −4, −1.5 A + LC

5 K, L

t = 4 [s] (23) v = uFig. 15 Fig. 15

(23)NXT

t = 3 [s]Fig. 16 (a) θ1,

θ2 (20)

(b) EV3

EV3 NXT(23) v = u

NXTA+BK −16±8j, −4, −1.5 A+LC

5 K, L

(25)Fig. 16 (b) t = 3

[s] Fig. 16 (b)EV3

4

LEGO MINDSTORMSEV3Simulink Support Package

GlideWheel-MLEGO NXT EV3

NXT EV3 PF XLNXT

0 1 2 3 4 5 6−90

−45

0

45

t [s]

θ1andx1[deg]

θ1x1

0 1 2 3 4 5 6−10

0

10

20

t [s]

θ2andx2[deg]

θ2x2

0 1 2 3 4 5 6−600

−300

0

300

t [s]

θ1andx3[deg/s]

θ1x3

0 1 2 3 4 5 6−100

0

100

200

t [s]

θ2andx4[deg/s]

θ2x4

(a) NXT version

0 1 2 3 4 5 6−90

−45

0

45

t [s]

θ1andx1[deg]

θ1x1

0 1 2 3 4 5 6−10

0

10

20

t [s]

θ2andx2[deg]

θ2x2

0 1 2 3 4 5 6−600

−300

0

300

t [s]

θ1andx3[deg/s]

θ1x3

0 1 2 3 4 5 6−100

0

100

200

t [s]

θ2andx4[deg/s]

θ2x4

(b) EV3 version

Fig. 16: Observer based output feedback control(impression of impulse disturbance to pen-dulum at t = 3 [s])

EV3

EV3

1) Mindstorms Vol. 21,No. 5, pp. 517–559 (2006)

2) P. J. Gawthrop and E. W. McGookin: A LEGO-BasedControl Experiment, IEEE Control Systems Magazine,Vol. 24, No. 5, pp. 43–56 (2004)

3) NXTway (LEGO Segway) —LEGO Mind-storms NXT — 7 SICE

63–1–4 (2007)4) S. S. Prieto, T. A. Navarro, M. G. Plaza and O. R. Polo: A

Monoball Robot Based on LEGO Mindstorms, IEEE Con-trol Systems Magazine, Vol. 32, No. 2, pp. 71–83 (2012)

5) MATLAB/Simulink —PID— TechShare (2013)

6) LEGO MINDSTORMS NXT MATLAB/Simulink—

13 SICE 7D4–4(2013)

7) Arduino MATLAB !TechShare (2012)

8) Philo’s Home Page: http://www.philohome.com/motors/motorcomp.htm

605


Recommended