Homework 5 10-29-09 robot controls

# Homework 5 10-29-09 robot controls - Alex Fidalgo Intro to...

This preview shows pages 1–3. Sign up to view the full content.

Alex Fidalgo 10/29/09 Intro to Programming E-115-C, E-115-LK I pledge that I have abided by the Stevens Honor System. _________________________ // YOUR PROGRAM STARTS HERE float leftfronthit, rightfronthit, rightbackhit, leftbackhit, nohit; fronthit = 'n' ; backhit = 'n' ; leftfronthit = 'n' ; rightfronthit = 'n' ; rightbackhit = 'n' ; leftbackhit = 'n' ; if ((bumpside == 1) || (bumpside == 2)) fronthit = 'y' ; if ((bumpside == 3) || (bumpside == 4)) backhit = 'y' ; if (bumpside == 1) leftfronthit = 'y' ; if (bumpside == 2) rightfronthit = 'y' ; if (bumpside == 3) rightbackhit = 'y' ; if (bumpside == 4) leftbackhit = 'y' ; if (bumpside == 0) nohit = 'y' ; if ((nohit = 'y' { movedir = 0.; rotdir = +1.; } else { movedir = +1.; rotdir = 0.; } if (fronthit == 'y' ) { movedir = -1.; rotdir = +1.; } else if (backhit == 'y' ) { movedir = +1.; rotdir = +1.; } else if (leftfronthit == 'y' ) {

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
movedir = -1.; rotdir = +1.; } else if (rightfronthit == 'y' ) { movedir = -1.; rotdir = -1.;
This is the end of the preview. Sign up to access the rest of the document.

## This note was uploaded on 01/30/2011 for the course ENGINEERIN E-101 taught by Professor Dr.doe during the Spring '09 term at BC.

### Page1 / 5

Homework 5 10-29-09 robot controls - Alex Fidalgo Intro to...

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document
Ask a homework question - tutors are online