song_match.cube

song_match.cube.lights

Predefined Light instances for Cozmo’s cubes.

song_match.cube.lights.BLUE_LIGHT = <cozmo.lights.Light object>

Light - Blue light instance.

song_match.cube.lights.CYAN_LIGHT = <cozmo.lights.Light object>

Light - Cyan light instance.

song_match.cube.lights.GREEN_LIGHT = <cozmo.lights.Light object>

Light - Green light instance.

song_match.cube.lights.ORANGE_LIGHT = <cozmo.lights.Light object>

Light - Orange light instance.

song_match.cube.lights.PINK_LIGHT = <cozmo.lights.Light object>

Light - Pink light instance.

song_match.cube.lights.RED_LIGHT = <cozmo.lights.Light object>

Light - Red light instance.

song_match.cube.lights.YELLOW_LIGHT = <cozmo.lights.Light object>

Light - Yellow light instance.

song_match.cube.note_cube

Module containing NoteCube.

class song_match.cube.note_cube.NoteCube(cube: cozmo.objects.LightCube, song: song_match.song.song.Song)[source]

Bases: object

Wrapper class for a LightCube to play a note when tapped.

Blink the cube and play the corresponding note.

Parameters:blink_duration – How long the cube blinks for in seconds.
Returns:None
cube_id

Property to access the cube_id of a cube.

Returns:cube_id
flash(light: cozmo.lights.Light, num_times: int, delay=0.15) → None[source]

Flash a light a certain number of times.

Parameters:
  • light – The light to flash.
  • num_times – The number of times to flash the light.
  • delay – Time in seconds between turning the light on and off.
Returns:

None

note

Property to access the Note of a cube.

Returns:Note
classmethod of(song_robot, cube_id: int) → song_match.cube.note_cube.NoteCube[source]

Static factory method for creating a NoteCube from SongRobot.

Parameters:
set_lights(light: cozmo.lights.Light) → None[source]

Wrapper method for set_lights().

Returns:None
set_lights_off() → None[source]

Wrapper method for set_lights_off().

Returns:None
start_light_chaser(delay: float = 0.1) → None[source]

Rotates the cube’s color around the light corners in a continuous loop.

Parameters:delay – Time awaited before moving the rotating lights.
stop_light_chaser() → None[source]

Ends the light chaser effect.

Returns:None
turn_on_light() → None[source]

Turn on the light for the cube assigned in Song.

Returns:None

song_match.cube.note_cubes

Module containing NoteCubes.

class song_match.cube.note_cubes.NoteCubes(note_cubes: List[song_match.cube.note_cube.NoteCube], song: song_match.song.song.Song)[source]

Bases: object

Container class for three NoteCube.

flash_lights(num_times: int = 4, delay=0.15) → None[source]

Flash the lights of each cube.

Parameters:
  • num_times – The number of times to flash lights.
  • delay – Time in seconds between turning the light on and off.
Returns:

None

flash_lights_green(num_times: int = 3, delay=0.15) → None[source]

Flash the lights of each cube green.

Parameters:
  • num_times – The number of times to flash green.
  • delay – Time in seconds between turning the light on and off.
Returns:

None

flash_single_cube(cube_id: int, light: cozmo.lights.Light) → None[source]

Flashes the light of a single cube, while turning the lights of the other cubes off.

Parameters:
Returns:

None

flash_single_cube_green(cube_id: int) → None[source]

Convenience method for calling flash_single_cube() with a green_light.

Parameters:cube_idcube_id
Returns:None
flash_single_cube_red(cube_id: int) → None[source]

Convenience method for calling flash_single_cube() with a red_light.

Parameters:cube_idcube_id
Returns:None
static of() → song_match.cube.note_cubes.NoteCubes[source]

Static factory method for creating NoteCubes from SongRobot.

Parameters:song_robotSongRobot
set_lights(light: cozmo.lights.Light) → None[source]

Call set_lights() for each cube.

Parameters:lightLight
Returns:None
set_lights_off() → None[source]

Call set_lights_off() for each cube.

Returns:None
start_and_stop_light_chasers(time_before_stop=2) → None[source]

Starts and stops the light chaser effect for each cube.

Parameters:time_before_stop – Time to wait before the light chaser effect stops (in seconds).
Returns:None
start_light_chasers() → None[source]

Starts the light chaser effect for each cube.

Returns:None
start_light_chasers_and_flash_lights(num_times=2) → None[source]

Starts the light chaser effect and flashes the cubes

Parameters:num_times – The number of times to perform the light chaser effect and flash the cubes.
Returns:None
stop_light_chasers() → None[source]

Stops the light chaser effect for each cube.

Returns:None
turn_on_lights() → None[source]

Turn on the light for each note cube.

This method turns on the lights assigned in Song.

Returns:None
song_match.cube.note_cubes.get_note_cubes(light_cubes: List[cozmo.objects.LightCube], song: song_match.song.song.Song) → List[song_match.cube.note_cube.NoteCube][source]

Convert a list of light cubes to note cubes.

Parameters:
  • light_cubes – A list of three LightCube instances.
  • songSong
Returns:

A list of three NoteCube instances.

song_match.cube.util

song_match.cube.util.get_light_cube(song_robot, cube_id: int) → cozmo.objects.LightCube[source]

Convenience method to get a light cube instance.

Parameters:
Returns:

LightCube

song_match.cube.util.get_light_cubes(song_robot) → List[cozmo.objects.LightCube][source]

Convenience method to get a list of light cubes.

Parameters:song_robotSongRobot
Returns:A list of three LightCube instances.