Eye#
Introduction#
The GO Eye Sensor enables the robot to detect objects and return information relating to its appearance, such as colors and brightness.
For the examples below, the configured Eye Sensor will be named eye
. They will be used in all subsequent examples throughout this API documentation when referring to Eye
class methods.
Below is a list of all methods:
Mutators – Change the settings of the Eye Sensor.
set_light – Turn the Eye Sensor’s light on or off.
set_range – Set the Eye’s Sensor detection range.
set_light_power – Set the Eye’s light power level.
Getters – Return data from detected objects.
get_color – Returns the color detected by the Eye Sensor.
get_hue – Returns the hue detected by the hue.
get_brightness – Returns the brightness detected by the Eye Sensor.
is_object_detected – Returns whether or not an object is detected.
is_color_detected – Returns whether or not a certain color is detected.
Mutators#
set_light#
set_light
turns the Eye Sensor’s light on or off.
Usage:
eye.set_light(state)
Parameters |
Description |
---|---|
|
The state of the light to set:
|
# Example coming soon
set_range#
set_range
sets the range at which the Eye Sensor can detect objects.
Usage:
eye.set_range(distance)
Parameters |
Description |
---|---|
|
The state of the magnet to set:
|
# Example coming soon
set_light_power#
set_light_power
sets the brightness of the Eye Sensor’s light. If the light is not on when using this method, it will be turned on at the specified brightness.
Usage:
eye.set_light_power(value)
Parameters |
Description |
---|---|
|
The brightness of the light as a percent from 0% to 100%. |
# Example coming soon
Getters#
get_color#
get_color
returns the color detected by the Eye Sensor.
Usage:
eye.get_color()
Parameters |
Description |
---|---|
This method has no parameters. |
# Example coming soon
get_hue#
get_hue
returns the hue of a color detected by the Eye Sensor in degrees from 0 to 359.99.
Usage:
eye.get_hue()
Parameters |
Description |
---|---|
This method has no parameters. |
# Example coming soon
get_brightness#
get_brightness
returns the brightness detected by the Eye Sensor as a percent from 0% to 100%.
Usage:
eye.get_brightness()
Parameters |
Description |
---|---|
This method has no parameters. |
# Example coming soon
is_object_detected#
is_object_detected
returns a Boolean indicating whether or not an object is detected by the Eye Sensor.
True
– The Eye Sensor detects an object.False
– The Eye Sensor does not detect an object.
Usage:
eye.is_object_detected()
Parameters |
Description |
---|---|
This method has no parameters. |
# Example coming soon
is_color_detected#
is_color_detected
returns a Boolean indicating whether or not a specific color is detected by the Eye Sensor.
True
– The Eye Sensor detects the color.False
– The Eye Sensor does not detect the color.
Usage:
eye.is_color_detected(color)
Parameters |
Description |
---|---|
|
The color the Eye Sensor will check:
|
# Example coming soon