cozmo.pets¶
Pet detection.
Cozmo is capable of detecting pet faces (cats and dogs).
The cozmo.world.World
object keeps track of pets the robot currently
knows about, along with those that are currently visible to the camera.
Each pet is assigned a Pet
object, which generates a number of
observable events whenever the pet is observed, etc.
If a pet goes off-screen, it will be assigned a new object_id (and therefore a new Pet object will be created) when it returns. This is because the system can only tell if something appears to be a cat or a dog; it cannot recognize a specific pet or, for instance, tell the difference between two dogs.
Note that these pet-specific events are also passed up to the
cozmo.world.World
object, so events for all pets can be
observed by adding handlers there.
Classes
EvtPetAppeared (**kwargs) |
Triggered whenever a pet is first visually identified by a robot. |
EvtPetDisappeared (**kwargs) |
Triggered whenever a pet that was previously being observed is no longer visible. |
EvtPetObserved (**kwargs) |
Triggered whenever a pet is visually identified by the robot. |
Pet (conn, world, robot[, pet_id]) |
A single pet that Cozmo has detected. |
-
cozmo.pets.
PET_VISIBILITY_TIMEOUT
= 0.4¶ Length of time in seconds to go without receiving an observed event before assuming that Cozmo can no longer see a pet.
-
cozmo.pets.
PET_TYPE_CAT
= 'cat'¶ Pet Type reported by Cozmo when he thinks it’s a cat
-
cozmo.pets.
PET_TYPE_DOG
= 'dog'¶ Pet Type reported by Cozmo when he thinks it’s a dog
-
cozmo.pets.
PET_TYPE_UNKNOWN
= 'unknown'¶ Pet Type reported by Cozmo when unsure of type of pet
-
class
cozmo.pets.
EvtPetAppeared
(**kwargs)¶ Triggered whenever a pet is first visually identified by a robot.
This differs from EvtPetObserved in that it’s only triggered when a pet initially becomes visible. If it disappears for more than PET_VISIBILITY_TIMEOUT seconds and then is seen again, a EvtPetDisappeared will be dispatched, followed by another EvtPetAppeared event.
For continuous tracking information about a visible pet, see EvtPetObserved.
-
image_box
= "A comzo.util.ImageBox defining where the pet is within Cozmo's camera view"¶
-
pet
= 'The Pet instance that was observed'¶
-
updated
= 'A set of field names that have changed'¶
-
-
class
cozmo.pets.
EvtPetDisappeared
(**kwargs)¶ Triggered whenever a pet that was previously being observed is no longer visible.
-
pet
= 'The Pet instance that is no longer being observed'¶
-
-
class
cozmo.pets.
EvtPetObserved
(**kwargs)¶ Triggered whenever a pet is visually identified by the robot.
A stream of these events are produced while a pet is visible to the robot. Each event has an updated image_box field.
See EvtPetAppeared if you only want to know when a pet first becomes visible.
-
image_box
= "A comzo.util.ImageBox defining where the pet is within Cozmo's camera view"¶
-
pet
= 'The Pet instance that was observed'¶
-
updated
= 'A set of field names that have changed'¶
-
-
class
cozmo.pets.
Pet
(conn, world, robot, pet_id=None, **kw)¶ A single pet that Cozmo has detected.
See parent class
ObservableElement
for additional properties and methods.-
pet_id
¶ The internal ID assigned to the pet.
This value can only be assigned once as it is static in the engine.
Type: int
-
pet_type
= None¶ The type of Pet (PET_TYPE_CAT, PET_TYPE_DOG or PET_TYPE_UNKNOWN)
-
visibility_timeout
= 0.4¶ Length of time in seconds to go without receiving an observed event before assuming that Cozmo can no longer see a pet.
-