pycozmo.anim_encoder¶
Reading and writing of Cozmo animations in FlatBuffers (.bin) and JSON format.
Cozmo animations are stored in files/cozmo/cozmo_resources/assets/animations inside the Cozmo mobile application.
Animation data structures are declared in FlatBuffers format in files/cozmo/cozmo_resources/config/cozmo_anim.fbs .
Functions
get_clip_metadata (dspec) |
Retrieve clip metadata from animation FlatBuffers .bin files. |
Classes
AnimBackpackLights (trigger_time_ms, …) |
Backpack lights keyframe class. |
AnimBase () |
Animation element base class. |
AnimBodyMotion (trigger_time_ms, duration_ms, …) |
Body motion keyframe class. |
AnimClip (name, keyframes) |
Animation clip class. |
AnimClips (clips) |
Animation clips class. |
AnimEvent (trigger_time_ms, event_id) |
Event keyframe class. |
AnimFaceAnimation (trigger_time_ms, anim_name) |
Face animation keyframe class. |
AnimHeadAngle (trigger_time_ms, duration_ms, …) |
Head angle keyframe class. |
AnimKeyframe () |
Animation keyframe base class. |
AnimLiftHeight (trigger_time_ms, duration_ms, …) |
Lift height keyframe class. |
AnimLight (red, green, blue, ir) |
Light color class. |
AnimProceduralFace (trigger_time_ms, angle, …) |
Procedural face keyframe class. |
AnimRecordHeading (trigger_time_ms) |
Record heading keyframe class. |
AnimRobotAudio (trigger_time_ms, …) |
Robot audio keyframe class. |
AnimTurnToRecordedHeading (trigger_time_ms, …) |
Turn-to-recorded-heading keyframe class. |
ClipMetadata (fspec, index, name, …) |
Animation clip metadata class. |
-
class
pycozmo.anim_encoder.
AnimBase
¶ Bases:
abc.ABC
Animation element base class.
-
classmethod
from_dict
(data)¶
-
classmethod
from_fb
(buf)¶
-
to_dict
() → dict¶
-
to_fb
(builder: flatbuffers.builder.Builder)¶
-
classmethod
-
class
pycozmo.anim_encoder.
AnimClip
(name: str, keyframes: Iterable[pycozmo.anim_encoder.AnimKeyframe] = ())¶ Bases:
pycozmo.anim_encoder.AnimBase
Animation clip class.
-
classmethod
from_dict
(data: dict) → pycozmo.anim_encoder.AnimClip¶
-
classmethod
from_fb
(fbclip: pycozmo.CozmoAnim.AnimClip.AnimClip) → pycozmo.anim_encoder.AnimClip¶
-
to_dict
() → dict¶
-
to_fb
(builder: flatbuffers.builder.Builder)¶
-
classmethod
-
class
pycozmo.anim_encoder.
AnimClips
(clips: Iterable[pycozmo.anim_encoder.AnimClip] = ())¶ Bases:
pycozmo.anim_encoder.AnimBase
Animation clips class.
-
classmethod
from_dict
(data: dict) → pycozmo.anim_encoder.AnimClips¶
-
classmethod
from_fb
(fbclips: pycozmo.CozmoAnim.AnimClips.AnimClips) → pycozmo.anim_encoder.AnimClips¶
-
classmethod
from_fb_file
(fspec: str) → pycozmo.anim_encoder.AnimClips¶
-
classmethod
from_fb_stream
(f: BinaryIO) → pycozmo.anim_encoder.AnimClips¶
-
classmethod
from_json_file
(fspec: str) → pycozmo.anim_encoder.AnimClips¶
-
classmethod
from_json_stream
(f: TextIO) → pycozmo.anim_encoder.AnimClips¶
-
to_dict
() → dict¶
-
to_fb
(builder: flatbuffers.builder.Builder)¶
-
to_fb_file
(fspec: str)¶
-
to_fb_stream
(f: BinaryIO)¶
-
to_json_file
(fspec: str) → None¶
-
to_json_stream
(f: TextIO) → None¶
-
classmethod
-
class
pycozmo.anim_encoder.
AnimLight
(red: int = 0, green: int = 0, blue: int = 0, ir: int = 0)¶ Bases:
object
Light color class.
-
classmethod
from_dict
(data) → pycozmo.anim_encoder.AnimLight¶
-
to_dict
() → list¶
-
classmethod
-
class
pycozmo.anim_encoder.
AnimKeyframe
¶ Bases:
pycozmo.anim_encoder.AnimBase
,abc.ABC
Animation keyframe base class.
-
classmethod
from_dict
(data)¶
-
classmethod
from_fb
(buf)¶
-
to_dict
() → dict¶
-
to_fb
(builder: flatbuffers.builder.Builder)¶
-
classmethod
-
class
pycozmo.anim_encoder.
AnimHeadAngle
(trigger_time_ms: int = 0, duration_ms: int = 0, angle_deg: int = 0, variability_deg: int = 0)¶ Bases:
pycozmo.anim_encoder.AnimKeyframe
Head angle keyframe class.
-
classmethod
from_dict
(data) → pycozmo.anim_encoder.AnimHeadAngle¶
-
classmethod
from_fb
(fbkf: pycozmo.CozmoAnim.HeadAngle.HeadAngle) → pycozmo.anim_encoder.AnimHeadAngle¶
-
to_dict
() → dict¶
-
to_fb
(builder: flatbuffers.builder.Builder)¶
-
classmethod
-
class
pycozmo.anim_encoder.
AnimLiftHeight
(trigger_time_ms: int = 0, duration_ms: int = 0, height_mm: int = 0, variability_mm: int = 0)¶ Bases:
pycozmo.anim_encoder.AnimKeyframe
Lift height keyframe class.
-
classmethod
from_dict
(data) → pycozmo.anim_encoder.AnimLiftHeight¶
-
classmethod
from_fb
(fbkf: pycozmo.CozmoAnim.LiftHeight.LiftHeight) → pycozmo.anim_encoder.AnimLiftHeight¶
-
to_dict
() → dict¶
-
to_fb
(builder: flatbuffers.builder.Builder)¶
-
classmethod
-
class
pycozmo.anim_encoder.
AnimRecordHeading
(trigger_time_ms: int = 0)¶ Bases:
pycozmo.anim_encoder.AnimKeyframe
Record heading keyframe class.
-
classmethod
from_dict
(data) → pycozmo.anim_encoder.AnimRecordHeading¶
-
classmethod
from_fb
(fbkf: pycozmo.CozmoAnim.RecordHeading.RecordHeading) → pycozmo.anim_encoder.AnimRecordHeading¶
-
to_dict
() → dict¶
-
to_fb
(builder: flatbuffers.builder.Builder)¶
-
classmethod
-
class
pycozmo.anim_encoder.
AnimTurnToRecordedHeading
(trigger_time_ms: int = 0, duration_ms: int = 0, offset_deg: int = 0, speed_deg_per_sec: int = 0, accel_deg_per_sec_2: int = 1000, decel_deg_per_sec_2: int = 1000, tolerance_deg: int = 2, num_half_revs: int = 0, use_shortest_dir: bool = False)¶ Bases:
pycozmo.anim_encoder.AnimKeyframe
Turn-to-recorded-heading keyframe class.
-
classmethod
from_dict
(data) → pycozmo.anim_encoder.AnimTurnToRecordedHeading¶
-
classmethod
from_fb
(fbkf: pycozmo.CozmoAnim.TurnToRecordedHeading.TurnToRecordedHeading) → pycozmo.anim_encoder.AnimTurnToRecordedHeading¶
-
to_dict
() → dict¶
-
to_fb
(builder: flatbuffers.builder.Builder)¶
-
classmethod
-
class
pycozmo.anim_encoder.
AnimBodyMotion
(trigger_time_ms: int = 0, duration_ms: int = 0, radius_mm: Union[float, str] = 'STRAIGHT', speed: int = 0)¶ Bases:
pycozmo.anim_encoder.AnimKeyframe
Body motion keyframe class.
-
classmethod
from_dict
(data) → pycozmo.anim_encoder.AnimBodyMotion¶
-
classmethod
from_fb
(fbkf: pycozmo.CozmoAnim.BodyMotion.BodyMotion) → pycozmo.anim_encoder.AnimBodyMotion¶
-
to_dict
() → dict¶
-
to_fb
(builder: flatbuffers.builder.Builder)¶
-
classmethod
-
class
pycozmo.anim_encoder.
AnimBackpackLights
(trigger_time_ms: int = 0, duration_ms: int = 0, left: pycozmo.anim_encoder.AnimLight = <pycozmo.anim_encoder.AnimLight object>, front: pycozmo.anim_encoder.AnimLight = <pycozmo.anim_encoder.AnimLight object>, middle: pycozmo.anim_encoder.AnimLight = <pycozmo.anim_encoder.AnimLight object>, back: pycozmo.anim_encoder.AnimLight = <pycozmo.anim_encoder.AnimLight object>, right: pycozmo.anim_encoder.AnimLight = <pycozmo.anim_encoder.AnimLight object>)¶ Bases:
pycozmo.anim_encoder.AnimKeyframe
Backpack lights keyframe class.
-
classmethod
from_dict
(data) → pycozmo.anim_encoder.AnimBackpackLights¶
-
classmethod
from_fb
(fbkf: pycozmo.CozmoAnim.BackpackLights.BackpackLights) → pycozmo.anim_encoder.AnimBackpackLights¶
-
to_dict
() → dict¶
-
to_fb
(builder: flatbuffers.builder.Builder)¶
-
classmethod
-
class
pycozmo.anim_encoder.
AnimFaceAnimation
(trigger_time_ms: int = 0, anim_name: str = '')¶ Bases:
pycozmo.anim_encoder.AnimKeyframe
Face animation keyframe class.
-
classmethod
from_dict
(data) → pycozmo.anim_encoder.AnimFaceAnimation¶
-
classmethod
from_fb
(fbkf: pycozmo.CozmoAnim.FaceAnimation.FaceAnimation) → pycozmo.anim_encoder.AnimFaceAnimation¶
-
to_dict
() → dict¶
-
to_fb
(builder: flatbuffers.builder.Builder)¶
-
classmethod
-
class
pycozmo.anim_encoder.
AnimProceduralFace
(trigger_time_ms: int = 0, angle: float = 0.0, center_x: float = 0.0, center_y: float = 0.0, scale_x: float = 1.0, scale_y: float = 1.0, left_eye: Iterable[float] = (), right_eye: Iterable[float] = ())¶ Bases:
pycozmo.anim_encoder.AnimKeyframe
Procedural face keyframe class.
-
classmethod
from_dict
(data) → pycozmo.anim_encoder.AnimProceduralFace¶
-
classmethod
from_fb
(fbkf: pycozmo.CozmoAnim.ProceduralFace.ProceduralFace) → pycozmo.anim_encoder.AnimProceduralFace¶
-
to_dict
() → dict¶
-
to_fb
(builder: flatbuffers.builder.Builder)¶
-
classmethod
-
class
pycozmo.anim_encoder.
AnimRobotAudio
(trigger_time_ms: int = 0, audio_event_ids: Iterable[int] = (), volume: float = 1.0, probabilities: Iterable[float] = (), has_alts: bool = True)¶ Bases:
pycozmo.anim_encoder.AnimKeyframe
Robot audio keyframe class.
-
classmethod
from_dict
(data) → pycozmo.anim_encoder.AnimRobotAudio¶
-
classmethod
from_fb
(fbkf: pycozmo.CozmoAnim.RobotAudio.RobotAudio) → pycozmo.anim_encoder.AnimRobotAudio¶
-
to_dict
() → dict¶
-
to_fb
(builder: flatbuffers.builder.Builder)¶
-
classmethod
-
class
pycozmo.anim_encoder.
AnimEvent
(trigger_time_ms: int = 0, event_id: str = '')¶ Bases:
pycozmo.anim_encoder.AnimKeyframe
Event keyframe class.
-
classmethod
from_dict
(data) → pycozmo.anim_encoder.AnimEvent¶
-
classmethod
from_fb
(fbkf: pycozmo.CozmoAnim.Event.Event) → pycozmo.anim_encoder.AnimEvent¶
-
to_dict
() → dict¶
-
to_fb
(builder: flatbuffers.builder.Builder)¶
-
classmethod
-
class
pycozmo.anim_encoder.
ClipMetadata
(fspec: str, index: int, name: str, has_head_angle_track: bool, has_lift_height_track: bool, has_record_heading_track: bool, has_turn_to_recorded_heading_track: bool, has_body_motion_track: bool, has_backpack_lights_track: bool, has_face_animation_track: bool, has_procedural_face_track: bool, has_robot_audio_track: bool, has_event_track: bool)¶ Bases:
object
Animation clip metadata class.
-
pycozmo.anim_encoder.
get_clip_metadata
(dspec: str) → Dict[str, pycozmo.anim_encoder.ClipMetadata]¶ Retrieve clip metadata from animation FlatBuffers .bin files.