Finch

From IPRE Wiki
Jump to: navigation, search

Myro now supports the Finch.

The following documents the functionality available in Calico. You can access the Finch from any language that can load Calico modules.

See also the related Hummingbird robot and Calico software.

Getting Started with the Finch

To access the Finch robot:

1) On Linux, you will need udev rules:

For example, if this was in a file called "55-udev.rules":

SUBSYSTEM=="usb", ATTR{idVendor}=="2354", ATTR{idProduct}=="1111", MODE="0660", GROUP="plugdev"
SUBSYSTEM=="usb", ATTR{idVendor}=="2354", ATTR{idProduct}=="2222", MODE="0660", GROUP="plugdev"
KERNEL=="hidraw*", ATTRS{idVendor}=="2354", ATTRS{idProduct}=="1111", MODE="0666", GROUP="plugdev"
KERNEL=="hidraw*", ATTRS{idVendor}=="2354", ATTRS{idProduct}=="2222", MODE="0666", GROUP="plugdev"

Copy that to the udev rule directory:

sudo cp 55-udev.rules /etc/udev/rules.d/

2) In Calico, load the Myro module using any language that support Calico modules

For example, in Python:

from Myro import *

3) Use the makeRobot("Finch") function

4) Use many of the Calico Myro interface, including those below

5) Try one of the Finch examples. From Calico, menu -> File -> Examples -> Python -> Robots -> Finch. Also, see them online here:

https://bitbucket.org/ipre/calico/src/master/examples/python/Robots/Finch?at=master

LED

setLED("front", hex-color-string)

Sets the color of the LED on the front of the Finch.

The first parameter, position, should be set to "front" for the Finch

The second parameter is string starting with '#' followed by the hex value of the color in RRGGBB format, where RR is red between 00 and FF, GG is green between 00 and FF, and BB is blue between 00 and FF.

Example: setLED("front", "#00FF00") sets the LED to green.

Movement

All of the movement commands (forward, backward, motors, joystick, etc) from the standard Calico Myro API.

Beep

beep(duration, frequency)

Beeps for a certain duration and frequency

  • duration - The duration of the beep in seconds
  • frequency - The frequency of the beep in Hz

Example: beep(1, 440) - beeps for 1 second at 440 Hz

Light sensor

getLight(value)

Get left and right light sensors

  • value - "left" to return the left light sensor, "right" to return the right light sensor, and "both" to return both

An integer, or a two element array containing the the left and right light sensor values (0 to 255)

Acceleration

getAcceleration(position)

Returns the accelerations experienced by Finch's accelerometer, as well as tap and shake info. Values are -1.5g to 1.5g.

  • position - "x" to return the x acceleration, "y" to return the y accerleration, "z" to return the z acceleration, "tap" to return if the finch was tapped( 1 for yes, 0 for no), "shake" to return if the finch was shook, and "all" to return all five.

Returns A double, or an array of 5 doubles holding X, Y, and Z acceleration, and tap and shake info, null if the read failed.

Temperature

getTemperature()

Gets the temperature measured by the Finch's small temperature sensor.

Returns a double, which is the ambient temperature in Celcius

Obstacles

getObstacle(position)

Gets a two element boolean array representing the left (element 0) and right (element 1) obstacle sensors or a bool. True if an obstacle is detected, false otherwise.

  • position - "left" to return the left obstacle sensor, "right" to return the right obstacle sensor, "both" to return both

Returns bool or an array of bools containing Finch obstacle data.