At Kinvert we teach STEM, and one great tool we use is Cozmo. Hello world is the iconic first program most coders write when starting to learn a new programming language. We’ll use cozmo.robot.Robot.say_text() for Cozmo Hello World.
cozmo.robot.Robot.say_text()
For Cozmo Hello World, we’ll be using the say_text() command.
Let’s take a look at the parameters for this method:
- text – This is the string that Cozmo will say
- play_excited_animation – a boolean that can make Cozmo move while speaking, or not
- use_cozmo_voice – Cozmo will speak in his voice if this is true, otherwise use a ‘normal’ human voice
- duration_scalar – We haven’t used this yet but it seems to change how quickly he talks
- voice_pitch – Change the pitch of his voice if you want
- in_parallel – Many of Cozmo’s actions have the ability to run in parallel
- num_retries – You can try multiple times in case an attempt failed for some reason
say_text() returns a cozmo.robot.SayText action. This is what causes Cozmo to actually speak and say Hello world.
For more specifics on cozmo.robot.Robot.say_text() check out http://cozmosdk.anki.com/docs/generated/cozmo.robot.html?#cozmo.robot.Robot.say_text
The Code – Cozmo Hello World Using say_text
asdf
""" Copyright Kinvert All Rights Reserved If you would like to use this code for business or education please contact us for permission at: www.kinvert.com/ """ import cozmo def kinvert_hello_world(robot: cozmo.robot.Robot): robot.say_text("Hello world!").wait_for_completed() cozmo.robot.Robot.drive_off_charger_on_connect = False cozmo.run_program(kinvert_hello_world)
For being such a powerful system, this is pretty straight forward. With regular Python, Hello World is a bit easier. However you lose student engagement. Cozmo’s interactivity is well worth a few extra lines of code.
Regular Python:
print("Hello world!")
In this case, Python would only print Hello world. In Cozmo Hello World, using say_text, Cozmo says Hello world. This is a big deal when it comes to student engagement and keeping their attention.
In Conclusion – Say Text and Cozmo Hello World
Though programming with Cozmo is slightly more difficult, it’s well worth it. With a few extra lines of code, you can drastically improve student engagement. Classes are more exciting and interesting. Kids would much prefer to see a physical manifestation of their code rather than just watch text on a screen.
For some useful links check out:
Our Introduction to the Anki Cozmo SDK Programmable Robot for Kids in Python
Robotics for Kids and Teens Course
Help With Cozmo Curriculum for STEM Classes K-12
Cozmo Examples, Projects, and Tutorials for STEM Education Curriculum
Kinvert’s Awesome Cozmo Robotics Competition Camp
As always, if you have any questions, please leave a comment below or head to our Contact page.
If you have Vector check out the Anki Vector SDK and Vector Examples.
If Python is a bit over your head, look at Age to Teach Kids Python, What is Robotics, and Block Coding.
I was wondering if I could use your drawings for a channel in YouTube. I need your permission to do this and I won’t get mad if you don’t give me it. If you say yes then I will put the name of this website on the picture. Just so you know my channel is unexsistent yet so it is not popular.
Hi Sofia,
Thanks for asking 🙂
Will discuss via email.
Thanks,
Keith