Skip to content

Commit 410ba9e

Browse files
committed
VIC-9836 Improve carrying_object_id sample code so it returns non-default value #175
1 parent 029dc6e commit 410ba9e

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

anki_vector/robot.py

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -490,8 +490,19 @@ def carrying_object_id(self) -> int:
490490
.. testcode::
491491
492492
import anki_vector
493+
from anki_vector.util import degrees
494+
495+
# Set the robot so that he can see a cube.
493496
with anki_vector.Robot() as robot:
494-
current_carrying_object_id = robot.carrying_object_id
497+
robot.behavior.set_head_angle(degrees(0.0))
498+
robot.behavior.set_lift_height(0.0)
499+
500+
robot.world.connect_cube()
501+
502+
if robot.world.connected_light_cube:
503+
robot.behavior.pickup_object(robot.world.connected_light_cube)
504+
505+
print("carrying_object_id: ", robot.carrying_object_id)
495506
"""
496507
return self._carrying_object_id
497508

0 commit comments

Comments
 (0)