Skip to content

Commit 922fbba

Browse files
author
Michelle Sintov
committed
Doc updates (#81)
1 parent 6001b30 commit 922fbba

7 files changed

Lines changed: 34 additions & 7 deletions

File tree

anki_vector/behavior.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -202,6 +202,15 @@ async def say_text(self, text: str, use_vector_voice: bool = True, duration_scal
202202
async def set_eye_color(self, hue: float, saturation: float) -> protocol.SetEyeColorResponse:
203203
"""Set Vector's eye color.
204204
205+
Eye color settings examples:
206+
| Teal: Set hue to 0.42 and saturation to 1.00.
207+
| Orange: Set hue to 0.05 and saturation to 0.95.
208+
| Yellow: Set hue to 0.11 and saturation to 1.00.
209+
| Lime: Set hue to 0.21 and saturation to 1.00.
210+
| Sapphire: Set hue to 0.57 and saturation to 1.00.
211+
| Purple: Set hue to 0.83 and saturation to 0.76.
212+
| Green: Set hue to 0.30 and saturation to 1.00.
213+
205214
.. testcode::
206215
207216
import anki_vector

anki_vector/connection.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -376,10 +376,10 @@ async def _request_control(self, timeout: float = 10.0):
376376
raise VectorControlTimeoutException(f"Surpassed timeout of {timeout}s") from e
377377

378378
def release_control(self, timeout: float = 10.0):
379-
"""Explicitly request control. Typically used after detecting :func:`control_lost_event`.
379+
"""Explicitly release control. Typically used after detecting :func:`control_lost_event`.
380380
381381
To be able to directly control Vector's motors, override his screen, play an animation, etc.,
382-
the :class:`Connection` will need behavior control. This function will acquire control
382+
the :class:`Connection` will need behavior control. This function will release control
383383
of Vector's behavior system. This will raise a :class:`VectorControlTimeoutException` if it fails
384384
to receive a control_lost event before the timeout.
385385

anki_vector/nav_map.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -371,7 +371,7 @@ def latest_nav_map(self) -> NavMapGrid:
371371
latest_nav_map = robot.nav_map.latest_nav_map
372372
"""
373373
if not self._nav_map_feed_task or self._nav_map_feed_task.done():
374-
raise Exception("Nav map not initialized")
374+
raise Exception("Nav map not initialized. Check that Robot parameter enable_nav_map_feed is set to True.")
375375
return self._latest_nav_map
376376

377377
def init_nav_map_feed(self, frequency: float = 0.5) -> None:

anki_vector/robot.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -812,6 +812,9 @@ async def get_version_state(self) -> protocol.VersionStateResponse:
812812
import anki_vector
813813
with anki_vector.Robot() as robot:
814814
version_state = robot.get_version_state()
815+
if version_state:
816+
print("Robot os_version: {0}".format(version_state.os_version))
817+
print("Robot engine_build_id: {0}".format(version_state.engine_build_id))
815818
"""
816819
get_version_state_request = protocol.VersionStateRequest()
817820
return await self.conn.grpc_interface.VersionState(get_version_state_request)

anki_vector/screen.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,10 @@ async def set_screen_with_image_data(self, image_data: bytes, duration_sec: floa
155155
156156
# Convert the image to the format used by the Screen
157157
screen_data = anki_vector.screen.convert_image_to_screen_data(image_file)
158-
robot.screen.set_screen_with_image_data(screen_data, 4.0)
158+
159+
duration_s = 4.0
160+
robot.screen.set_screen_with_image_data(screen_data, duration_s)
161+
time.sleep(duration_s)
159162
160163
:param image_data: A :class:`bytes` object representing all of the pixels (16bit color in rgb565 format)
161164
:param duration_sec: The number of seconds the image should remain on Vector's face.
@@ -184,7 +187,9 @@ def set_screen_to_color(self, solid_color: color.Color, duration_sec: float, int
184187
import anki_vector
185188
186189
with anki_vector.Robot() as robot:
187-
robot.screen.set_screen_to_color(anki_vector.color.Color(rgb=[255, 128, 0]), duration_sec=1.0)
190+
duration_s = 4.0
191+
robot.screen.set_screen_to_color(anki_vector.color.Color(rgb=[255, 128, 0]), duration_sec=duration_s)
192+
time.sleep(duration_s)
188193
189194
:param solid_color: Desired color to set Vector's Screen.
190195
:param duration_sec: The number of seconds the color should remain on Vector's face.

anki_vector/status.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,11 @@ def is_docking_to_marker(self) -> bool:
116116
def is_picked_up(self) -> bool:
117117
"""True if Vector is currently picked up (in the air).
118118
119+
If :py:attr:`is_being_held` is true, then :py:attr:`is_picked_up` is always True.
120+
121+
:py:attr:`is_picked_up` uses the IMU data to determine if the robot is not on a stable surface with his treads down.
122+
If the robot is on its side, :py:attr:`is_picked_up` is True.
123+
119124
.. testcode::
120125
121126
import anki_vector
@@ -287,6 +292,9 @@ def are_wheels_moving(self) -> bool:
287292
def is_being_held(self) -> bool:
288293
"""True if Vector is being held.
289294
295+
:py:attr:`is_being_held` uses the IMU to look for tiny motions
296+
that suggest the robot is actively being held in someone's hand.
297+
290298
.. testcode::
291299
292300
import anki_vector

examples/tutorials/06_face_image.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,10 @@ def main():
4747
# Convert the image to the format used by the Screen
4848
print("Display image on Vector's face...")
4949
screen_data = anki_vector.screen.convert_image_to_screen_data(image_file)
50-
robot.screen.set_screen_with_image_data(screen_data, 4.0)
51-
time.sleep(5)
50+
51+
duration_s = 4.0
52+
robot.screen.set_screen_with_image_data(screen_data, duration_s)
53+
time.sleep(duration_s)
5254

5355

5456
if __name__ == "__main__":

0 commit comments

Comments
 (0)