Presentation is loading. Please wait.

Presentation is loading. Please wait.

CS 1 with Robots Robot Sensors & Actuators Institute for Personal Robots in Education (IPRE)‏

Similar presentations


Presentation on theme: "CS 1 with Robots Robot Sensors & Actuators Institute for Personal Robots in Education (IPRE)‏"— Presentation transcript:

1 CS 1 with Robots Robot Sensors & Actuators Institute for Personal Robots in Education (IPRE)‏

2 Aug 29 2007 2

3 3 IR Obstacle Sensors The Scribbler has two IR obstacle sensors (under the light sensors) that return a binary value of 0 or 1. The robot actually has 1 IR receiver located in the center, and two emitters located on the left and right side of the emitter.

4 Aug 29 2007 4 IR Obstacle Sensors Return value of: 0 – IR light is bouncing back to the receiver (off of an obstacle)‏

5 Aug 29 2007 5 IR Obstacle Sensors Return value of: 1 means that infrared light is not bouncing back to the receiver, so nothing is in front of the emitter/detector.

6 Aug 29 2007 6 IR Obstacle Sensors getIR() returns a list of two items [1,1]. You can also call getIR(“left”) to get just the left sensor, and similarly with getIR(“right”). The function also accepts 0 and 1 as the parameter to select which sensor value to return.

7 Aug 29 2007 7 Light Sensors (3)‏ The scribbler has 3 light sensors pointing Left, Center and Right on the same side as the getIR sensors. [45, 200, 430] = getLight()‏

8 Aug 29 2007 8 Light Sensors (3)‏ Light sensor values range from 0 to 5000. Zero is very bright, 5000 is full dark. getLight() returns a list of all 3 values. getLight(“left” / “center” / “right”) or getLight(0/1/2) selects one value

9 Aug 29 2007 9 Internal Scribbler Sensors getBattery() - returns battery voltage getStall() - returns stall condition (0 or 1)‏ This value changes to a 1 when the motors are working extra hard (possibly due to the robot hitting something and being unable to turn the wheels)‏ Note that it takes a half second to re-set the stall sensor once the motors are turned off, so wait a bit before sampling it agian. getName() - returns the robot's name (can be changed with setName(“newName”)‏

10 Aug 29 2007 10 Fluke Board The Fluke add-on board has its own IR obstacle sensors and a camera.

11 Aug 29 2007 11 Fluke Board – IR Obstacle sensors Myro uses the getObstacle() function to differentiate the IR sensors on the Fluke from the IR sensors on the Scribbler. The fluke sensors are more sensitive than the Scribbler sensors Instead of just returning a zero or one, they return an integer value between zero and 7000.

12 Aug 29 2007 12 Fluke Board – IR Obstacle sensors The fluke has 3 IR emitters, one pointing forward...

13 Aug 29 2007 13 Fluke Board – IR Obstacle sensors The fluke has 3 IR emitters, one pointing forward... And two pointing to the left and right.

14 Aug 29 2007 14 Fluke Board – IR Obstacle sensors The fluke has 3 IR emitters, one pointing forward... And two pointing to the left and right. They all bounce light back to a center mounted receiver.

15 Aug 29 2007 15 Fluke Board – IR Obstacle sensors Zero indicates no IR light is bouncing back from an obstacle. [0,0,0] = getObstacle()‏

16 Aug 29 2007 16 Fluke Board – IR Obstacle sensors Larger numbers indicate that more IR light is bouncing back. [0, 1842, 0] = getObstacle()‏

17 Aug 29 2007 17 Fluke Board – IR Obstacle sensors As with the Scribbler, you can select individual sensors to use (I recommend using the “center” sensor). getObstacle(0 / 1 / 2)‏ getObstacle(“left” / “center” / “right”)‏

18 Aug 29 2007 18 Fluke Board – Camera You can take a picture using the camera on the Fluke board. p = takePicture() show(p)‏

19 Aug 29 2007 19 Fluke – Camera as a brightness sensor Similar to the getLight() function on the Scribbler, the fluke allows you to use the camera as a “brightness” sensor with the getBright() function call. getBright() returns a list of three values getBright(0 / 1 / 2) or getBright( “right” / “center” / “left”) return a single value. The numbers returned represent the sum of the luminance values of the pixels in the right/center/left of the camera, so they are quite large! The lower the number, the darker that area of the camera is.

20 Aug 29 2007 20 Robot Actuators Beep Motors LED Lights

21 Aug 29 2007 21 Speaker command – Beep beep() - issues a random beep beep(1) – random beep for 1 second beep(1,800) – Beep at 800Hz for 1 second beep(1,440,880) – two tone beep at 440 & 880Hz for 1 second.

22 Aug 29 2007 22 Robot Actuators - Motors Two motors (left,right) that can be set to a power level between -1 and 1. -1 is full reverse 0 is stopped 1 is full speed forward. Controlled directly with the motors(left,right) function.

23 Aug 29 2007 23 Robot Actuators – Motors – Utility Functions These functions make it easier to use the motors to do simple things: forward(speed, seconds) – Moves the robot forward at the specified speed for the specified seconds, and then stops. turnLeft(speed,seconds) – Turns the robot left at the specified speed and for the specified seconds, then stops. turnRight() and backward() are similar.

24 Aug 29 2007 24 Robot Actuators – Motors – Utility Functions The previous functions would all start the robot, go for a certain amount of time, and then stop the robot automatically. You an also start the robot moving without specifying how long it should do so: forward(speed), turnLeft(speed), backward(speed), turnRight(speed), stop()‏ Very important to call the stop() function when you want the robot to stop! The wait(seconds) function can be used to specify how long the robot should travel: forward(0.85)‏ wait(1.5)‏ stop()‏

25 Aug 29 2007 25 Motor commands – Synchronous vs Asynchronous What is the difference between these pieces of code? forward(0.85)‏ wait(1.5)‏ stop()‏ And... forward(0.85, 1.5)‏

26 Aug 29 2007 26 Motor commands – Synchronous vs Asynchronous What is the difference between these pieces of code? forward(0.85)‏ beep(1.5,880)‏ stop()‏ And... forward(0.85, 1.5)‏ beep(1.5,880)‏

27 Aug 29 2007 27 Motor commands – Translate & Rotate Other functions exist: translate(speed)‏ rotate(speed)‏ These functions allow you to add together different types of motion, allowing the robot to move forward -- translate(1) while also turning—rotate(0.5). stop() is equivalent to translate(0); rotate(0)‏

28 Aug 29 2007 28 LED commands – setLED()‏ The Scribbler robot has 3 green LED lights. You can control these three lights with setLED(position, value). Position is a number: 0, 1, or 2 or a string “left”, “center”, or “right” Value is either 0 (“off”) or 1 (“on”)‏ The center light blinks continuously, so unless you keep setting it's value, it will just start blinking again.

29 Aug 29 2007 29 LED commands – setLEDFront() and setLEDBack()‏ The Fluke board has 2 user controlled red LED lights. One on the front (small, near the camera) and one on the back (large, near the white GPIO connector)‏ You can control these three lights with setLEDFront(value) and setLEDBack(value) functions. Value is either 0 (“off”) or 1 (“on”)‏ The back LED is VERY bright! And you can set it to half power with a 0.5 value, or quarter power with 0.25.

30 Aug 29 2007 30 Go play with your robot! Go play with your robot's sensors and actuators!


Download ppt "CS 1 with Robots Robot Sensors & Actuators Institute for Personal Robots in Education (IPRE)‏"

Similar presentations


Ads by Google