Finch Robot Arrays - PowerPoint PPT Presentation

About This Presentation
Title:

Finch Robot Arrays

Description:

Finch Robot Arrays Pepper Light Sensor getLightSensors() It will return an array of 2 integers with: Left sensor in 0 Right sensor in 1 Possible array; Left Right ... – PowerPoint PPT presentation

Number of Views:83
Avg rating:3.0/5.0
Slides: 7
Provided by: Kristin373
Learn more at: https://home.adelphi.edu
Category:
Tags: array | arrays | finch | robot | sensor

less

Transcript and Presenter's Notes

Title: Finch Robot Arrays


1
Finch Robot Arrays
  • Pepper

2
Light Sensor
  • getLightSensors()
  • It will return an array of 2 integers with
  • Left sensor in 0
  • Right sensor in 1
  • Possible array

Left Right Meaning
80 40 Right eye is getting less light
20 80 Left eye is getting less light
40 40 Both get the same light
3
Access Light Sensor array
  • Make a variable of integer array type to hold the
    response
  • int lights
  • Call the getLightSensors() method to retrieve the
    array
  • lights myFinch.getLightSensors()
  • Access the value
  • lights0 //gets left value
  • lights1 // gets right value

0 1
80 40
4
Obstacle Sensor
  • getObstacleSensors()
  • It will return an array of 2 booleans with
  • Left sensor in 0
  • Right sensor in 1
  • Possible array

Left Right Meaning
False true Left side only sees obstacle
True False Right side only sees obstacle
False False No obstacles
True True Both sides see an obstacle
5
Access Obstacle Sensor array
  • Make a variable of boolean array type to hold the
    response
  • boolean obs
  • Call the getObstacleSensors() method to retrieve
    the array
  • obs myFinch.getObstacleSensors()
  • Access the value
  • obs0 //gets left value
  • obs1 // gets right value

0 1
80 40
6
Summary
  • Two commands for retrieving sensor array from the
    Finch
  • getObstacleSensors()
  • getLightSensors()
  • Both put left in 0 index and right in 1 index
  • Obstacle returns boolean and light returns int
  • Create an array to hold the response
  • Int or boolean arrayname
  • Call the method to fill the array setting your
    array variable the method call
  • Read the result as arraynameindex
Write a Comment
User Comments (0)
About PowerShow.com