Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

SIC

SIC is a framework for quickly getting started with social robotics by making it simple to combine complex devices such as Nao’s and powerful services such as Google Dialogflow.

Getting started with SIC consists of a few basic steps:

  1. Installing SIC on your device

  2. Installing SIC on your robot

  3. Starting Redis and SIC on your device

  4. Starting SIC on your robot

  5. Start your program to control the robot

Installation

You can find the instructions on how to install the framework here: Install

Setup

Once installed to all devices you want to use, we can start the framework.

This consists of three (or four) steps:

  1. Start redis

  2. Start the device services on the robot

  3. (Optional) Start a service, such as face detection

  4. Run your program

Starting Redis and SIC on your laptop

To enable communication between all your devices, we have to start Redis on some device.

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
# in the `framework` folder:

redis-server conf/redis/redis_v5.conf
Docker alternative

Start it on your laptop in the root framework framework folder (for MacOS and Windows: make sure Docker Desktop is running).

Code Block
languagebash
cd your/path/to/framework
docker compose up redis

This should start print Container sic-redis-1 Created which means Redis is up and running.

Optionally, you can now start other services on your laptop, such as text to speech, either using docker

Code Block
docker compose up text2speech

Or by starting the service in a terminal. For example:

Code Block
cd framework/sic_framework/services/text2speech
python3 text2speech_service.py

Starting SIC on the Robot (NAOv6)

Expand
titleNotes on windows installation

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
languagebash
cd framework/sic_framework/scripts/
sh ./start_nao.sh -h ROBOT_IP 

# Windows:
.\start_nao.ps1 ROBOT_IP REDIS_IP

Where:

  • ROBOT_IP is the adress of the Nao or Pepper robot

  • REDIS_IP the ip adress of your laptop/desktop where redis is running

Example command:

Code Block
languagebash
sh ./start_nao.sh -h 192.168.0.116 
# or sh ./start_pepper.sh -h 192.168.0.116

# Windows
.\start_nao.ps1 192.168.0.116 192.168.0.181

This should show an output like

Code Block
nao@nao:~/framework/sic_framework/devices$ python nao.py 
Starting service manager on ip "192.168.0.151" with services:
 - NaoqiMicrophone
 - TopNaoCamera
 - BottomNaoCamera
Starting service manager on ip "192.168.0.151" with services:
 - NaoMotionReplayAction
 - NaoMotionRecorderAction
 - NaoMotionAction
 - NaoMotionStreamConsumer
 - NaoqiTextToSpeechAction
 - NaoMotionStreamProducer
 - NaoqiTabletService

Or due to a bug with stdout:

Code Block
Starting robot (due to a bug output may or may not be produced until you start your program)
[SICSensorManager-192.168.0.151 192.168.0.151]: INFO: Manager on device 192.168.0.151 starting
[SICComponentManager-192.168.0.151 192.168.0.151]: INFO: Manager on device 192.168.0.151 starting

Expand
titleManually starting the device services

You can also log in to the robot and start the device services in a terminal.

Code Block
ssh nao@ROBOT_IP

cd framework/sic_framework/devices

export DB_IP=REDIS_IP # replace with the ip of your computer

python nao.py

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.

Terminal

To start the camera demo from the terminal, use the following commands.

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 framework/sic_framework/tests
python demo_nao_camera.py 

If all went This guide assumes you already followed the steps here Getting started.

For example, to show the camera feed of the robot:

In the demo_nao_camera.py make sure to adjust the ip adress to the ip adress of your robot. If you press the chest button of the robot it will tell you it’s ip adress. Ensure you are on the same network as the robot, and then you are good to go!

To start the camera demo from the terminal, use the following commands.Note: it might take some time to start the demo file if the SIC has never been installed on the robot.

Ubuntu / Debian / macOS
Code Block
# Activate the same virtual environment where you pip installed 
# social-interaction-cloud in the installation steps
source venv_sic/bin/activate

# Go to sic_applications and the demo script
cd sic_applications/demos
python demo_nao_camera.py
Windows
Code Block
# Activate the same virtual environment where you pip installed 
# social-interaction-cloud in the installation steps
.\.venv_sic\Scripts\activate

# Go to sic_applications and the demo script
cd sic_applications\demos
python demo_nao_camera.py

And, you should get the following output:

Code Block
Starting SIC on /data/home/nao/.venv_sic/lib/python2.7/site-packages/sic_framework/devices/nao with redis ip 192.168.2.6
[SICComponentManager 192.168.2.7]: INFO:  - NaoqiSpeakerComponent
[SICComponentManager 192.168.2.7]: INFO:  - NaoqiButtonSensor
[SICComponentManager 192.168.2.7]: INFO:  - NaoqiAutonomousActuator
[SICComponentManager 192.168.2.7]: INFO:  - NaoqiMicrophoneSensor
[SICComponentManager 192.168.2.7]: INFO:  - NaoqiMotionActuator
[SICComponentManager 192.168.2.7]: INFO:  - NaoqiBottomCameraSensor
[SICComponentManager 192.168.2.7]: INFO:  - NaoqiStiffnessActuator
[SICComponentManager 192.168.2.7]: INFO:  - NaoqiMotionRecorderActuator
[SICComponentManager 192.168.2.7]: INFO:  - NaoqiTextToSpeechActuator
[SICComponentManager 192.168.2.7]: INFO:  - NaoqiTrackerActuator
[SICComponentManager 192.168.2.7]: INFO:  - NaoqiTopCameraSensor
[SICComponentManager 192.168.2.7]: INFO:  - NaoqiLookAtComponent

If all goes well, a display should pop up showing you the camera output of your robot!

API

The goal of SIC is to provide easy to use high level access to devices and services. To For example, 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.! To see more functionality check out the sic_applications /demos folder!

Code Block
languagepy
from sic_framework.devices import Nao
from sic_framework.devices.common_naoqi.naoqi_speakerstext_to_speech import NaoqiTextToSpeech, NaoqiTextToSpeechRequest

nao_tts = NaoqiTextToSpeechNao(ip='192.168.0.236151') nao_# adjust this to the IP adress of your robot.

nao.tts.request(NaoqiTextToSpeechRequest("Hello!"))