Sunteți pe pagina 1din 11

EE401

LAB REPORT

Robotics
DESIGN A LEARNING ROBOT
Prof:
TA/LA:
Members:

Da Nang, 26th November 2015

EE401 Robotics

Design a Learning robot

Table of Contents
I.

Introduction ......................................................................................................2

II.

Hardware and Software ..................................................................................2


1. Hardware ..........................................................................................................2
1.1

Components ..............................................................................................2

1.2

Plinth of robot ...........................................................................................3

1.3

Body of robot ............................................................................................3

1.4

Robot before connect wires ......................................................................4

1.5

Completed robot........................................................................................4

2. Software ............................................................................................................5
2.1

Reset motion .............................................................................................5

2.2

Starting controller ....................................................................................6

2.3

Configure button .......................................................................................7

2.4

Record motion module .............................................................................8

2.5

Main modulle ...........................................................................................9

III.

Result...............................................................................................................10

IV.

Evaluation and developent ...........................................................................10

V.

References .......................................................................................................10

Page 1

EE401 Robotics
I.

Design a Learning robot

Introduction:

In this project, we are going to build a robot that learns how to dance. First, it
waits for you to teach it. You can change the body of robot any way you want. Then,
when the robot beeps, let go, and it copy the dance moves that you showed it.
II.
Hardware and Software:
1. Hardware:
Our project is built from Lego Mindstorm Nxt 2.0.
1.1

Components:

Page 2

EE401 Robotics
1.2

Plinth of robot:

1.3

Body of robot:

Design a Learning robot

Page 3

EE401 Robotics

Design a Learning robot

1.4

Robot before connect wires:

1.5

Completed robot:

Page 4

EE401 Robotics

Design a Learning robot

2. Software
2.1
Reset motion:

This first section of code was created to insure that all motors start in the same place.
Create a while loop by right clicking on the screen and selecting -->Programming -->
Structures -->While loop and right click again and select NXT Robotics --> NXT/IO-->
Motor Icon. Insert 3 motor icons. Right click on top of the first motor icon--> Create-->
Constant and label it port A. Then right click on the left side of the motor icon--> Create-> Constant and set the speed at 70. Right click on top of the second motor icon-->
Create--> Constant and label it port B. Then right click on the left side of the second
motor icon--> Create--> Constant and set the speed at 60. Right click on top of the third
motor icon--> Create--> Constant and label it port C. Set the direction of the second
motor icon to back by selecting the tab below the icon and clicking back. Then right click
on the left side of the third motor icon--> Create--> Constant and set the speed at 60.
Insert a timer icon. Wire the first motor to the timer. Set the direction of third motor icon
to back by selecting the tab below the icon and clicking back. Then right click and go
to NXT Robotics --> NXT/IO--> Motor Icon and click the tab at the bottom of the icon
then select Motor Off--Brake. Wire the time icon to the break. Next select NXT Robotics
--> NXT/IO--> Reset Rotation Icon and wire it to the three motors and the pink wire after
the wait icon. Finally, select NXT Robotics --> NXT/IO--> Touch sensor wait and wire
the touch sensor wait to the reset rotation icon.

Page 5

EE401 Robotics
2.2

Design a Learning robot

Starting controller

Next you are going to set up the conditions for triggering the proportional controller that
will ultimately learn the moves. Right click and go to-->Programming --> Structures ->While loop. Insert a while loop. Next right click and go to-->Programming -->
Structures -->Case Structure and insert a case structure. Then right click and go to->Programming --> Structures -->Case Structure and insert a case structure within the
previously created case structure.
Then right click and select NXT Robotics --> NXT/IO--> Touch sensor and wire the
touch sensor to the touch sensor wait icon on the other side of the new while loop. Then
wire the green data wire at the bottom left of the touch sensor icon to the green question
mark on the first case loop. Then right click and select
NXT Robotics --> NXT/IO--> Motor Icon. Right click on the motor icon go to create->constant select coast. Make sure all ports are selected on the motor icon. Wire the pink
wire to from the touch sensor to the coast icon. Select the loop condition at the bottom of
the while loop and right click go to programming--> comparison--> not equal to 0 then
wire the green data wire to the stop sign icon or loop condition and the blue data wire to
the edge of the while loop.
Page 6

EE401 Robotics
2.3

Design a Learning robot

Configure button

Set the conditions in the case structures. In the first case set the case to false and insert a
touch sensor icon. Set the touch sensor icon to port 2 and wire the control wire to the
green question mark in the second case loop. Set the second case loop to false then insert
an integer 1 into the second case loop and wire it to the first case loop. Then set the first
case loop true and insert the integer 2 and wire it to the wall of both loops. These
numbers will allow you to control when you are recording motions or playing them in the
next section of the code.

Page 7

EE401 Robotics
2.4

Design a Learning robot

Record motion module

In this section of code we are creating a proportional controller. Next create a new case
structure and change the case conditions to the integers 1 and 2. These integers will align
with the numbers you entered in the case loops in the previous section of code. Connect
the blue data wire from the last case loop you made to the question mark on this case
loop. Under the case condition of "1" insert a four loop. Go to -->Programming -->
Structures -->Four loop. At the top of the four loop right click the N click create constant
and set the N or number to times the four loop is completed to 100.
Then go to -->Programming --> NXT I/O -->Display. Then right click on the display text
icon and wright the text move me. This will indicate when to start moving the robots
arms and waist. Next insert a rotation icon and make sure it is set to all ports. Wire the
rotation icon to the for loop. Next insert three rotation sensor icons into the four loop and
set to them ports A, B, and C respectively. Then insert a time icon and set it to 125
milliseconds (this is the sample rate). Finally wire the blue data wire to the edge of the
four loop. Make sure auto indexing is turned on- this will automatically array the values
coming from the rotation of the motors. Then wire the blue nodes at the end of the
rotation sensor data wires to the edge of the case loop in which the four loop resides.
Finally wire the pink wire to the left side of the rotation sensor in port A and then wire
the right side of the same rotation sensor to the left side of the four loop.
Page 8

EE401 Robotics
2.5

Design a Learning robot

Main module

Next we will define the "2" case in the case loop. Right click the screen NXT I/O->programming-->Cluster--> Unbundle. Wire the pink wire to the right side of the
unbundle icon. Then wire the blue data wire to the nodes on the edge of the case loop.
Finally insert a text icon and list playing to indicate which phase of the program the robot
is in.

Next wire the case structure to the tone icon and wire the tone icon to a wait icon and set
for 2 seconds. Then create a four loop and wire the pink wire from the wait icon to the
edge of the four loop. Next create a bundle and connect the three blue data wires to the
left side of it.

Page 9

EE401 Robotics

Design a Learning robot

Create a shift register on the outside while loop and be sure to connect the bundle to it. In
order to see the data in the loops right click the blue wires and create an array. Next
create another four loop and insert three rotation icons. Create an auto indexing node on
the left side of the four loop for all three blue data wires. Name each rotation icon ports
A, B, and C respectively. Then connect the pink wire on the wait icon to the left edge of
the four loop. Then right click and go to NXT I/O-->programing-->numeric-->subtract.
Wire one subtract icon to each motor and to the auto indexing node on the left side of the
four loop as shown. Next go to NXT I/O-->programing-->numeric-->multiply and
connect the output blue data wire from the subtract icon to the multiply icon (this is your
gain). Next right click on the multiply icon and insert a constant enter one for all three
multiply icons (this means your gain is nothing, you may want to enter a number greater
than one if your robot dancer is moving too slowly). Then insert three motor icons and
name them ports A, B, and C respectively. Next connect the blue data wire output from
the multiply icon to the corresponding motor icon. Then add a 125 millisecond wait icon
and wire it with the pink wire to the right side of the four loop. Insert a tone icon and wire
it to the left side of the four loop. Then insert a text icon and change the text to done.
III.

Result:

Robot can copy any motion of previous step. The video demonstration of robot was
attached in the email.
We built a robot that learns how to dance. First, it waits for you to move it. You can
move the motors any way you want. Then, when the robot beeps, let go, and let it copy
the dance moves that you showed it.
IV.

Evaluation and development:

Robot work correctly but there are some problems which have to develop:

V.

Using the ultrasonic to detect the motion.


Improve speed of recording motion and responding motion.
Reference:

http://www.ni.com/academic/students/learn-labview/
Introduction to LabVIEW,HANS--PETTER HALVORSEN
Mike Rinderknecht: Tutorial for Programming the LEGO
MI
ORM X

Page 10

S-ar putea să vă placă și