...
Once installed to all devices you want to use, we can start the framework.
This consists of three (or four) steps:
Start redis
Start the device services on the robot
(Optional) Start a service, such as face detection
Run your program
Starting Redis and SIC on your laptop
...
This can be done in two ways: By starting redis yourself or using docker. We recommend using docker as this makes starting other services easier later on.
In a terminal, start redis using
Code Block |
---|
redis-server |
Docker alternative
Start it on your laptop in the root framework sic
framework
folder (for MacOS and Windows: make sure Docker Desktop is running).
Code Block | ||
---|---|---|
| ||
cd your/path/to/sicframework docker compose up redis |
This should start print Container sic-redis-1 Created
which means Redis is up and running.
No Docker
In a terminal, start redis using
...
Optionally, you can now start other services on your laptop, such as text to speech, either using docker
...
Or by starting the service in a terminal. Note that when starting a service or running a file, the appropriate environment variables must be set. TODO: Windows env variables? For example:
Code Block |
---|
cd sicframework/sic_framework/services/text2speech export DB_PASS=changemeplease export DB_IP=localhost python3 text2speech_service.py |
Starting SIC on the Robot (NAOv6)
Expand | ||
---|---|---|
| ||
This script sets environment variables and start the framework on the robot. However, running scripts on windows is not very simple. If you cannot execute the scripts by calling them from a powershell terminal, open them using a text editor and copy the commands into the terminal manually. Remember to adjust variables such as IP addresses |
In a new terminal, start the framework on the robot using
Code Block | ||
---|---|---|
| ||
cd sicframework/sic_framework/scripts/ sh ./start_robotnao.sh -h ROBOT_IP -n ROBOT_DEVICE_ID -b REDIS_IP # Windows: .\start_robotnao.ps1 ROBOT_IP ROBOT_DEVICE_ID REDIS_IP |
Where:
ROBOT_IP
is the adress of the Nao or Pepper robotROBOT_DEVICE_ID
can be any name as it is thedevice_id
with which the robot will identify itself in the framework.REDIS_IP
Your laptop IP address (useipconfig
on windows orhostname -I
on linux oripconfig getifaddr en0
on mac) the ip adress of your laptop/desktop where redis is running
Example command:
Code Block | ||
---|---|---|
| ||
sh ./start_robotnao.sh -h 192.168.0.116 -n nao1 -b 192.168.0.181 # Windows .\start_robotnao.ps1 192.168.0.116 nao1 192.168.0.181 |
This should show an output like
Code Block |
---|
nao@nao:~/sicframework/sic_framework/devices$ python nao.py --robot_name nao1 Starting service manager with device id "nao1" with services: - NaoqiMicrophone - TopNaoCamera - BottomNaoCamera Starting service manager with device id "nao1" with services: - NaoMotionReplayAction - NaoMotionRecorderAction - NaoMotionAction - NaoMotionStreamConsumer - NaoqiTextToSpeechAction - NaoMotionStreamProducer - NaoqiTabletService |
Expand | ||
---|---|---|
| ||
You can also log in to the robot and start the device services in a terminal.
|
Running a demo
To start a demo, for example to show pepper’s camera output on your screen, simply execute a python script with a SICApplication. Some demos are available in the docker/sic/sic_framework/tests
folder.
...
Note: This demo requires you to have the OpenCV and tqdm modules and libjpeg-turbo installed, as well as have the framework installed on a NAO robot (see above). On Windows, moreover, the libjpeg dependency may not be automatically be found, and you may need to set the path to libturbojpeg.dll
manually.
Code Block |
---|
cd dockerframework/sic/sic_framework/tests export DB_IP=localhost # set on Windows export DB_PASS=changemeplease # set on Windows python3 python demo_camera.py # on Windows simply use python |
Pycharm
The environment variables (the export
command in the code above) need to be set. If you are using PyCharm to run the script, set these in the Run/Debug configuration
in the Environment variables
menu. Copy these two lines into the menu:
Code Block |
---|
DB_IP=localhost DB_PASS=changemeplease |
If all went well, a display should pop up showing you the camera output of your robot!
...
The goal of SIC is to provide easy to use high level access to devices and services. To make a NAO robot say something, follow the startup instruction in https://socialrobotics.atlassian.net/wiki/spaces/CBSR/pages/2180415493/Install#Starting-SIC-on-the-Robot and run the following python script on your laptop.ENV VARIABLES
Code Block | ||
---|---|---|
| ||
from sic_framework import SICApplication from sic_framework.devices.common_naoqi.naoqi_speakers import NaoqiTextToSpeechAction, NaoqiTextToSpeechRequest class DemoTextToSpeech(SICApplication): def run(self): nao3_action = self.connect(NaoqiTextToSpeechAction, device_id='nao1') nao3_action.request(NaoqiTextToSpeechRequest("Hello world!")) if __name__ == '__main__': test_app = DemoTextToSpeech() test_app.run() |
...