33
Introduction to LEGO NXT robotics and Robot Sumo for CJ Chung Associate Professor of Computer Science Founder and Director of Robofest Lawrence Technological University

Introduction to LEGO NXT robotics and Robot Sumo for CJ Chung Associate Professor of Computer Science Founder and Director of Robofest Lawrence Technological

Embed Size (px)

Citation preview

Page 1: Introduction to LEGO NXT robotics and Robot Sumo for CJ Chung Associate Professor of Computer Science Founder and Director of Robofest Lawrence Technological

Introduction to LEGO NXT robotics and Robot Sumo for

CJ ChungAssociate Professor of Computer Science Founder and Director of RobofestLawrence Technological University

Page 2: Introduction to LEGO NXT robotics and Robot Sumo for CJ Chung Associate Professor of Computer Science Founder and Director of Robofest Lawrence Technological

This program is possible thanks to:

a grant from Detroit Auto Dealers Association (DADA) Charitable Foundation Fund,

which is a fund of the Community Foundation for Southeast Michigan.

For more details, check out a press release at: http://www.ltu.edu/news/detail.asp?ContentId=F43D8217-293D-480E-B657-54392CB1171A

Page 3: Introduction to LEGO NXT robotics and Robot Sumo for CJ Chung Associate Professor of Computer Science Founder and Director of Robofest Lawrence Technological

Schedule

First Workshop Day (3 hours) Second Workshop Day (3 hours) Third Workshop Day (2 hours) Meetings with your school staff/teachers

to improve your sumoBot (3 hours x 2 meetings suggested)

Official Competition at your school to select one team to advance to the World Robofest Championship on April 26. General public to be invited.

Page 4: Introduction to LEGO NXT robotics and Robot Sumo for CJ Chung Associate Professor of Computer Science Founder and Director of Robofest Lawrence Technological

Workshop First Day (3 hours)

Introduction to Robotics Introduction to Robofest and Robot Sumo Introduction to Lego NXT Introduction to NXTG Basic programs

Motors Wait Turns

Page 5: Introduction to LEGO NXT robotics and Robot Sumo for CJ Chung Associate Professor of Computer Science Founder and Director of Robofest Lawrence Technological

Introduction to Robotics

What is a true robot? autonomous robot with an on board computer Mechanical, electrical, and computational

components Six fundamental components of a robot

A brain or brains – computer Body: physical chasses that holds other pieces Actuators: motors, hydraulic pistons, pneumatics Sensors Power sources Communication mechanism

Page 6: Introduction to LEGO NXT robotics and Robot Sumo for CJ Chung Associate Professor of Computer Science Founder and Director of Robofest Lawrence Technological

What is Robofest?

100% Autonomous Affordable Challenging: Unknown problem No direct adult help allowed during the

competition Qualifiers and a World Championship Various categories including Robot Sumo Two divisions:

5th – 9th grade: Jr. Division 9th – 12th grade: Sr. Division

Page 7: Introduction to LEGO NXT robotics and Robot Sumo for CJ Chung Associate Professor of Computer Science Founder and Director of Robofest Lawrence Technological

RoboSumo

Push the other robot out of the Sumo ring

Page 8: Introduction to LEGO NXT robotics and Robot Sumo for CJ Chung Associate Professor of Computer Science Founder and Director of Robofest Lawrence Technological

Specifications

  Junior Division Senior Division

Sumo ring diameter 77 cm (30 inches) 122 cm (48 in)

Maximum robot mass

1kg (2.2 lbs) 2 kg (4.4 lbs)

Maximum robot width and length

23 cm (9 inches)30 cm (11.75

inches)

Maximum robot height

no limit 30 cm (11.75

inches)

Robot type Any;Lego Mindstorms or NXT

recommended. any

Page 9: Introduction to LEGO NXT robotics and Robot Sumo for CJ Chung Associate Professor of Computer Science Founder and Director of Robofest Lawrence Technological

Why Sumo?

The most popular robot competition in the world

Integrator in Science Education – Math, Logic, Computers, Mechanics, and Physics

Good for rookie teams Fun Motivator

Page 10: Introduction to LEGO NXT robotics and Robot Sumo for CJ Chung Associate Professor of Computer Science Founder and Director of Robofest Lawrence Technological

Unknown Problem in Robofest Sumo

How to start is unknown Need sensor(s) Teams must bring a computer to program

the unknown parts

Page 11: Introduction to LEGO NXT robotics and Robot Sumo for CJ Chung Associate Professor of Computer Science Founder and Director of Robofest Lawrence Technological

Introduction to Lego NXT

Brain – RCX micro computer Body: Lego Technic pieces Actuators: up to 3 motors Sensors: Light, touch, US, Sound, etc. Power source: 9V (six AA batteries or

rechargeable battery pack) Communication mechanism: USB or Blue

Tooth

Page 12: Introduction to LEGO NXT robotics and Robot Sumo for CJ Chung Associate Professor of Computer Science Founder and Director of Robofest Lawrence Technological

Introduction to “SB2 (Sumo Bot 2)”

Left motor: A Right motor: C Touch: 1 Light: 3 Ultra Sonic

(distance): 4

Page 13: Introduction to LEGO NXT robotics and Robot Sumo for CJ Chung Associate Professor of Computer Science Founder and Director of Robofest Lawrence Technological

Introduction to NXTG Programming

Please go through Getting Started and Software Overview after this class

Page 14: Introduction to LEGO NXT robotics and Robot Sumo for CJ Chung Associate Professor of Computer Science Founder and Director of Robofest Lawrence Technological

First NXT program: Go forward for 2 sec. and stop

Let’s name the program first

Click on Go >> button You’ll see a

programming palette (canvas)

Page 15: Introduction to LEGO NXT robotics and Robot Sumo for CJ Chung Associate Professor of Computer Science Founder and Director of Robofest Lawrence Technological

First NXT program using SB1: Go forward for 2 sec. and stop (2/3)

Click on Move button Drag and drop the move block to

the canvas

Page 16: Introduction to LEGO NXT robotics and Robot Sumo for CJ Chung Associate Professor of Computer Science Founder and Director of Robofest Lawrence Technological

First NXT program using SB2: Go forward for 2 sec. and stop (3/3)

Change parameters for the Move Port Direction Steering Power Duration Next Action

Block

Configuration Panel

Page 17: Introduction to LEGO NXT robotics and Robot Sumo for CJ Chung Associate Professor of Computer Science Founder and Director of Robofest Lawrence Technological

How to run your first program (1/2)

Page 18: Introduction to LEGO NXT robotics and Robot Sumo for CJ Chung Associate Professor of Computer Science Founder and Director of Robofest Lawrence Technological

How to run your 1st program (2/2)

If “Found New Hardware” pops up, just follow the instruction

Click on “Download” button Recommended to un-plug the

cable from the Bot Press the orange button 4 times

(Turn on, My files, Software files, Run your program entitled go2stop)

Page 19: Introduction to LEGO NXT robotics and Robot Sumo for CJ Chung Associate Professor of Computer Science Founder and Director of Robofest Lawrence Technological

How to rerun the program

Check the program name on the LCD Press the orange button just once again

Page 20: Introduction to LEGO NXT robotics and Robot Sumo for CJ Chung Associate Professor of Computer Science Founder and Director of Robofest Lawrence Technological

How to stop the program

Gray button

Page 21: Introduction to LEGO NXT robotics and Robot Sumo for CJ Chung Associate Professor of Computer Science Founder and Director of Robofest Lawrence Technological

First NXT Program: Go forward for 2 sec. and stop (Review)

Page 22: Introduction to LEGO NXT robotics and Robot Sumo for CJ Chung Associate Professor of Computer Science Founder and Director of Robofest Lawrence Technological

Do not forget:

Save your programs Meaningful file (program) names Use comments

Page 23: Introduction to LEGO NXT robotics and Robot Sumo for CJ Chung Associate Professor of Computer Science Founder and Director of Robofest Lawrence Technological

2nd Program: ForwardBack

1. Go Forward 2 rotations2. Wait 3 seconds, then 3. Backward 1 rotation

Page 24: Introduction to LEGO NXT robotics and Robot Sumo for CJ Chung Associate Professor of Computer Science Founder and Director of Robofest Lawrence Technological

Go Forward 2 rotations, Wait 3 seconds then Backward 1 rotation – ForwardBack

Page 25: Introduction to LEGO NXT robotics and Robot Sumo for CJ Chung Associate Professor of Computer Science Founder and Director of Robofest Lawrence Technological

Making Turns

Turn left

Spin left

Face left

Left wheel Right wheel

Left wheel Right wheel

Left wheel Right wheel

stop

stop

Page 26: Introduction to LEGO NXT robotics and Robot Sumo for CJ Chung Associate Professor of Computer Science Founder and Director of Robofest Lawrence Technological

Forward 2 rotations, Turn Left 90 Degrees, and Forward 2 rotations

Turn90Left – Using a Motor Block!

Page 27: Introduction to LEGO NXT robotics and Robot Sumo for CJ Chung Associate Professor of Computer Science Founder and Director of Robofest Lawrence Technological

Forward 2 rotations, Turn Left 90 Degrees, and Forward 2 rotations – Turn90Left

Page 28: Introduction to LEGO NXT robotics and Robot Sumo for CJ Chung Associate Professor of Computer Science Founder and Director of Robofest Lawrence Technological

How do we make to turn 90 degrees?

Timer? Trial errors Let’s do the math!!!

Width of the robot: 14 cm Diameter of the wheel: 5.5 cm Perimeter of the wheel: 5.5 cm x pi = 17.27

Travel distance needed: (14 x 2 x pi) / 4 = 21.98 cm

Number of rotations needed?

21.98 / 17.27 = 1.272714 cm

Page 29: Introduction to LEGO NXT robotics and Robot Sumo for CJ Chung Associate Professor of Computer Science Founder and Director of Robofest Lawrence Technological

How about 180 degree turns using a motor block?

Forward 2 rotations, Turn Right 180 Degrees, and Forward 2 rotations

What is the rotation value for the Motor Block?

1.27 x 2

14 cm

Page 30: Introduction to LEGO NXT robotics and Robot Sumo for CJ Chung Associate Professor of Computer Science Founder and Director of Robofest Lawrence Technological

“Spin” 180 degrees using Move/Steering

Forward 1 rotation, Spin right 180 degrees Forward 1 rotation

14 cm

Travel distance needed: (14 x pi) / 2 = 21.98 cm

Number of rotations needed?

21.98 / 17.27 = 1.2727

Page 31: Introduction to LEGO NXT robotics and Robot Sumo for CJ Chung Associate Professor of Computer Science Founder and Director of Robofest Lawrence Technological

Spin180right

Page 32: Introduction to LEGO NXT robotics and Robot Sumo for CJ Chung Associate Professor of Computer Science Founder and Director of Robofest Lawrence Technological

Class Challenge: A Simple Maze

box

box

Start line

Place a business card as a targetpoint to reach

Page 33: Introduction to LEGO NXT robotics and Robot Sumo for CJ Chung Associate Professor of Computer Science Founder and Director of Robofest Lawrence Technological

Online Resources

www.ortop.org/NXT_Tutorial: a great tutorial on how to program in NXTG

nxtasy.org: with more information than you could ever want about LEGO robots and programming; a great place to ask questions