Skip to content

Commit 7b265ba

Browse files
committed
VIC-14350 Reorder tutorials and cleanup (#188)
* Reorder tutorials to be in the order of beginner-to-advance progression and in order of interest, IMO * Fix VIC-14499 * Make annotations tutorial more user friendly. Remove unnecessary import module comments since these modules are in requirements.txt * Modify comment in 09_control_priority_level * Float the sounds folder up higher to be more discoverable. We have a precedent with a similar folder: face_images * Correct annotation.py comment * Add internal README notes * lint fix
1 parent a3bd5b6 commit 7b265ba

15 files changed

+24
-33
lines changed

anki_vector/annotate.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,9 @@
1717
.. image:: ../images/annotate.png
1818
1919
This module defines an :class:`ImageAnnotator` class used by
20-
:class:`anki_vector.world.World` to add annotations to camera images received by the robot.
20+
:class:`anki_vector.camera.CameraImage` and
21+
:class:`anki_vector.camera.CameraComponent` to add annotations
22+
to camera images received by the robot.
2123
2224
This can include the location of cubes and faces that the robot currently sees,
2325
along with user-defined custom annotations.

anki_vector/audio.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ class AudioComponent(util.Component):
6666
import anki_vector
6767
6868
with anki_vector.Robot() as robot:
69-
robot.audio.stream_wav_file('../examples/tutorials/sounds/vector_alert.wav')
69+
robot.audio.stream_wav_file('../examples/sounds/vector_alert.wav')
7070
"""
7171

7272
# TODO restore audio feed code when ready
@@ -167,7 +167,7 @@ async def stream_wav_file(self, filename, volume=50):
167167
import anki_vector
168168
169169
with anki_vector.Robot() as robot:
170-
robot.audio.stream_wav_file('../examples/tutorials/sounds/vector_alert.wav')
170+
robot.audio.stream_wav_file('../examples/sounds/vector_alert.wav')
171171
172172
:param filename: the filename/path to the .wav audio file
173173
:param volume: the audio playback level (0-100)

anki_vector/util.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1123,7 +1123,7 @@ def read_configuration(serial: str, name: str, logger: logging.Logger) -> dict:
11231123
for key in config[keySerial]:
11241124
if config[keySerial][key] == name:
11251125
return config[keySerial]
1126-
elif config[keySerial][key].lower() == name.lower():
1126+
if config[keySerial][key].lower() == name.lower():
11271127
logger.warning("Using case-insensitive name match found in config. Set 'name' field to match 'Vector-A1B2' format.")
11281128
return config[keySerial]
11291129

examples/tutorials/12_play_audio.py renamed to examples/tutorials/10_play_audio.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@
2323
def main():
2424
args = anki_vector.util.parse_command_args()
2525
with anki_vector.Robot(args.serial) as robot:
26-
robot.audio.stream_wav_file("sounds/vector_bell_whistle.wav", 75)
27-
robot.audio.stream_wav_file("sounds/vector_alert.wav", 75)
26+
robot.audio.stream_wav_file("../sounds/vector_bell_whistle.wav", 75)
27+
robot.audio.stream_wav_file("../sounds/vector_alert.wav", 75)
2828

2929

3030
if __name__ == "__main__":

examples/tutorials/09_control_priority_level.py renamed to examples/tutorials/12_control_priority_level.py

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -14,27 +14,27 @@
1414
# See the License for the specific language governing permissions and
1515
# limitations under the License.
1616

17-
"""Use behavior control at the highest priority level
17+
"""Vector maintains SDK behavior control after being picked up
1818
19-
This script demonstrates how to request behavior control at the highest level. This allows Vector
20-
to perform actions under system conditions that normally take priority over the SDK, such as being
21-
at a cliff, stuck on an edge or obstacle, low battery, tilted or inclined, picked up, in
22-
darkness, etc.
19+
During normal operation, SDK programs cannot maintain control over Vector
20+
when he is at a cliff, stuck on an edge or obstacle, tilted or inclined,
21+
picked up, in darkness, etc.
2322
24-
After requesting control, Vector will wait until it detects being picked up. At
25-
this point the wheel motors will briefly activate. These commands will not succeed at
26-
CONTROL_PRIORITY_LEVEL.DEFAULT.
23+
This script demonstrates how to use the highest level SDK behavior control
24+
ControlPriorityLevel.OVERRIDE_BEHAVIORS_PRIORITY to make Vector perform
25+
actions that normally take priority over the SDK. These commands will not
26+
succeed at ControlPriorityLevel.DEFAULT.
2727
"""
2828

2929
import sys
3030
import time
3131
import anki_vector
32-
from anki_vector.connection import CONTROL_PRIORITY_LEVEL as control_level
32+
from anki_vector.connection import ControlPriorityLevel
3333

3434

3535
def main():
3636
args = anki_vector.util.parse_command_args()
37-
with anki_vector.Robot(args.serial, behavior_control_level=control_level.OVERRIDE_BEHAVIORS_PRIORITY) as robot:
37+
with anki_vector.Robot(args.serial, behavior_control_level=ControlPriorityLevel.OVERRIDE_BEHAVIORS_PRIORITY) as robot:
3838
robot.behavior.say_text("Pick me up!")
3939
pickup_countdown = 20
4040

0 commit comments

Comments
 (0)