ROBOTICS AND AUTONOMOUS SYSTEMS



Similar documents
Building Robots with NXT and LEJOS. Introduc<on. What is the NXT Robot Michael Wooldridge liv.ac.uk)

LEGO NXT-based Robotic Arm

Tutorial for Programming the LEGO MINDSTORMS NXT

Additional Guides. TETRIX Getting Started Guide NXT Brick Guide

CONTENTS. What is ROBOTC? Section I: The Basics

2/26/2008. Sensors For Robotics. What is sensing? Why do robots need sensors? What is the angle of my arm? internal information

Programming LEGO NXT Robots using NXC

Downloading a Sample Program over USB

Introduction WELCOME TO LEGO MINDSTORMS EDUCATION

How To Program An Nxt Mindstorms On A Computer Or Tablet Computer

understanding sensors

Introduction WELCOME TO LEGO MINDSTORMS EDUCATION

Advanced Programming with LEGO NXT MindStorms

Quick Start Guide to computer control and robotics using LEGO MINDSTORMS for Schools

Programming the VEX Robot

Reminders. Lab opens from today. Many students want to use the extra I/O pins on

Line Tracking Basic Lesson

What Is an Electric Motor? How Does a Rotation Sensor Work?

INTRODUCTION TO SERIAL ARM

ROBOTC Software Inspection Guide with Additional Help Documentation

02 B The Java Virtual Machine

Java Embedded Applications

Your EdVenture into Robotics You re a Programmer

The Basics of Robot Mazes Teacher Notes

Android, Bluetooth and MIAC

C.I. La chaîne d information LES CAPTEURS. Page 1 sur 5

Develop lejos Programs Step by Step

CS 106 Introduction to Computer Science I

Waspmote. Quickstart Guide

fakultät für informatik informatik 12 technische universität dortmund Data flow models Peter Marwedel Informatik 12 TU Dortmund Germany

PhidgetInterfaceKit 8/8/8

Your EdVenture into Robotics You re a Programmer

New Technology Introduction: Android Studio with PushBot

EasyC. Programming Tips

Friendly ARM MINI2440 & Dalvik Virtual Machine with Android

Lego Robot Tutorials Touch Sensors

EE 472 Lab 2 (Group) Scheduling, Digital I/O, Analog Input, and Pulse Generation University of Washington - Department of Electrical Engineering

Six-servo Robot Arm. DAGU Hi-Tech Electronic Co., LTD Six-servo Robot Arm

YOSEMITE REGIONAL OCCUPATIONAL PROGRAM COURSE OUTLINE. COURSE TITLE: Robotics Engineering I ROP S1 Robotics Engineering I ROP S2

Testing Robots Using the VEXnet Upgrade

Communication Protocol

Tutorial: Getting Started

STM32JAVA. Embedded Java Solutions for STM32

Crazy Alarm Clock L A K S H M I M E Y Y A P P A N J A M E S K A Y E W I L L I A M D I E H L C O N G C H E N

Capacitive Touch Lab. Renesas Capacitive Touch Lab R8C/36T-A Family

ENGI E1112 Departmental Project Report: Computer Science/Computer Engineering

Speed Based on Volume Values & Assignment (Part 1)

EV3 Programming. Overview for FLL Coaches. A very big high five to Tony Ayad

The NXT Generation. A complete learning solution

Unit 1: INTRODUCTION TO ADVANCED ROBOTIC DESIGN & ENGINEERING

TX GSM SMS Auto-dial Alarm System. Installation and User Manual

How To Play Botball

TI ARM Lab 7 Accelerometers

INSTRUCTION MANUAL All-In-One GSM Home Alarm System SB-SP7200-GSM

Mobile Satellite Solutions. A WiWorld Partner SATELLITE TV ANTENNA CONTROLLER RFM-1000/1100 TECHNICAL MANUAL STOW SEARCH

After: bmotorreflected[port2]= 1; //Flip port2 s direction

LEN s.r.l. Via S. Andrea di Rovereto 33 c.s CHIAVARI (GE) Tel Fax mailto: len@len.it url: http//

User Manual GSM Alarm System. All rights reserved by Delta Security Co., Ltd

1001ICT Introduction To Programming Lecture Notes

Next Gen Platform: Team & Mentor Guide

e d u c a t i o n NXT Solar Station

Crash Course in Java

Bluetooth + USB 16 Servo Controller [RKI-1005 & RKI-1205]

INTRODUCTION TO OBJECTIVE-C CSCI 4448/5448: OBJECT-ORIENTED ANALYSIS & DESIGN LECTURE 12 09/29/2011

Computer and Set of Robots

ROBOT WITH A GRABBING HAND

Classroom Activities for the Busy Teacher: EV3

An Introduction to Robotics and Java

Lab 3 Microcontroller programming Interfacing to Sensors and Actuators with irobot

Can Traffic Accidents be eliminated by Robots?

Using the VEX Cortex with ROBOTC

Massachusetts Institute of Technology

TETRIX Add-On Extensions. Encoder Programming Guide (ROBOTC )

The second goal is to provide a list of tips, tricks, and best known methods that have been discovered over the life span of the course.

1.00 Lecture 1. Course information Course staff (TA, instructor names on syllabus/faq): 2 instructors, 4 TAs, 2 Lab TAs, graders

SKP16C62P Tutorial 1 Software Development Process using HEW. Renesas Technology America Inc.

FTDI VCP DRIVER (free) (WIN/MAC/LINUX)

The Java Virtual Machine and Mobile Devices. John Buford, Ph.D. Oct 2003 Presented to Gordon College CS 311

Tutorial for MPLAB Starter Kit for PIC18F

STATUS POWER MONITOR ALARM SOS DISARM

Quick Start Guide. Installing. Setting up the equipment

Lab 0 (Setting up your Development Environment) Week 1

EE289 Lab Fall LAB 4. Ambient Noise Reduction. 1 Introduction. 2 Simulation in Matlab Simulink

E190Q Lecture 5 Autonomous Robot Navigation

ALON MP3 Dictaphone. User's manual. 1. Introduction 2. Audio Player 3. Voice Dictaphone 4. Phone calls recorder 5. Customer support.

Board also Supports MicroBridge

Special Lecture. Basic Stamp 2 Programming. (Presented on popular demand)

C# and Other Languages

Servo Motor API nxt_motor_get_count nxt_motor_set_count nxt_motor_set_speed

Week 2 Practical Objects and Turtles

ADSL Wi-Fi Router/modem INSTALLATION GUIDE

The BSN Hardware and Software Platform: Enabling Easy Development of Body Sensor Network Applications

Your Phone This section introduces you to the hardware of the device.

Installing Java (Windows) and Writing your First Program

Introduction to Java

Servo Info and Centering

Mobile Robotics I: Lab 2 Dead Reckoning: Autonomous Locomotion Using Odometry

qwertyuiopasdfghjklzxcvbnmqwerty uiopasdfghjklzxcvbnmqwertyuiopasd fghjklzxcvbnmqwertyuiopasdfghjklzx cvbnmqwertyuiopasdfghjklzxcvbnmq

Transcription:

ROBOTICS AND AUTONOMOUS SYSTEMS Simon Parsons Department of Computer Science University of Liverpool LECTURE 3

PROGRAMMING ROBOTS

comp329-2013-parsons-lect03 2/50 Today Before the labs start on Monday, we will look a bit at programming robots. There will be three bits Programming robots in the abstract. The NXT LeJOS The NXT is the robot we will use for the labs and the projects. LeJOS is the language we will use to program the NXT. I ll also give some details about the labs.

AN ABSTRACT VIEW

comp329-2013-parsons-lect03 4/50 The scenario (again) percepts Environment sensors effectors actions Here s one view of the basic program loop.

comp329-2013-parsons-lect03 5/50 Here it is again. while(true){ read sensors update internal datastructures make decisions set power on motors } Even robots with arms and legs move them by turning motors on and off.

comp329-2013-parsons-lect03 6/50

comp329-2013-parsons-lect03 7/50 We ll get into more detail about how exactly sensors work later in the course. For now, just think of them as generating a value.

comp329-2013-parsons-lect03 8/50 We won t get into more detail about how motors work. Just think of a motor command as setting the power on the motors. Setting the voltage on a particular port.

comp329-2013-parsons-lect03 9/50 Remember timescales Even a slow processor runs a lot faster than the robot. This: while(true){ switch motors on : do stuff : switch motors off } will not typically make the robot move.

comp329-2013-parsons-lect03 10/50 Instead you need: while(true){ read sensors : do stuff : if sensors say "this"{ switch motors on } if sensors say "that"{ turn motors off } } where this and that are suitably complementary.

comp329-2013-parsons-lect03 11/50 Remember control flow You have to read the sensors for their state to change. while(true){ read sensors if sensors say "this"{ switch motors on } : wait : if sensors say "that"{ turn motors off } } will typically make the robot crash.

comp329-2013-parsons-lect03 12/50 The robot won t change internal state in a wait. while(true){ read sensors if sensors say "this"{ switch motors on } : wait : read sensors if sensors say "that"{ turn motors off } }

comp329-2013-parsons-lect03 13/50 If you need to wait, use a counter. while(true){ read sensors if sensors say "this"{ switch motors on set counter to 0 } : if counter > limit{ turn motors off } : increment counter } More elegant variations exist using the various clock functions.

NXT

comp329-2013-parsons-lect03 15/50 Our robot

comp329-2013-parsons-lect03 16/50 The brain/heart

comp329-2013-parsons-lect03 17/50 The brick is a small computer powered by a Li-Ion rechargeable battery intended for robot control. 32-bit ARM7 processor, running at 48 MHz 256 Kbytes non-volatile flash storage for storing programs 64 Kbytes RAM for runtime memory Speaker

comp329-2013-parsons-lect03 18/50 If that seems under-powered, bear in mind it is a lot more capable than its predecessor.

comp329-2013-parsons-lect03 19/50 The brain/heart schematic

comp329-2013-parsons-lect03 20/50 3 ports (A, B and C) for actuators/motors. 4 ports (1 to 4) for sensors. LCD display panel (monochrome, 100x64) 4 input buttons (left, right, center, escape) 1 USB port (for downloading programs on the brick) Bluetooth connection (for communication with computer)

comp329-2013-parsons-lect03 21/50 Motors

comp329-2013-parsons-lect03 22/50 These are the basic actuators of the NXT kit. These are servomotors Motor plus feedback A sensor measures information about rotation and supplies it back to the brick. The motor can be controlled very precisely. We will use these to provide locomotion. Other uses involve robotic arms, or active sensor support

comp329-2013-parsons-lect03 23/50 Lots of gears in there also.

comp329-2013-parsons-lect03 24/50 Sensors

comp329-2013-parsons-lect03 25/50 Touch

comp329-2013-parsons-lect03 26/50 Detects when the orange button is pressed. Returns a Boolean TRUE = sensor is pressed FALSE = sensor is not pressed Mechanically the sensors work better if there is a bumper that presses the sensor. Our robot has two bumpers left and right.

comp329-2013-parsons-lect03 27/50 Sonar/Ultrasound

comp329-2013-parsons-lect03 28/50 Standard range sensor. We will talk more about how sonar work in a later lecture. Reports distance to object. Works for objects between 5 and 255cm Precision of ±3cm Objects beyond 255cm away report 255. Sensitive to the kind of objects it is detecting and subject to errors due to specular reflection.

comp329-2013-parsons-lect03 29/50 Light/Colour

comp329-2013-parsons-lect03 30/50 Emits light and measures the reflection. Analyses the colour of the reflection. Can distinguish between a number of different colours.

LEJOS

comp329-2013-parsons-lect03 32/50 LeJOS Lego Java Operating Systems Spanish pronounciation: Lay-Hoss A small JVM is downloaded onto the brick and allows Java programs to be executed. Some standard Java things are missing. Original LeJOS VM was called Tiny VM

comp329-2013-parsons-lect03 33/50 However LeJOS has lots of useful robot-specific stuff. Java-based so OO. The robot-specific things are implemented as classes + objects. Classes to represent, for example: Buttons Motors Sensors Access to these devices is then through method calls.

comp329-2013-parsons-lect03 34/50

comp329-2013-parsons-lect03 35/50 In many ways LeJOS is just like other robot programming languages. Provides function calls that interface with with the robot hardware. Means no robot programming language can be completely general Aspects of the language are specific to the hardware. LeJOS for the NXT is different to LeJOS for the RCX. Couldn t use LeJOS to control the TurtleBot.

comp329-2013-parsons-lect03 36/50 HelloWorld import lejos.nxt.button; public class HelloWorld { public static void main (String[] args) { System.out.println("Hello World"); Button.waitForAnyPress(); } } Looks pretty standard.

comp329-2013-parsons-lect03 37/50 In fact, the completely standard program runs: public class HelloWorld { public static void main (String[] args) { System.out.println("Hello World"); } } But the message will flick by too fast to see.

comp329-2013-parsons-lect03 38/50 Motors Here s a program to turn the motors on and off. import lejos.nxt.button; import lejos.nxt.lcd; import lejos.nxt.motor; public class SimpleDriver{ public static void main(string[] args){ System.out.println("Press any button to start robot"); Button.waitForAnyPress(); LCD.clear(); Motor.B.forward(); Motor.C.forward(); System.out.println("Press any button to stop robot"); Button.waitForAnyPress(); Motor.B.stop(); Motor.C.stop(); } }

comp329-2013-parsons-lect03 39/50 Note that a motors have to be connected to ports B and C for this to have any effect. This is the case for our NXT robot Robot control programs are very sensitive not only to the robot chassis, but also to the way the robot is wired.

comp329-2013-parsons-lect03 40/50 Touch sensor To use a touch sensor we need to introduce a couple more objects. The touch sensors themselves; and The sensor port they are connected to. Here s a program that uses a touch sensor:

comp329-2013-parsons-lect03 41/50 import lejos.nxt.button; import lejos.nxt.motor; import lejos.nxt.sensorport; import lejos.nxt.touchsensor; public class SimpleSensor{ public static void main(string[] args){ TouchSensor leftbump = new TouchSensor(SensorPort.S2); TouchSensor rightbump = new TouchSensor(SensorPort.S1); while (!Button.ENTER.isDown()){ if(leftbump.ispressed()) { Motor.B.forward(); Motor.C.forward(); } if(rightbump.ispressed()){ Motor.B.stop(); Motor.C.stop(); } } } }

comp329-2013-parsons-lect03 42/50 This style of program is pretty typical. Matches the kind of thing we talked about before. A basic loop in which sensors are read and a decision made based on the sensor state.

comp329-2013-parsons-lect03 43/50 Development Cycle Another difference between the programs you have written before and robot programs. You do the usual: Write Compile + Link Debug as before. But before running the program you have to download it onto the robot. Through USB or Bluetooth.

comp329-2013-parsons-lect03 44/50 If you use Eclipse, the download step is mainly hidden. BUT The robot must be turned on. And the USB cable must be plugged in if you are using it. You may also notice that compilation produces a.nxj file rather than a.class file.

comp329-2013-parsons-lect03 45/50 Documentation Website: http://www.lejos.org/ API: http://www.lejos.org/nxt/nxj/api/index.html

LABS AND PROJECTS

comp329-2013-parsons-lect03 47/50 On labs Here are your lab/group assignments. Groups were selected randomly and are FINAL. The lab numbers correspond to those on the timetable. Lab 01 Friday 9.00 11.00 Lab 02 Friday 11.00 1.00 Lab 03 Monday 1.00 3.00 Lab 04 Wednesday 9.00 11.00 Most people are assigned to the Lab that is in their timetable. Those that aren t, please come and see me at the end.

comp329-2013-parsons-lect03 48/50 The first hour of Labs 01, 03 and 04 are compulsory. The second hour of Lab 02 is compulsory. Demonstrators will be present to help you and you will have to sign in. For the first few weeks you will have some training exercises to work on. These will teach you the LeJOS language and have you practice using it. Then you will transition to working on the projects.

comp329-2013-parsons-lect03 49/50 It is likely that you will need more time to work on your project that just your scheduled lab time. Because of this you can check robots out from the helpdesk any time that the helpdesk is open. You can reserve robots in advance. You have to reserve robots in person at the helpdesk.

comp329-2013-parsons-lect03 50/50 On Projects Project descriptions will be handed out next week.