File tree Expand file tree Collapse file tree 2 files changed +17
-2
lines changed Expand file tree Collapse file tree 2 files changed +17
-2
lines changed Original file line number Diff line number Diff line change @@ -51,6 +51,7 @@ class Events(Enum):
51
51
robot_observed_motion = "robot_observed_motion" #: Robot event dispatched when Vector observes motion.
52
52
robot_observed_face = "robot_observed_face" #: Robot event for when a face is observed by the robot.
53
53
robot_changed_observed_face_id = "robot_changed_observed_face_id" #: Robot event for when a known face changes its id.
54
+ robot_erased_enrolled_face = "robot_erased_enrolled_face" #: Robot event for when an enrolled face has been removed from the robot.
54
55
55
56
wake_word = "wake_word" #: Robot event triggered when Vector hears "Hey Vector".
56
57
user_intent = "user_intent" #: Robot event triggered after Vector processes voice commands.
Original file line number Diff line number Diff line change @@ -571,7 +571,7 @@ class FaceComponent(util.Component):
571
571
"""Manage the state of the faces on the robot."""
572
572
573
573
@connection .on_connection_thread (requires_control = False )
574
- async def request_enrolled_names (self ) -> protocol .RequestEnrolledNamesRequest :
574
+ async def request_enrolled_names (self ) -> protocol .RequestEnrolledNamesResponse :
575
575
"""Asks the robot for the list of names attached to faces that it can identify.
576
576
577
577
.. testcode::
@@ -612,10 +612,24 @@ async def erase_enrolled_face_by_id(self, face_id: int):
612
612
613
613
.. testcode::
614
614
615
+ import time
615
616
import anki_vector
617
+ from anki_vector.events import Events
618
+
619
+ def on_robot_erased_enrolled_face(robot, event_type, event):
620
+ print(f"Face has been erased from robot. Event: {event_type} = {event}")
616
621
617
622
with anki_vector.Robot() as robot:
618
- robot.faces.erase_enrolled_face_by_id(1)
623
+ robot.events.subscribe(on_robot_erased_enrolled_face, Events.robot_erased_enrolled_face)
624
+
625
+ name_data_list = robot.faces.request_enrolled_names()
626
+ print(f"Enrolled names: {name_data_list}")
627
+
628
+ # Deletes all enrolled faces from Vector. Use with care!
629
+ for face in name_data_list.faces:
630
+ robot.faces.erase_enrolled_face_by_id(face.face_id)
631
+
632
+ time.sleep(3)
619
633
"""
620
634
req = protocol .EraseEnrolledFaceByIDRequest (face_id = face_id )
621
635
return await self .grpc_interface .EraseEnrolledFaceByID (req )
You can’t perform that action at this time.
0 commit comments