Changes between Version 13 and Version 14 of en/ProgrammingRobotsCourse/GettingWwwInfo


Ignore:
Timestamp:
Mar 16, 2020, 3:38:24 PM (4 years ago)
Author:
Ales Horak
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • en/ProgrammingRobotsCourse/GettingWwwInfo

    v13 v14  
    22
    33== How to get info from web?
     4
     5Remember that Python usage in Pepper robots is limited to Python 2 and old version of packages. It is possible to install some (small) Python packages via `pip --user` to `/home/nao` but the space is limited.
     6
     7If you want to test without the real robot, you can run the Python code using the virtual robot - see [#
    48
    59=== Use API
     
    7074}}}
    7175
    72 In dialog, detect variables, pass them to service, and parse call result to say answer:
     76In dialog, detect variables, pass them to service, and parse the call result to say answer:
    7377
    7478{{{
     
    7882    c1:(In _* currently _*) V místnosti $1 je právě $2
    7983}}}
     84
     85Note that in `c1:` we can use `_*` since this regular expression is matched against ''text'' from the service, not against human ''speech''. The text can be in English (or even in non-language), the answer to humans is then specified in the concrete dialog topic, e.g. in Czech. Unfortunately, the [http://doc.aldebaran.com/2-5/naoqi/interaction/dialog/dialog-syntax_full.html#call documentation] is not clear in what can and what cannot be matched by `_*` here, tests are needed with real data.
    8086
    8187{{{u1}}} detects letter and number (concepts defined earlier in dialog) and calls {{{get_current_lesson()}}}. This function return strings, that are parsed in dialog and answer is translated to each locale.
     
    103109}}}
    104110
    105 Dialog detect word with station name and calls {{{say_answer1()}}}. No answer is passed back, answer is said directly in script.
     111Dialog detects word with station name and calls {{{say_answer1()}}}. No answer is passed back, answer is said directly in script.
    106112
    107113{{{#!python