Version 9 (modified by 4 years ago) (diff) | ,
---|
Testing a service with virtual robot
A service can be tested in the virtual robot settings.
- prepare an app with the service to test - you may start with the examples below or use the templater tool robot-jumpstarter (use a new name for your service):
ssh aurora cd /nlp/projekty/pepper/web/robot-jumpstarter python jumpstart.py python-service tweety-service TweetyService cp -a output/tweety-service ~/pepper/
Heretweety-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.
- 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. - start Choregraphe and run the virtual robot
- find out the port number of your virtual robot: click
and remember theIP
andport
from the table:
Here the virtual robot's address islocalhost:34121
- run your service in the virtual robot (Choregraphe must still be running, of course):
cd ~/pepper/tweety-service/app python scripts/tweetyservice.py --qi-url localhost:34121
The output should look like:[I] 1584373059.579170 4749 qimessaging.session: Session listener created on tcp://0.0.0.0:0 [I] 1584373059.579385 4749 qimessaging.transportserver: TransportServer will listen on: tcp://192.168.1.2:36873 [I] 1584373059.579394 4749 qimessaging.transportserver: TransportServer will listen on: tcp://127.0.0.1:36873
- now you can communicate with your running service in the same way as with all other API services on the real robot:
- use
^call(TweetyService.get())
in a dialog - direct call in a Python Box code:
def __init__(self): self.tweety = ALProxy('TweetyService') def onInput_onStart(self): self.tts.say("číslo {}".format(self.tweety.get())) self.onStopped() #activate the output of the box
- use the qicli command line tool:
alias qicli='"/opt/Softbank Robotics/Choregraphe Suite 2.5/bin/qicli" --qi-url localhost:34121' qicli info TweetyService call TweetyService.get call TweetyService.set 2 call TweetyService.get
with the output099 [TweetyService] * Info: machine f883b92e-3a87-44e5-aa70-4a3b78f4d937 process 4749 endpoints tcp://192.168.1.2:36873 tcp://127.0.0.1:36873 * Methods: 100 get Int8 () 101 reset Void () 102 set Void (Int8) 103 stop Void () ------------------------------------------------------- 0 null 2
- use
Attachments (2)
- pepper_connect.png (19.1 KB) - added by 4 years ago.
- pepper_virtual_port.png (14.4 KB) - added by 4 years ago.
Download all attachments as: .zip