anki_vector.lights

Helper routines for dealing with Vector’s Cube lights and colors.

Functions

package_request_params(lights, color_profile)

Classes

ColorProfile(red_multiplier, …)

Applies transforms to make Vector’s Cube lights and colors appear as intended, by limiting maximum channel intensity.

Light([on_color, off_color, on_period_ms, …])

Lights are used with Vector’s Cube.

anki_vector.lights.MAX_COLOR_PROFILE = <anki_vector.lights.ColorProfile object>

Color profile to get the maximum possible brightness out of each LED.

Type

ColorProfile

anki_vector.lights.blue_light = <anki_vector.lights.Light object>

A steady blue colored LED light.

Type

Light

anki_vector.lights.cyan_light = <anki_vector.lights.Light object>

A steady cyan colored LED light.

Type

Light

anki_vector.lights.green_light = <anki_vector.lights.Light object>

A steady green colored LED light.

Type

Light

anki_vector.lights.magenta_light = <anki_vector.lights.Light object>

A steady magenta colored LED light.

Type

Light

anki_vector.lights.off_light = <anki_vector.lights.Light object>

A steady off (non-illuminated LED light).

Type

Light

anki_vector.lights.red_light = <anki_vector.lights.Light object>

A steady red colored LED light.

Type

Light

anki_vector.lights.white_light = <anki_vector.lights.Light object>

A steady white colored LED light.

Type

Light

anki_vector.lights.yellow_light = <anki_vector.lights.Light object>

A steady yellow colored LED light.

Type

Light

class anki_vector.lights.Color(int_color=None, rgb=None, name=None)

A Color to be used with a Light or Vector’s screen.

Either int_color or rgb may be used to specify the actual color. Any alpha components (from int_color) are ignored - all colors are fully opaque.

Parameters
  • int_color (Optional[int]) – A 32 bit value holding the binary RGBA value (where A is ignored and forced to be fully opaque).

  • rgb (Optional[tuple]) – A tuple holding the integer values from 0-255 for (reg, green, blue)

  • name (Optional[str]) – A name to assign to this color.

int_color

The encoded integer value of the color.

Return type

int

rgb565_bytepair

Two bytes representing an int16 color with rgb565 encoding.

This format reflects the robot’s Screen color range, and performing this conversion will reduce network traffic when sending Screen data.

Type

bytes[]

class anki_vector.lights.ColorProfile(red_multiplier, green_multiplier, blue_multiplier)

Applies transforms to make Vector’s Cube lights and colors appear as intended, by limiting maximum channel intensity.

Parameters
  • red_multiplier (float) – Scaling value for the brightness of red Lights

  • green_multiplier (float) – Scaling value for the brightness of green Lights

  • blue_multiplier (float) – Scaling value for the brightness of blue Lights

blue_multiplier

The multiplier used on the red channel.

Type

float

green_multiplier

The multiplier used on the red channel.

Type

float

red_multiplier

The multiplier used on the red channel.

Type

float

class anki_vector.lights.Light(on_color=<anki_vector.color.Color object>, off_color=<anki_vector.color.Color object>, on_period_ms=250, off_period_ms=0, transition_on_period_ms=0, transition_off_period_ms=0)

Lights are used with Vector’s Cube.

Lights may either be “on” or “off”, though in practice any colors may be assigned to either state (including no color/light).

off_color

The color shown when the light is off.

Return type

Color

off_period_ms

The number of milliseconds the light should be “off” for for each cycle.

Return type

int

on_color

The color shown when the light is on.

Return type

Color

on_period_ms

The number of milliseconds the light should be “on” for for each cycle.

Return type

int

transition_off_period_ms

The number of milliseconds to take to transition the light to the off color.

Return type

int

transition_on_period_ms

The number of milliseconds to take to transition the light to the on color.

Return type

int