Robot Building Lab: Introduction Lab 1 The Handy Board and Interactive-C (IC) es/robotlab/labs/lab1.ps.

Slides:



Advertisements
Similar presentations
Robofest 2005 Introduction to Programming RIS 2.0 RCX Code.
Advertisements

Electrical team Arduino tutorial I BY: JOSHUA arduini
08/2012Tanya Mishra1 EASYC for VEX Cortex Llano Estacado RoboRaiders FRC Team 1817.
ENGG1100 Ch6: Introduction To Engineering Design (Digital Logic) Part 2 of digital logic KH WONG ENGG1100. Ch6-Digital Logic (part2) v3h1.
Lab7: Introduction to Arduino
Embedded Sumo 1T4 – 1T5 UTRA.
An Introduction to C Adam Gleitman – IAP 2014.
Automation and Robotics
Handy Board. Why the Handy Board Designed to be the controller of small, mobil robots Has many features that make it ideal for robotics projects –Integrated.
Vex Robotics Introduction to Sensors. introduction to sensors Sensors assist robots in seeing and feeling the physical world through which they travel.
Autonomous Mobile Robots Lecture 01: Introduction Lecture is based on material from Robotic Explorations: A Hands-on Introduction to Engineering, Fred.
Programing Concept Ken Youssefi/Ping HsuIntroduction to Engineering – E10 1 ENGR 10 Introduction to Engineering (Part A)
Engineering H193 - Team Project Gateway Engineering Education Coalition P. 1 Spring Quarter 2008 Robot Programming Tips Week 4 Day 2 By Matt Gates and.
Basic Stamp II is kinda cool Bytes of EEPROM(non-volatile) - Clock speed of 20 MHz. - Holds 600 lines of code in EEPROM - executes an average of.
Handy Board. Why the Handy Board Designed to be the controller of small, mobil robots Has many features that make it ideal for robotics projects –Integrated.
Copyright © 2012 Pearson Education, Inc. Chapter 1: Introduction to Computers and Programming.
Software Design Project
Introduction to Sensors
Engineering H192 - Computer Programming The Ohio State University Gateway Engineering Education Coalition Lect 26P. 1Winter Quarter Handy Board Lecture.
Introduction to Arduino Prepared by R. Lamond.  “Arduino is an open-source electronics prototyping platform based on flexible, easy- to-use hardware.
Basic Circuits – Lab 2 Arduino and Sensors Xmedia Spring 2011.
Introductory Robotics Workshop “Successful Strategies in Robotics” Terry Grant, NASA, Ames Research Center 2/1/05 2/8/05.
Engineering H192 - Computer Programming Gateway Engineering Education Coalition Lab 7P. 1Winter Quarter Stop Light Lab 7.
ARDUINO PROGRAMMING Working with the Arduino microcontroller.
Working with Arduino: Lesson #1: Getting Acquainted with the Kit EGN1007.
What is RobotC?!?! Team 2425 Hydra. Overview What is RobotC What is RobotC used for What you need to program a robot How a robot program works Framework.
Copyright © 2012 Pearson Education, Inc. Chapter 1: Introduction to Computers and Programming.
Alternate Version of STARTING OUT WITH C++ 4 th Edition Chapter 1 Introduction to Computers and Programming.
Elements of IC n IC interface instructions l file types, loading, debugging n Data Objects l data types, constants, variables, characters n Expressions.
The George Washington University Electrical & Computer Engineering Department ECE 002 Dr. S. Ahmadi Class 2.
Chapter 1: Introduction to Computers and Programming.
Copyright © 2009 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 1: Introduction to Computers and Programming.
Teacher/Mentor Institute Using easyC Joel Kirkland July 30-31, 2015.
Programing Concept Ken Youssefi/Ping HsuIntroduction to Engineering – E10 1 ENGR 10 Introduction to Engineering (Part A)
CS 114 – Class 02 Topics  Computer programs  Using the compiler Assignments  Read pages for Thursday.  We will go to the lab on Thursday.
Introductory Robotics Workshop “Successful Strategies in Robotics” Terry Grant, NASA, Ames Research Center Jeneva Westendorf, Foothill High School 2/5/04.
7.2 V battery pack and charger Put the battery in the charger station at the end of the lab. period. Red light indicates charging. Ken Youssefi Introduction.
The George Washington University Department of ECE ECE Intro: Electrical & Computer Engineering –Intro to the Robotics –Introducing the IC –Discuss.
The George Washington University Department of ECE ECE 1010 Intro: Electrical & Computer Engineering –Introducing KIPR Link/Interface and Set-up –Continuation.
Sparkfun Electronics ATtiny85 Arduino Quick Reference Sheet
Wall Encounter By Made easy by Dwayne Abuel.
The Handy Board Bryan Valentini General Robotics 2003.
2008 SBPLI/FIRST Programming Workshop Tom Boehm Patchogue Medford High School, Team 329 Motorola Inc. Mark McLeod Hauppauge High School Team 358 Northrop.
Xtreme Robot Olympiad Programming Basics Dr. Peter Laz Associate Professor Department of Engineering University of Denver.
Design of the New Handy Board for Robotics Using the NI LabVIEW Embedded Module for ADI Blackfin Processor Fred Martin, Assistant Professor, Computer Science.
The George Washington University Department of ECE ECE Intro: Electrical & Computer Engineering Dr. S. Ahmadi Class 4.
Engineering H192 - Computer Programming Gateway Engineering Education Coalition Lect 26P. 1Winter Quarter Handy Board Lecture 26.
Engineering H193 - Team Project Gateway Engineering Education Coalition Lab 1P. 1Spring Quarter Introduction to Sensors Lab 1.
Engineering H192 - Computer Programming Gateway Engineering Education Coalition Lect 29P. 1Winter Quarter Software Design Project Lecture 29.
ARDUINO 1. Basics  Comments  /* * Blink * * The basic Arduino example. Turns on an LED on for one second, * then off for one second, and so on... We.
Teacher/Mentor Institute Using easyC David Dominguez June 2, 2015 Update Version.
The George Washington University Electrical & Computer Engineering Department ECE 002 Dr. S. Ahmadi Class3/Lab 2.
Automation and Robotics.  First you select the platform type so that you can use Natural Language PLTW.
Vex Robotics program three: using motors and sensors together.
Programming in Arduino Materials:Arduino Board Casperelectronics Pre Pres. Notes Photos from workshop?
Programming Basics - RobotC Introduction to Robotics.
1 Introduction to Coding. 2 Example Codes A lot of example codes are given with Arduino IDE A code can often be based on a previous example rather than.
ROBOTC for CORTEX Teacher Training © 2011 Project Lead The Way, Inc. Automation and Robotics VEX.
The George Washington University Department of ECE ECE Intro: Electrical & Computer Engineering Dr. S. Ahmadi Class 4.
INTRODUCTION TO ROBOTICS Part 5: Programming
Val Manes Department of Math & Computer Science
The George Washington University Department of ECE ECE Intro: Electrical & Computer Engineering Intro to the Robotics Introducing the IC Discuss.
Stop Light Lab 7 Winter Quarter.
Introducing KIPR Link/Interface and Set-up
Introduction to Robots and the Mind - Methods -
Automation and Robotics
Working with Arduino: Lesson #1: Getting Acquainted with the Kit
The George Washington University Department of ECE ECE Intro: Electrical & Computer Engineering Dr. S. Ahmadi Class 5.
Introduction to Arduinos
LEGO Mindstorms Robot and Java
Presentation transcript:

Robot Building Lab: Introduction Lab 1 The Handy Board and Interactive-C (IC) es/robotlab/labs/lab1.ps

Robot Building Lab: Introduction Purpose  Introduce the Handy Board micro- controller  Introduce IC programming language  Write simple control program in IC

Robot Building Lab: Introduction Handy Board  Motorola 6811 microprocessor, 2 MHz.  32K of static RAM.  ability to drive 4 DC motors.  16 x 2 character LCD screen.  2 programmable buttons, one knob, and piezo beeper.  inputs for 7 analog sensors and 9 digital sensors.  9.6v nicad battery with recharging circuit.  8-pin serial connector  Plus more … (copyright Prentice Hall 2001)

Robot Building Lab: Introduction Attaching Motors and Sensors (copyright Prentice Hall 2001)

Robot Building Lab: Introduction Connecting PC to HB

Robot Building Lab: Introduction Serial Line Circuit  HB communicates with host computer over RS-232 serial line  Serial Interface/Battery Charger board performs voltage conversion Connecting Handy Board (copyright Prentice Hall 2001)

Robot Building Lab: Introduction Interactive-C Very similar to C (subset) void main(void) { printf("Press start!\n"); start_press(); while (!stop_button()) { if (analog(0) > analog(1)) { motor(1, 0); motor(0, 50); } else { motor(0, 0); motor(1, 50); } ao(); /* end main */ } What does this program do?

Robot Building Lab: Introduction Brief Introduction to Programming in Interactive-C  Interactively –C> 1+2; –C> {start_press(); motor(0,50); stop_press(); ao();}  Downloading -write a function – “main” is the default -Download to Handy Board -Execute main() -Main() automatically executed on power up -(unless you press “start” or “stop” (re-load pcode) during power up)

Robot Building Lab: Introduction Interactive C Features  Interactive experimentation  Compiled into P-code (pseudo-code)  P-code interpreted by run-time machine language program on Handy Board  Built-in multi-tasking  Built-in libraries to access Handy Board hardware – sensor inputs, motor outputs, etc  Additional features: persistent global variables, built-in math functions, character arrays but no chars, one-dimensional arrays (multi-dimensional in some versions)

Robot Building Lab: Introduction DC Motor Output Commands  void motor(int m, int p) –Turns on the motor in port m –And runs the motor with power level p -- full forward = 100, full backward = -100 (using pulse-width modulation)  void off(int m) –Turns off motor m.  void alloff(), void ao() –Turns off all motors

Robot Building Lab: Introduction Sensor Input Commands  int digital(int p) –Returns the value of the sensor in sensor port p, as a true/false value (1 for true and 0 for false).  int analog(int p) –Returns value of sensor port numbered p. Result is integer between 0 and 255.  Ports are numbered as marked on Handy Board

Robot Building Lab: Introduction Seeking/Avoiding Light Motor(left_motor, left_light); Motor(right_motor, right_light); if (analog(left_light) <= light_thresh) motor(left, minimal_power); (From Braitenberg)

Robot Building Lab: Introduction Buttons and Knob Inputs  int stop_button() –Returns value of button labeled STOP: 1 if pressed and 0 if released.  int start_button() –Returns value of button labeled START.  int knob() –Returns the position of a knob as a value from 0 to 255.

Robot Building Lab: Introduction Example pressing buttons program void main(void) { printf("Press start!\n"); start_press(); motor(0, 50); stop_press(); ao(); /* end main */ }

Robot Building Lab: Introduction Example If-else void main(void) { printf("Press start!\n"); start_press(); if (analog(0) > analog(1)) { motor(0, 50); } else { motor(1, 50); } stop_press(); ao(); /* end main */ }

Robot Building Lab: Introduction Example While Loop void main(void) { printf("Press start!\n"); start_press(); while (!stop_button()) { motor(0,50); } ao(); /* end main */ }

Robot Building Lab: Introduction Light demo /* lightdemo.c - */ void main(void) { printf("Press start!\n"); start_press(); while (!stop_button()) { if (analog(0) > analog(1)) { motor(1, 0); motor(0, 50); } else { motor(0, 0); motor(1, 50); } ao(); /* end main */ }

Robot Building Lab: Introduction Miscellaneous Commands  void sleep(float sec) –Waits for an amount of time equal to or slightly greater than sec seconds.  void msleep(long msec) –Waits for an amount of time equal to or greater than msec milliseconds.  void beep() –Produces a tone of 500 Hertz for a period of 0.3 seconds.  Math lib: sin, cos, tan, atan, sqrt, log10, log, exp10, exp, ^  6811 machine language programs may be called

Robot Building Lab: Introduction Multi-tasking Overview  Processes can be created and destroyed dynamically during run-time.  Any C function can be spawned as a separate task.  Processes communicate through global variables.  Each time a process runs, it executes for a certain number of ticks.  All processes are kept track of in a process table; each time through the table, each process runs once (for an amount of time equal to its number of ticks).  When a process is created, it is assigned a unique process identification number or pid. This number can be used to kill a process.

Robot Building Lab: Introduction Multi-tasking Commands  int start_process( function-call( : :),[ TICK S],[ STACK- SIZ E]) –start process returns an integer, which is the process ID assigned to the new process.  int kill_process(int pid) –kill process returns a value indicating if the operation was successful.  void hog_processor() –Allocates an additional 256 milliseconds of execution to the currently running process.  void defer() –Makes a process swap out immediately after the function is called.  IC commands –Kill_all -- kills all currently running processes. –Ps -- prints out a list of the process status.

Robot Building Lab: Introduction Programming Tips  32K of RAM includes p-code interpreter and C libraries and program stack  Reduce redundant code by using functions  Comments don’t take up RAM  Write simple behaviors and then focus on how to coordinate them rather than trying to write one big encompassing behavior

Robot Building Lab: Introduction Next Week  Read on-line documents and answer questions specified at  Teams will be determined based on next week’s attendance  Lab 2: Structures and Drivetrains  Lab fee ($50) and deposit ($50) due: Bring check payable to “Drexel University” for $100. In memo field put “CS 280/680 Lab Fee/Deposit”  Sign up for class mailing list: –Send mail to from your desired –with no subject and –the body “subscribe robotlab”

Robot Building Lab: Introduction Lab 1: The Handy Board and Interactive-C (IC)  Files: – dfhttp://plan.mcs.drexel.edu/courses/robotlab/labs/lab1.p df – ard.htmlhttp://plan.mcs.drexel.edu/projects/legorobots/handybo ard.html – bmanual.pdfhttp://plan.mcs.drexel.edu/courses/robotlab/readings/h bmanual.pdf  Lab overview: –Connect HB to computer –Download IC, Start IC, experiment with command line programming –Write and download programs to HB Print to LCD screen, using buttons, knob and loops to vary output Control motor using knobs and buttons Write motor experimentation program, parameterized by port, allowing the user to run a motor at differing speeds/directions for differing durations –Test program untethered