Programming the RCX

advertisement
ENGR 100 - Robotics Project
What is a Robot?
1.
2.
A ElectroMechanical
system Plus
Artificial
intelligence
Can do certain
tasks that
human like
Robot Arm
Honda Asimo
Robot Fish
Robot Vacuum
Basic Component of Robot
Artificial Intelligence(software)
Learning (Neuron network training)
Motion control(output)
Information analysis(input)
http://www.youtube.com/watch?v=Q3C5sc8b3xM
Physical Part(Hardware)
Leg,
Hand, Head
http://www.youtube.com/watch?v=9vRg64HX5gA
spine
http://www.youtube.com/watch?v=eO9oseiCTdk
Project Objectives
The goals of this project are to:
Basic computer programming.
Experience the design process.
Build a programmable robot.
Tasks
Three different tasks:
Robotic Wheelchair, Car, The defender.
Three different programs:
Program 1 - Robotic Wheelchair (do first!)
Program 2 - Car
Program 3 – Dog/Cat. The defender (be creative!)
Arena Layout
8 ft
1 ft
8 1/3 ft
1ft
4 ft
68”
4 ft
Defender Free Zone
2 ft
This is the competition!
Scoring for performance grading
Pts
Tmin
Score  75%(
)  25%(
)  Ex
Ptsmax
T
10 pts
10 pts
10 pts
10 pts
10 pts
Base Pts – At some point before competition day, each team’s
robot must complete the entire course.
Additional points each round - 20 pts for Wheel chair car, 20 pts
for Car, and 20 pts for Defender.(build by NQC or your own
sensor)
Project flow
Know the project goals/requirements.
Learn RCX programming/Gather ideas for
robot design.
Build a pathfinder.
Test run.
Final competition.
Rules
(see handout for complete listing)
Robotic wheelchairs cannot be touched once
competition has started.
Malfunctioning defenders and cars will be
removed from the course.
Max robot dimensions at start of competition
- 1 ft x 1 ft x 1 ft
Wheelchairs and cars sending messages will
be disqualified. Defenders not limited.
Robot Basics -RCX
Command
Brick
3 output
3input
5 programe
Robot Basics - Sensors & Motors
Input/Output Ports
Touch sensors
Light sensor
Motors
RCX signals
Tips Use view mode to check light sensor. Battery
power affects speed of motors. Batteries run
out fast! Don’t block infrared sensor.
Robot basics – Programming
No matter what language you use, there
are 3 basic control structures for
organizing the programming commands:
Sequential
Repetition (Loops)
Conditional
Sequential
Sequential statements
are defined as a list of
commands that are
executed in order.
For example:
Set Forward
Direction
Go forward for 3 s
Stop
Repetition
Repetition statements
allow for a series of
commands to be repeated
for a set number times.
For example:
Repeat 3 times
Set forward direction
Move forward for 3 s
Stop
End Repeat
Conditional
Conditional statements allow for two (or
more) different sets of commands to be
executed depending on a condition.
For example,
If certain conditions are true - one set of
commands will be execute.
Else if any (or all) are false - another set
of commands will be executed.
Example of Conditional Statements
For example If the light is <50%
Set Direction Forward
Move Forward for 3 s
Stop
Else If light is >= 50%
Stop
End
Exercise
3 types of control structures
Sequential, Repetition, Conditional
Which one above would work best for the
following situations Robotic wheelchair executes a left turn.
Robot wheelchair backs up if it hits the wall.
Car moves back and forth across crosswalk.
Programming Environment
(Robotics Invention System 2.0 )
 Graphical
language
 High level
 Drag in desired
function
 Upload the
program to RCX
by IR signal
IR Com.
RCX
Features of RCX software
Multi-threaded language
Different parts of the program execute at the same time.
Loops in main program interfere with subprogram.
Variables limited to 1 or 0
Use counter as variable.
Not Quite C (NQC) language allows for more variables.
Programming Environment
(Not Quite C )
 C based
program
 Allows more
variable
 Command
list is
provided
 Text coding
What are we going to do today?
1. Build your robot.
 inventory
2. Plan your project.
 Share your work
3. Learn how to build a robot and
communicate with it~
Gear
Transmission device
 Angular velocity is
the same
 the bigger wheel
will run faster
 Smaller wheel will
run slower
 The torque and
power from the
motor is the
constant
 Smaller wheel will
have higher
surface force
Tongue=10
R1=10
R2=1
F1=1
F1*R1=Tongue
F2=?
Gear
 No Slip condition
 The tangential velocity is a
constant
 W*R is a constant
 W=angular velocity
 R=radius
5
W1=10
W6
W5
10
W3=1
5*10=10*W2
5
W4
1*10=5*W4 W4=?
W4=W5?
W5*10=W6*5 W6=?
10
Download