Introductory robotics workshop successful strategies in robotics
1 / 28

- PowerPoint PPT Presentation

  • Uploaded on

Introductory Robotics Workshop “Successful Strategies in Robotics”. Terry Grant, NASA, Ames Research Center Jeneva Westendorf, Foothill High School 2/5/04 2/12/04. Outline. 2/5 Introductions Team Building & Strategy Robotics Hardware & Software Architecture

I am the owner, or an agent authorized to act on behalf of the owner, of the copyrighted work described.
Download Presentation

PowerPoint Slideshow about '' - conan-keith

An Image/Link below is provided (as is) to download presentation

Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.

- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -
Presentation Transcript
Introductory robotics workshop successful strategies in robotics

Introductory Robotics Workshop “Successful Strategies in Robotics”

Terry Grant,

NASA, Ames Research Center

Jeneva Westendorf,

Foothill High School




  • 2/5

    • Introductions

    • Team Building & Strategy

    • Robotics Hardware & Software Architecture

    • Programming in C Introduction – with the HB

  • 2/12

    • Review: Robot Project Requirements & Example

    • Object Avoidance Mission

    • Go + Throw Example

    • Teacher as Coach

    • Wrap-up

Team development
Team Development

  • Forming

    • Create Ground Rules/ Key Result Statement

    • Gain Buy-in on Code of Conduct

    • Discuss Roles

  • Storming

    • Establish Trust

    • Manage Conflict

  • Norming

    • Solve Problems

    • Make Decisions

  • Performing

    • Start competition strategy & plans

Team strategy plans
Team Strategy & Plans

  • Translating a Challenge into Requirements

    • Robot physical capabilities

    • Robot behavior (high level code)

    • Operator – robot interaction

  • Assigning tasks and milestones

  • Writing a total schedule (initial and revised)

    • Plan to test capabilities & behavior

    • Plan for full robot tests & re-planning

    • Plan for team coordination meetings

Robot building coding
Robot Building & Coding

  • Completed LEGO robot from MLCAD

    • Ref:

    • Art of LEGO Design


  • Pictures and Code from the Jan ’03 Workshop


  • IC4 Environment downloads:


  • Hands-on Challenges Ref:


Robotics h w s w architecture
Robotics H/W & S/W Architecture

Bot Multi-tasking S/W Components

Real-Time Operating System

* P-code interpreter

* Input/Output Drivers - Clock

* Load/Run modes

Handy Board or RCX H/W

*Central Processor

* Random Access Memory

* Special I/O Circuits

* Battery & Power Conditioner

Interactive C v. 4.10

* Editor

* Debug Interpreter

* Loader

Other Apps

Desktop Operating System

Desktop Hardware

IR for RCX*

Serial Data Interface

Charger (HB only)



Lego Motors

& Sensors

Robot project requirements
Robot Project Requirements

  • Hardware configuration and general environmental constraints

  • Operator Requirements

  • Controller requirements

All Three Elements are needed and should be written down for a common team understanding

Programming in c introduction
Programming in C - Introduction

  • IC4 provides an editing, compiling, and downloading environment for either RCX or Handy Board.

  • Follows C syntax (grammar)

  • Uses functions < xyz() > declared and called

  • Many functions for Input/Output are preloaded in a library

  • Good tutorial examples provided with the application

  • Multi-tasking capability in O.S.

    • allows sampling & holding multiple conditions in parallel:

      position, direction, and other sensors

General syntax
General Syntax

  • declaring:

    output type Function(inputs x, int y) {block ofstatements}

  • calling: Function(x, y);

  • types: int x, y, z;

    float a, b, c;

    all variables must have a declared type.

    • global types are defined at the top, outside of a function, and usable by all functions.

Introductory checkout
Introductory Checkout

  • This workshop will use the Handy Board (HB) controller and a pre-built demo robot.

  • Checkout your configuration and understanding of the concepts by entering and downloading the following one line program to send a message to the HB display screen:

    Void main()


    printf(“Hello <your name> \n”);


  • Open Interactive C to view the actual environment & write the above code, then run it.

Simple example
Simple Example

Make a Robot Go Forward and Return

  • H/W & Environment:

    Build a bot with the HB or RCX, wired to motors such that forward power moves wheels forward, and put on a demonstration table with enough flat surface

  • Operator:

    Write the code, load the microcontroller, and initiate the execution (running) of the code

  • The controller:

    Turn on the motors forward, wait 2 seconds, reverse the motors, wait 2 seconds, then stop.

Simple code example




fd(0); fd(2);


bk(0); bk(2);


off(0); off(2);


Open Interactive C & write the code

Simple Code Example

More basics
More Basics

  • Three modes: off, standby, run

  • Use of ‘Interaction’ window in IC4

    • Test new functions for I/O, robot behavior

  • Check list of library functions, global variables

  • Download firmware

  • Upload Arrays for spread-sheet analysis

  • Edit aids

    • Auto-indentation

    • Parenthesis matching

    • Syntax checking (on download)

  • Use of ‘save as’ to file new, or trial code

Notation of ic 4
Notation of IC 4

IC notation is the same for RCX & HB

if ("condition")








while ("condition")




Notation of ic4 2

Defining a function or task:

xxx “name”()




xxx = ‘void’ if no return variables

= ‘int’ if integer return variables

= ‘float’ if floating point return variables

Notation of IC4 -2

Notation of ic4 3
Notation of IC4 - 3

Starting and ending parallel tasks:

pid = start_process(taskname());


Notation of ic4 4

Inputs for RCX

- light(y) for y = 1,2, or 3

- light_passive(y)

- digital(y) or touch(y)

Notation of IC4 - 4

Notation of ic4 5

IC Outputs

Motor outputs, ports 0 to 3 for HB(or A to C for RCX)

To use port 1:

fd(1); forward, positive voltage

bk(1); backward, negative voltage

Motor(1, x); x = -100 to 100

off(1); leave port ‘open’

brake(1); for the RCX only, to brake the motor

Notation of IC4 - 5

Notation of ic4 6
Notation of IC4 - 6

To display on Controller LCD e.g.


printf(“X= %d\n”, x); /*x is an integer */

printf(“X= %f\n”, y); /*y is floating point */

printf(“%d -%d\n”, a, b); /*a & b are integers */

In the RCX only five characters total can be displayed,

and “\n” is not needed.


  • Robots with range sensors start facing each other about one foot apart.

  • Robots must start when a button is pushed or the light comes on.

  • Robots must stop after T (5-15) seconds.

  • The first robot to touch the barrier loses.

Starting Light

4’ x 4’ barrier

Bot 1

Bot 2

Object avoidance behavior
Object Avoidance Behavior

  • Display program title

  • Wait for start_button push, then beep

  • Wait 3 seconds to start

  • Go straight forward

    • while T is not exceeded,

      Turn if an object is sensed

    • When T is exceeded stop

Object avoidance code
Object Avoidance Code

/* bang-bang control to avoid obstacles using rangefinders - Grant 1/27/04*/

/******************** Robot port configuration ***********/

#define R_MOTOR 2 /* motor port 2 */

#define L_MOTOR 0 /* motor port 0 */

#define R_ENC 1 /* encoder 1 is digital port 8 */

#define L_ENC 0 /* encoder 0 is digital port 7 */

#define L_RANGE 18 /* range sensor in analog 18*/

#define R_RANGE 16 /* range sensor in analog 16*/

#define THROW_DIST 195 /* sensor reading to throw the ball,

avoid obstacles, etc*/

#define T 5000L /* run time in millisec */

/*********** globals for left and right sensors, bumper *****/

int L_Range, R_Range, Bumper=0, L_Enc, R_Enc;

Object avoidance code cond
Object Avoidance Code - cond

void main()

{ start_process(monitor_sensors());

printf("range avoid press start\n");

start_press(); sleep(3.); /* wait for start button press */



void monitor_sensors()

{ enable_encoder(R_ENC); /*enable the encoders */



Bumper=digital(15); /* front bumper switch */



L_Range= 255-analog(L_RANGE); /* range reading is big

for big distances */

R_Range = 255-analog(R_RANGE);




Object avoidance code cond1
Object Avoidance Code - cond

void avoid()


int l_speed, r_speed;

long time_s=mseconds()+T;




if(L_Range<=THROW_DIST) r_speed=0;

else {

if(R_Range<=THROW_DIST) l_speed=0;


motor( L_MOTOR, l_speed);

motor(R_MOTOR, r_speed);





Light trigger calibration
Light Trigger Calibration

  • Hardware & Environment

    • L1 is the remote trigger light.

    • L2 is the room lighting.

    • Pd photodetector has a wide field of view.

  • The Controller display helps the operator measure both the dark and light response.

  • The controller [HB or RCX code] sets the “light vs. dark” threshold and waits for the threshold to be exceeded to trigger the action.

Avoidance sensor test project
Avoidance - Sensor Test Project

  • To support a robot avoidance contest with a light start, design a robust light trigger for the action which runs the avoidance behavior for 5 seconds after a light is turned on.

    • Discuss all requirements (total group)

    • Write a code design for each Bot.

    • Write and debug the code

  • Participate in an Avoidance contest

  • Compare trigger and behavior designs and results

Avoidance sensor test behavior e g
Avoidance - Sensor Test Behavior e.g.

  • Display program title [for a few seconds]

  • While start_button is not pushed,

    • Display sensor level and

    • Prompt for start_button push

    • While stop_button is pushed,

      display and increment the trigger threshold

  • When start_button is pushed,

    • Display sensor level

    • Wait for sensor level to cross the trigger threshold, then go forward, etc as original object avoidance

  • When T is exceeded: stop,

    • display “done” for a few seconds