Advanced ROBOLAB Programming - PowerPoint PPT Presentation

1 / 42
About This Presentation
Title:

Advanced ROBOLAB Programming

Description:

Serial vs. Behavioral Programming. E.g. Cockroach Bot. Look for 'food' with light sensor ... Prac 7: Play Chinese whispers with music with 3 RCX's. EMAIL Programs ... – PowerPoint PPT presentation

Number of Views:106
Avg rating:3.0/5.0
Slides: 43
Provided by: tony97
Category:

less

Transcript and Presenter's Notes

Title: Advanced ROBOLAB Programming


1
Advanced ROBOLAB Programming
2
  • Prac 1
  • Make a two sensor Line Follower
  • Use the Construction Robots in
  • Students Shared Folder/ Robotics/ Construction
  • Review forks and multitasks

3
(No Transcript)
4
(No Transcript)
5
Multitasks
  • Task split
  • Stop tasks
  • Start tasks

Tasks are like programs. Multi-tasking means you
can run more than one task at a time.
6
(No Transcript)
7
Task Split
All tasks must end with their own stoplight
8
Resource conflicts
Both tasks can access the sensor values Tasks
will conflict over motor control
9
Sharing Control of Motors
Motor A goes forward for 2 sec, backwards for 2
sec and forward for 10 sec
10
Tasks Containers
  • User containers 32-47 are local and are not
    shared between tasks

11
Stopping tasks
Stopping all tasks is equivalent to ending the
entire program. The sound is never played!
12
Stopping One Task
13
Start Tasks
The upper task can be restarted by the lower task
14
Task Priority
15
Behavioral Programming using multitasks
  • Serial vs. Behavioral Programming
  • E.g. Cockroach Bot
  • Look for food with light sensor
  • Beep pause when eating for 5s
  • Continue looking for food
  • If light comes on scurry away.
  • If light goes off resume eating.

16
Prac 2 Make a Cockroach
  • Questions
  • How many tasks or behaviours is there?
  • Which behaviour has priority?
  • What senses will it need?
  • When looking for the food, will you do a
  • systematic search or a random one?
  • Finding the food means feeding for 5s
  • You must leave the circle if the light comes on.

17
Cockroach Program
18
What is a container?
  • An area of memory.
  • A place to store values (numbers, strings, bits,
    event states or priorities)
  • A way of counting loops (iteration)

19
Containers Cont.
  • Comparing values (sensor readings)
  • Mathematical operations on values.
  • Prac 3 Make an Echo Locator
  • Light Sound frequency

20
(No Transcript)
21
Prac 3 Sentry Robot(Always moves back to the
same spot after it is moved)
  • Make a simple 1 or 2 motor robot (Shared student
    files/robotics/construction)
  • Put a rotation sensor on the axle.
  • Programming
  • Use the motor direction icon
  • Use the difference in the new reading on the
    rotation sensor to be the power level of the
    motor

22
Container Version
Very Simple Version
23
Storing movement using an angle sensor container-
SentryRobot always returns home
24
Code for fwd and reverse icon
25
Prac 5 Follow the paper
  • Use containers to initialise the reading of a
    light sensor on a car pointing at white paper.
  • When the paper moves the car must follow
  • You need to use the difference between the new
    light reading and the old one.
  • Move the paper away and the car should move
    towards it.
  • If you move the paper closer it should move away.

26
Containers ContainerUsing a container as a
pointer to other containers.
0
10
0
Red
The red container is a pointer. Each time a
number is added to red. The value in the red is
used as indicator of what container to set to
zero. This program zeros containers 1 10.
27
Using MailRCXs can communicate using the IR
port which can both send and receive.
28
EMAIL Programs
  • Prac 6 Relays
  • Work with another group.
  • Make two programs a receiver and a sender.
  • The receiver doesnt move until the sender goes
    past.
  • Then it beeps and goes the same speed as the
    number sent, it also displays that number (Try
    against another group.)
  • Prac 7 Play Chinese whispers with music with 3
    RCXs

29
Events Enables program to jump out of a
repetitive pattern when an event is triggered
Start Monitoring
Event Monitoring for a drop in light
Land Here when found
30
Example of Events Simple ROBOCUP RESCUE
31
Prac 8 LASER TAG
  • This involves 3 multitasks
  • An evasive manoeuvre of continual motion.
  • Sending your assigned number which changes if you
    cop 5 hits with the same number
  • Receiving mail and counting for 5 or more of the
    same hits, then changing your mail.

32
Begin Initialise 10 containers
33
Task 1 evasive manoeuvre Task 2 - send email
every 1s
34
Task 3 Waiting for Mail and counting Number of
hits (5 hits change your mail)
35
Vision Centre
  • This uses the Webcam as a sensor.
  • The key is to have the Vision centre (in
    Projects) open and communicating at the same time
    as the program is running (You must always have
    the RCX in view of the Tower
  • The camera continually updates the image and
    feeds back data about the image that you define
    beforehand e.g. amount of dark/white/colour
    intensity/movement etc.

36
Follow the Arrow In this first activity, you
have to move up to a line before the arrow and
get the robot to go whichever way the arrow
points.
  • Open Vision Center
  • Define a sensor for left side amount of dark
  • Mask an area for left side
  • Do Auto threshold for black and white
  • Invert the image from black to white
  • Snatch the area of white in the image
  • Save the new sensor file as Left side Arrow
  • Repeat for Right side and save as Right side
    Arrow

37
Follow the Arrow Continued
  • Now go back to Vision center and put left side
    arrow in red container, right side arrow in blue
    container
  • Change communication to full.
  • Now write a program to include a light sensor to
    read a black line then see the image with the
    camera,compare the red and blue containers and
    turn one way if left, the other way if right.

38
(No Transcript)
39
Finding the correct coloured tile
  • Define the average pixel sensor for a particular
  • colour e.g. red
  • Change sensor operation to ?.
  • Put on your chosen colour plane
  • Choose mirror
  • Save as red
  • Tick the red container, choose red container for
    the plane
  • Test the pixels count for red container when a
    red tile
  • and another colour tile is in front.
  • Choose the threshold for seeing a red tile but
    not a blue one
  • Now repeat for another colour e.g.seeing blue.

40
(No Transcript)
41
(No Transcript)
42
Vision centre projects
  • Choose a project
  • Find the thief
  • Snap a picture of a moving object and sound an
    alarm
  • (use predefined MOTION LOCATION)
  • Make a Bar Code Reader to allow access to a
    treasure chest
  • (use 3sections, left, middle and right), 1 for
    each container.
  • Make a robot go into an area (box), take a
    picture and come out again.
  • Make a colour sorting robot, that sweeps one
    colour to the right, the rest to the left.
  • Make a robot that counts the numbers on a dice,
    shows it on the screen and turns this many times.
  • Make a Robot that fires missiles towards a bulls
    eye.
Write a Comment
User Comments (0)
About PowerShow.com