5 | | * prepare an app with the service to test - you may start with the examples below or use the ''templater'' tool [https://github.com/pepperhacking/robot-jumpstarter#template-python-service robot-jumpstarter] (use a ''new name'' for your service): |
6 | | {{{ |
7 | | ssh aurora |
8 | | cd /nlp/projekty/pepper/web/robot-jumpstarter |
9 | | python jumpstart.py python-service tweety-service TweetyService |
10 | | cp -a output/tweety-service ~/pepper/ |
11 | | }}} |
12 | | 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]] |
13 | | * 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] |
15 | | * find out the ''port number'' of your virtual robot: click |
16 | | Here the virtual robot's address is `localhost:34121` |
17 | | * run your service in the virtual robot (Choregraphe must still be running, of course): |
18 | | {{{ |
19 | | cd ~/pepper/tweety-service/app |
20 | | python scripts/tweetyservice.py --qi-url localhost:34121 |
21 | | }}} |
22 | | The output should look like: |
23 | | {{{ |
24 | | [I] 1584373059.579170 4749 qimessaging.session: Session listener created on tcp://0.0.0.0:0 |
25 | | [I] 1584373059.579385 4749 qimessaging.transportserver: TransportServer will listen on: tcp://192.168.1.2:36873 |
26 | | [I] 1584373059.579394 4749 qimessaging.transportserver: TransportServer will listen on: tcp://127.0.0.1:36873 |
27 | | }}} |
28 | | * now you can ''communicate'' with your running service in the same way as with all other API services on the real robot: |
29 | | * use `^call(TweetyService.get())` in a dialog |
30 | | * direct call in a Python Box code: |
31 | | {{{#!python |
32 | | def __init__(self): |
33 | | self.tweety = ALProxy('TweetyService') |
34 | | |
35 | | def onInput_onStart(self): |
36 | | self.tts.say("číslo {}".format(self.tweety.get())) |
37 | | self.onStopped() #activate the output of the box |
38 | | }}} |
39 | | * use the [http://doc.aldebaran.com/2-5/dev/libqi/guide/qicli.html qicli] command line tool: |
40 | | {{{ |
41 | | alias qicli='"/opt/Softbank Robotics/Choregraphe Suite 2.5/bin/qicli" --qi-url localhost:34121' |
42 | | qicli info TweetyService |
43 | | call TweetyService.get |
44 | | call TweetyService.set 2 |
45 | | call TweetyService.get |
46 | | }}} |
47 | | with the output |
48 | | {{{ |
49 | | 099 [TweetyService] |
50 | | * Info: |
51 | | machine f883b92e-3a87-44e5-aa70-4a3b78f4d937 |
52 | | process 4749 |
53 | | endpoints tcp://192.168.1.2:36873 |
54 | | tcp://127.0.0.1:36873 |
55 | | * Methods: |
56 | | 100 get Int8 () |
57 | | 101 reset Void () |
58 | | 102 set Void (Int8) |
59 | | 103 stop Void () |
60 | | ------------------------------------------------------- |
61 | | 0 |
62 | | null |
63 | | 2 |
64 | | }}} |