cozmo.lights

Helper routines for dealing with Cozmo’s lights and colors.

Classes

Color([int_color, rgb, name]) A Color to be used with a Light.
Light([on_color, off_color, on_period_ms, …]) Lights are used with LightCubes and Cozmo’s backpack.
cozmo.lights.green = <cozmo.lights.Color object>

Green color instance.

Type:Color
cozmo.lights.red = <cozmo.lights.Color object>

Red color instance.

Type:Color
cozmo.lights.blue = <cozmo.lights.Color object>

Blue color instance.

Type:Color
cozmo.lights.white = <cozmo.lights.Color object>

White color instance.

Type:Color
cozmo.lights.off = <cozmo.lights.Color object>

instance representing no color (LEDs off).

Type:Color
cozmo.lights.green_light = <cozmo.lights.Light object>

A steady green colored LED light.

Type:Light
cozmo.lights.red_light = <cozmo.lights.Light object>

A steady red colored LED light.

Type:Light
cozmo.lights.blue_light = <cozmo.lights.Light object>

A steady blue colored LED light.

Type:Light
cozmo.lights.white_light = <cozmo.lights.Light object>

A steady white colored LED light.

Type:Light
cozmo.lights.off_light = <cozmo.lights.Light object>

A steady off (non-illuminated LED light).

Type:Light
class cozmo.lights.Color(int_color=None, rgb=None, name=None)

A Color to be used with a Light.

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 (int) – A 32 bit value holding the binary RGBA value (where A is ignored and forced to be fully opaque).
  • rgb (tuple) – A tuple holding the integer values from 0-255 for (red, green, blue)
  • name (str) – A name to assign to this color
int_color

The encoded integer value of the color.

Type:int
class cozmo.lights.Light(on_color=<cozmo.lights.Color object>, off_color=<cozmo.lights.Color object>, on_period_ms=250, off_period_ms=0, transition_on_period_ms=0, transition_off_period_ms=0)

Lights are used with LightCubes and Cozmo’s backpack.

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

flash(on_period_ms=250, off_period_ms=250, off_color=<cozmo.lights.Color object>)

Convenience function to make a flashing version of an existing Light instance.

Parameters:
  • on_period_ms (int) – The number of milliseconds the light should be “on” for for each cycle.
  • off_period_ms (int) – The number of milliseconds the light should be “off” for for each cycle.
  • off_color (Color) – The color to flash to for the off state.
Returns:

Color instance.

off_color

The Color shown when the light is off.

Type:Color
off_period_ms

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

Type:int
on_color

The Color shown when the light is on.

Type:Color
on_period_ms

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

Type:int
transition_off_period_ms

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

Type:int
transition_on_period_ms

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

Type:int