Kinvert will help you make Cozmo pop a wheelie in this coding example using pop_a_wheelie() in the Python SDK. First, we make Cozmo pop a wheelie. Then we’ll spice things up again to make this a more fun educational experience. Whether you’re a school developing a curriculum, or a student, you’ll love this article.
Why Make Cozmo Pop a Wheelie
Because it’s fun! Cozmo is a playful robot, and to avoid boredom he does several activities.
In the past, we have shown you how to Make Cozmo Roll Cubes. This is just one more trick up Cozmo’s sleeve.
Cozmo Pop a Wheelie is a lesson I like to introduce early on in our curriculum. It is easy for students to follow, and quickly introduces the strength of Cozmo – his playfulness and personality.
Let’s take a look at the commands a bit before diving in to the code.
Cozmo Pop a Wheelie Commands
What commands will we be using? Here they are:
- We’ll use a few more when adding our own personal touch
You can find more documentation here.
Though this method takes in several parameters, we’ll only be passing in the target_object as an argument. This will be the desired cube.
Time to see how we can use this command in our code.
Cozmo Pop a Wheelie with cozmo.robot.Robot.pop_a_wheelie()
Let’s first get Cozmo to pop a wheelie using the pop_a_wheelie() method. This method will need to have Cube 1 directly in Cozmo’s view or the program will just end. If the cube isn’t around 4 inches right in front of Cozmo, when the program begins, the code will just exit. Use the paperclip looking cube.
""" 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_wheelie(robot: cozmo.robot.Robot): cube1 = robot.world.get_light_cube(1) # looks like a paperclip robot.pop_a_wheelie(cube1).wait_for_completed() cozmo.run_program(kinvert_wheelie)
What do you think you could change with the code to make Cozmo pop a wheelie on a different cube?
Add Some Kinvert Style
Kinvert always works hard to keep our highly educational lessons fun. I want you to take a little while and think of a way you could make this a little more exciting. Use Cozmo’s personality and make this something special with your own touch.
If you aren’t a Kinvert student, you might not have done something like this before. Let me refer you to an article on Cozmo Animations Using Play_Anim_Trigger().
If this was a real Kinvert class you couldn’t just peak. So hopefully you used your creativity already to do this. Here is how I spiced up this Cozmo Pop a Wheelie example a bit.
""" 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_wheelie(robot: cozmo.robot.Robot): cube1 = robot.world.get_light_cube(1) # looks like a paperclip robot.pop_a_wheelie(cube1).wait_for_completed() robot.play_anim_trigger(cozmo.anim.Triggers.CodeLabSurprise).wait_for_completed() robot.drive_wheels(-100, 100, l_wheel_acc=999, r_wheel_acc=999, duration=0.3) robot.drive_wheels(100, -100, l_wheel_acc=999, r_wheel_acc=999, duration=0.6) robot.drive_wheels(-100, 100, l_wheel_acc=999, r_wheel_acc=999, duration=0.3) robot.play_anim_trigger(cozmo.anim.Triggers.CodeLabWhee1).wait_for_completed() robot.set_lift_height(1.0, accel=100.0, max_speed=100.0).wait_for_completed() robot.set_lift_height(0.0, accel=100.0, max_speed=100.0).wait_for_completed() robot.drive_wheels(-200, -200, l_wheel_acc=9999, r_wheel_acc=9999, duration=0.5) cozmo.run_program(kinvert_wheelie)
Wasn’t that a lot more fun?
If you think making Cozmo pop a wheelie was fun you should see the classes we teach and have developed for other schools.
Hopefully you’ve added your own flair to this exercise. If so, please share it below in the comments.
Interested in getting Cozmo into your school?
We have a lot more information about the Anki Cozmo SDK Programmable Robot for Kids in Python. This is our main Cozmo hub where you can find more information on Cozmo animations and a whole lot more.