Changes between Version 15 and Version 16 of en/ProgrammingRobotsCourse/GettingWwwInfo2


Ignore:
Timestamp:
Mar 16, 2020, 6:59:58 PM (4 years ago)
Author:
Ales Horak
Comment:

Reverted to version 9.

Legend:

Unmodified
Added
Removed
Modified
  • en/ProgrammingRobotsCourse/GettingWwwInfo2

    v15 v16  
    1212  Here `tweety-service` is the directory name of the application (and the app name), `TweetyService` is the API name of your service as it will be called from Python.[[br]]
    1313* copy the directory with the service app (e.g. `~/pepper/tweety-service`) to your computer, where you run Choregraphe. All the following steps are done on this computer, ''not remotely'' via SSH.
    14 * start Choregraphe and [../Introduction#virtualrobot run the virtual robot]
     14* start Choregraphe and [wiki:../Introduction#virtualrobot run the virtual robot]
     15* find out the ''port number'' of your virtual robot: click [[Image(pepper_connect.png, valign=top)]] [[br]]
     16  and remember the `IP` and `port` from the table:[[br]]
     17  [[Image(pepper_virtual_port.png)]][[br]]
     18  Here the virtual robot's address is `localhost:34121`
     19* run your service in the virtual robot (Choregraphe must still be running, of course):
     20  {{{
     21cd ~/pepper/tweety-service/app
     22python scripts/tweetyservice.py --qi-url localhost:34121
     23}}}
     24  The output should look like:
     25  {{{
     26[I] 1584373059.579170 4749 qimessaging.session: Session listener created on tcp://0.0.0.0:0
     27[I] 1584373059.579385 4749 qimessaging.transportserver: TransportServer will listen on: tcp://192.168.1.2:36873
     28[I] 1584373059.579394 4749 qimessaging.transportserver: TransportServer will listen on: tcp://127.0.0.1:36873
     29}}}
     30* now you can ''communicate'' with your running service in the same way as with all other API services on the real robot:
     31  * use `^call(TweetyService.get())` in a dialog
     32  * direct call in a Python Box code:
     33    {{{#!python
     34def __init__(self):
     35   self.tweety = ALProxy('TweetyService')
     36
     37def onInput_onStart(self):
     38    self.tts.say("číslo {}".format(self.tweety.get()))
     39    self.onStopped() #activate the output of the box
     40}}}
     41  * use the [http://doc.aldebaran.com/2-5/dev/libqi/guide/qicli.html qicli] command line tool:
     42    {{{
     43alias qicli='"/opt/Softbank Robotics/Choregraphe Suite 2.5/bin/qicli" --qi-url localhost:34121'
     44qicli info TweetyService
     45call TweetyService.get
     46call TweetyService.set 2
     47call TweetyService.get
     48}}}
     49    with the output
     50    {{{
     51099 [TweetyService]
     52  * Info:
     53   machine   f883b92e-3a87-44e5-aa70-4a3b78f4d937
     54   process   4749
     55   endpoints tcp://192.168.1.2:36873
     56             tcp://127.0.0.1:36873
     57  * Methods:
     58   100 get   Int8 ()
     59   101 reset Void ()
     60   102 set   Void (Int8)
     61   103 stop  Void ()
     62-------------------------------------------------------
     630
     64null
     652
     66}}}