Playing games with robots is so fun, so i worked to make it happen

What it does

Peekaboo, thats it

How I built it

off an existing sdk, i needed to edit some methods and change some variables so everything would compile

Challenges I ran into

deprecated methods would crash the code.

Accomplishments that I'm proud of

I got it to work

What I learned

Always read the developer guides

What's next for Cozmo Peekaboo

Continue more fun and interactive methods of interaction

Built With

Share this project:


posted an update

import asyncio import time import cozmo import random from cozmo.util import degrees, Pose

'''This is a script for game Peek a Boo. It will first store the players' names and then play peek a boo with the player. '''

class PeekABoo:

def __init__(self, *a, **kw):
    self.coz = None
    self.face = None = None
    self.count = 0

async def run(self, coz_conn):
    self.coz = await coz_conn.wait_for_robot()

    while True:
        find_face = self.coz.start_behavior(cozmo.behavior.BehaviorTypes.FindFaces)
            self.face = await
            print("Found face", self.face)
        except asyncio.TimeoutError:
            print("Didn't find a face")


        if self.face is None:
            anim = await self.coz.play_anim_trigger(cozmo.anim.Triggers.PounceFail).wait_for_completed()
            anim = await self.coz.play_anim_trigger(cozmo.anim.Triggers.PounceSuccess).wait_for_completed()
            await self.coz.set_head_angle(degrees(45.0)).wait_for_completed()
            if == "":
                await self.coz.say_text("My name is, Cozmo").wait_for_completed()
                await self.coz.say_text("I am a sentient robot who knows a thing or two about you silly humans.").wait_for_completed()
                await self.coz.say_text("What is your name?").wait_for_completed()
                new_name = input("Input your name.")
                await self.coz.say_text("Hi" + new_name).wait_for_completed()
                await self.coz.say_text("Hi" +

            await self.coz.say_text("Let's play peek a boo, Dude!").wait_for_completed()
            await self.start_game()

async def start_game(self):
    await self.coz.play_anim_trigger(cozmo.anim.Triggers.CubePounceWinSession).wait_for_completed()
    count = 0
    while True:
        if count >= 6:
            await self.end_game()
        peek_a_boo_find_face = self.coz.start_behavior(cozmo.behavior.BehaviorTypes.FindFaces)
        count = count + 1
        new_face = None
            new_face = await
            print("Found face", new_face)
        except asyncio.TimeoutError:
            print("Didn't find a face")

        if new_face is not None:
            if new_face.face_id == self.face.face_id:
                seeyou_text = [", I see you", ", you are here", ", haha",", You are so funny", ", you are really good at hide and seek." ]
                anim = await self.coz.play_anim("anim_sparking_success_02").wait_for_completed()
                await self.coz.say_text( + random.choice(seeyou_text)).wait_for_completed()
                await self.coz.drive_wheels(-400, -400, duration=1)
                await self.coz.say_text("who are you, you look weird").wait_for_completed()
                await self.coz.turn_in_place(degrees(90)).wait_for_completed()
                await self.coz.drive_wheels(500, 500, duration=1)
                await self.coz.say_text("You are not, " +
                await self.coz.turn_in_place(degrees(170)).wait_for_completed()
                await self.coz.say_text("Where is, " +
                await self.coz.drive_wheels(350, 400, duration=1)
                await self.coz.turn_in_place(degrees(90)).wait_for_completed()
                await self.coz.drive_wheels(300, 300, duration=0.5)
                await self.coz.say_text("I want to play with, " +
            anim = await self.coz.play_anim("id_rollblock_fail_01").wait_for_completed()
            await self.coz.say_text("Where are you.").wait_for_completed()

async def end_game(self):
    await self.coz.say_text("I want to sleep").wait_for_completed()
    await self.coz.play_anim("anim_launch_sleeping_01").wait_for_completed()

if name == 'main': cozmo.setup_basic_logging() PeekABoo()

Log in or sign up for Devpost to join the conversation.