Skip to content
This repository has been archived by the owner on Oct 2, 2020. It is now read-only.

Commit

Permalink
Update for 1.4.8 release, take 2 (anki#213)
Browse files Browse the repository at this point in the history
* Update PyPI text

* Add ability to ignore tracks to play_anim

* Set Animation class new ignore track params to False
  • Loading branch information
msintov authored Jan 8, 2019
1 parent 394ea6e commit 505c438
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 34 deletions.
37 changes: 7 additions & 30 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,41 +13,18 @@
# limitations under the License.

'''
Cozmo, by Anki.
The Cozmo SDK is a flexible vision-based robotics platform used in enterprise, education, and entertainment.
Cozmo is a small robot with a big personality.
Cozmo’s pioneering combination of advanced robotics hardware and software are part of what make him an innovative consumer experience. But it’s also what makes him, in conjunction with the Cozmo SDK, a groundbreaking robotics platform that’s expressive, engaging, and entertaining.
This library lets you take command of Cozmo and write programs for him.
We built the Cozmo SDK to be robust enough for enterprise and research, but simple enough for anyone with a bit of technical know-how to tap into our sophisticated robotics and AI technologies. Organizations and institutions using the Cozmo SDK include SAP, Oracle, Carnegie Mellon University, and Georgia Tech. Find out more at developer.anki.com
Cozmo features:
Cozmo SDK documentation: http://cozmosdk.anki.com/docs/
* A camera with advanced vision system
* A robotic lifter
* Independent tank treads
* Pivotable head
* An array of LEDs
* An accelerometer
* A gyroscope
* Cliff detection
* Face recognition
* Path planning
* Animation and behavior systems
* Power cubes, with LEDs, an accelerometer and tap detection
This SDK provides users with access to take control of Cozmo and write simple
or advanced programs with him.
Official developer forum: https://forums.anki.com/
Requirements:
* Python 3.5.1 or later
Optional requirements for camera image processing/display:
* Tkinter (Usually supplied by default with Python)
* Pillow
* NumPy
Optional requirements for 3D viewer/visualization:
* PyOpenGL
* Pillow
'''


Expand Down Expand Up @@ -81,9 +58,9 @@ def fetch_version():
version=version,
description='SDK for Anki Cozmo, the small robot with the big personality',
long_description=__doc__,
url='https://developer.anki.com/cozmo/',
url='https://developer.anki.com',
author='Anki, Inc',
author_email='cozmosdk@anki.com',
author_email='developer@anki.com',
license='Apache License, Version 2.0',
# See https://pypi.python.org/pypi?%3Aaction=list_classifiers
classifiers=[
Expand Down
23 changes: 20 additions & 3 deletions src/cozmo/anim.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,8 @@ class EvtAnimationCompleted(action.EvtActionCompleted):

class Animation(action.Action):
'''An Animation describes an actively-playing animation on a robot.'''
def __init__(self, anim_name, loop_count, **kw):
def __init__(self, anim_name, loop_count, ignore_body_track=False,
ignore_head_track=False, ignore_lift_track=False, **kw):
super().__init__(**kw)

#: The name of the animation that was dispatched
Expand All @@ -52,11 +53,27 @@ def __init__(self, anim_name, loop_count, **kw):
#: The number of iterations the animation was requested for
self.loop_count = loop_count

#: bool: True to ignore the body track (i.e. the wheels / treads)
self.ignore_body_track = ignore_body_track

#: bool: True to ignore the head track
self.ignore_head_track = ignore_head_track

#: bool: True to ignore the lift track
self.ignore_lift_track = ignore_lift_track


def _repr_values(self):
return "anim_name=%s loop_count=%s" % (self.anim_name, self.loop_count)
all_tracks = {"body":self.ignore_body_track,
"head":self.ignore_head_track,
"lift":self.ignore_lift_track}
ignore_tracks = [k for k, v in all_tracks.items() if v]

return "anim_name=%s loop_count=%s ignore_tracks=%s" % (self.anim_name, self.loop_count, str(ignore_tracks))

def _encode(self):
return _clad_to_engine_iface.PlayAnimation(animationName=self.anim_name, numLoops=self.loop_count)
return _clad_to_engine_iface.PlayAnimation(animationName=self.anim_name, numLoops=self.loop_count, ignoreBodyTrack=self.ignore_body_track,
ignoreHeadTrack=self.ignore_head_track, ignoreLiftTrack=self.ignore_lift_track)

def _dispatch_completed_event(self, msg):
self._completed_event = EvtAnimationCompleted(
Expand Down
10 changes: 9 additions & 1 deletion src/cozmo/robot.py
Original file line number Diff line number Diff line change
Expand Up @@ -1625,7 +1625,8 @@ def play_song(self, song_notes, loop_count=1, in_parallel=False, num_retries=0):
num_retries=num_retries)
return action

def play_anim(self, name, loop_count=1, in_parallel=False, num_retries=0):
def play_anim(self, name, loop_count=1, in_parallel=False, num_retries=0,
ignore_body_track=False, ignore_head_track=False, ignore_lift_track=False):
'''Starts an animation playing on a robot.
Returns an Animation object as soon as the request to play the animation
Expand All @@ -1645,6 +1646,12 @@ def play_anim(self, name, loop_count=1, in_parallel=False, num_retries=0):
be already complete.
num_retries (int): Number of times to retry the action if the
previous attempt(s) failed.
ignore_body_track (bool): True to ignore the animation track for
Cozmo's body (i.e. the wheels / treads).
ignore_head_track (bool): True to ignore the animation track for
Cozmo's head.
ignore_lift_track (bool): True to ignore the animation track for
Cozmo's lift.
Returns:
A :class:`cozmo.anim.Animation` action object which can be queried
to see when it is complete.
Expand All @@ -1654,6 +1661,7 @@ def play_anim(self, name, loop_count=1, in_parallel=False, num_retries=0):
if name not in self.conn.anim_names:
raise ValueError('Unknown animation name "%s"' % name)
action = self.animation_factory(name, loop_count,
ignore_body_track, ignore_head_track, ignore_lift_track,
conn=self.conn, robot=self, dispatch_parent=self)
self._action_dispatcher._send_single_action(action,
in_parallel=in_parallel,
Expand Down

0 comments on commit 505c438

Please sign in to comment.