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 | {{{ |
| 21 | cd ~/pepper/tweety-service/app |
| 22 | python 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 |
| 34 | def __init__(self): |
| 35 | self.tweety = ALProxy('TweetyService') |
| 36 | |
| 37 | def 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 | {{{ |
| 43 | alias qicli='"/opt/Softbank Robotics/Choregraphe Suite 2.5/bin/qicli" --qi-url localhost:34121' |
| 44 | qicli info TweetyService |
| 45 | call TweetyService.get |
| 46 | call TweetyService.set 2 |
| 47 | call TweetyService.get |
| 48 | }}} |
| 49 | with the output |
| 50 | {{{ |
| 51 | 099 [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 | ------------------------------------------------------- |
| 63 | 0 |
| 64 | null |
| 65 | 2 |
| 66 | }}} |