How to Move Cozmo’s Lift

In this article we will show you how to move Cozmo’s lift. We can do this with the Python SDK provided by Anki. This will enable us to move the Cozmo lift.

Why Move Cozmo’s Lift

Cozmo roll cube using Python SDK roll_cube in this Cozmo example lesson

There are many reasons to move Cozmo’s lift. I guess I’ll just list a few here but there are obviously plenty more.

  • Part of motion to make him look more life like
  • Lifting cubes
  • Preparing to roll cubes
  • Stacking cubes
  • Lift before tapping cubes

You get the picture. There are plenty of reasons to move Cozmo’s lift so let’s just jump in to it.

https://www.youtube.com/watch?v=dYNmqRIQFsk

Cozmo Move Lift Commands

What commands will we use? Let’s take a look.

  • cozmo.robot.Robot.move_lift()

Yep, we made this one super simple. We’ll make more in depth examples later but for now we’re trying to make some programs that beginners can write and use.

Cozmo Lift With cozmo.robot.Robot.roll_cube()

How to move Cozmo's lift using the move_lift command

First we need our imports. We import cozmo which gives us access to Cozmo’s commands including the move_lift function. Next we import time which gives us access to time.sleep() so we can tell Cozmo how long to do the actions.

We define the function cozmo_lift. This is the function we will call which will actually do the moves we request.

Inside this function are two calls to move_lift() and time.sleep(). The first slowly moves the lift up while the second moves Cozmo’s lift down rapidly.

The time.sleep is long for the first, since the lift is moving slowly, then short for the quick lift jerk downward.


"""
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/
Free for personal use
"""

import cozmo
import time

def cozmo_lift(robot: cozmo.robot.Robot):
    '''This is a docstring which says that this function moves Cozmo's lift - Code by Kinvert'''
    robot.move_lift(0.25) #radians per second
    time.sleep(3) #3 seconds
    robot.move_lift(-100)
    time.sleep(1)
    
cozmo.run_program(cozmo_lift)

How could you modify this program to try to toss a light cube?

What modification would make Cozmo tap a cube more gently?

How could you use this to try to make Cozmo pop a wheelie?

Having Fun Moving Cozmo’s Lift

Cozmo drawing for online coding class learn to program anki cozmo robot in python

At Kinvert we like to keep our lessons fun. After you make Cozmo cozmo lift, try having him do a victory dance.

For reference, check out our article on Cozmo Animations Play_Anim_Trigger().

How could you incorporate a bit of what you learn from there to spice this up and have Cozmo do a victory dance?

How can you move the lift to make Cozmo act cuter?

In Conclusion – Cozmo Move Lift Example

With simple commands we can make Cozmo do some pretty cool things. In the future we’ll be using similar commands to do things like roll Cozmo’s cube.

Are You a School?

We help schools create amazing STEM programs and makerspaces. If you’re interested in knowing more please go to our Contact Page.

Benefits, Pitfalls, and Resources for Anki Cozmo Curriculum for K-12 STEM Classes

Cozmo Examples, Tutorials, and Projects for K-12 STEM Education Curriculum

Anki Cozmo SDK Programmable Robot for Kids in Python

Are You a Parent or Student?

We have some useful resources I linked above.

In addition, you should check out our Anki Cozmo Robotics Competition Camp and our Robotics for Kids and Teens Course.

If you have any questions or comments please feel free to leave a comment below. Hope you found this helpful and fun!

Interested in reading about how to do similar things with the new Anki Vector? Check out our article on the Anki Vector SDK in Python.

If you want to know the Differences Between Cozmo and Vector check out the link to the left.

Python seem a bit too tough?

That’s fine. Check out What is Robotics, Block Coding, and Age to Teach Kids Python.

Anki Has Closed So Careful With Anki Cozmo

One response to “How to Move Cozmo’s Lift

  1. hello Mr. Keith we are happy to be in your class. And to program Cozzy (cozmo) Isn’t Isabelle so pretty and nice?
    Im glad shes here! And I am also glad your here to. I guess. And not some pycho! But every week I’m always so excited for Monday.. Not becauseI have to wake up early but because I get to go to ROBOTSSSSSSSSSSSSSSSSSSSS.

    ps this is from boom baby (Emily and Jessica) Bye now!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

Leave a Reply

Your email address will not be published. Required fields are marked *