Simulator for Deep Reinforcement Learning and Social Robotics
View Video
·
Report Bug
·
Request Feature
Table of Contents
SimDRLSR is a simulator for social robotics that offers resources for training and validation of reinforcement and deep learning methods.
The first version of the simulator is based on the MDQN algorithm as a reinforcement learning module, available at:
https://github.com/ahq1993/Multimodal-Deep-Q-Network-for-Social-Human-Robot-Interaction
The simDRLSR simulator offers the Pepper robot structure as an agent, which interacts with the environment using four actions:
- Wait: wait, while looking at a random direction of the environment;
- Look: looks at the nearest human, if he is in the robot's field of view;
- Wave: makes the gesture of waving while looking at the nearest human;
- Handshake: performs the handshake gesture to greet the human.
Simulator requirements:
MDQN requirements. It is recommended to install the following packages/frameworks using :
- Ubuntu 16.04 LTS
- LUA 5.2
- Torch7
- CUDA 10.1.
Alternatively, you can use pyMDQN, a Python 3 version of MDQN:
- Python 3.8
- Pytorch (version 1.7.1 is recommended)
- (Optionally) Conda 3
-
Cloning repository
Clone the repo without pyMDQN (MDQN with lua, only):
git clone [email protected]:JPedroRBelo/simDRLSR.git simDRLSR
Alternatively, you can clone the repo with python implementation (pyMDQN) of MDQN (also clone Lua version):
git clone --recursive [email protected]:JPedroRBelo/simDRLSR.git simDRLSR
-
Building simDRLSR:
-
Open the simDRLSR Unity folder with Unity Editor
-
In Editor go to
File>Open Scene>
- Choose "Scenes/Library.unity"
-
Verify if NavMesh is configured:
- Go to
Window>AI>Navigation
- Select "Libray" on Hierarchy
- In
Navigation/Bake
tab, click on "Bake" button
- Go to
-
In Editor go to
File>Build Settings...
:- Scenes in Build, check:
- "Scenes/Libray"
- "Scenes/Empty"
- Platform: PC, Mac & Linux Standalone
- Target Platform: Linux
- Architecture: x86_64
- Click Build button:
- set executable name to simDRLSR.x86_64
- save inside simDRLSR repo folder
- Scenes in Build, check:
The config.xml
file stores the settings for the simulation. The configuration options are:
- Simulation Quality:
- Very Low
- Low
- Medium
- High
- Very High
The default value is "Medium".
- Frames Per Second (FPS): 60
- Screen Width: 1024
- Screen Height: 768
- Fullscreen: True or False (default)
‼️ IP Address: stores the IP of MDQN module. Default is 172.17.0.3. If are running the MDQN on a docker container, you need to set the container's IP.If you are running MDQN on the same system as the simulator, localhost IP 127.0.0.1 will probably solve the problem).⚠️ Port: port that the MDQN module uses for socket communication. Default is 12375.- Path Prob Folder: folder with human avatar probabilities files.
⚠️ Path WorkDir: directory with MDQN files. Default issimDRLSR/simMDQN/
. Change tosimDRLSR/pyMDQN
if you need to use pyMDQN.⚠️ Total Steps: defines the number of interactions that robot performs at each data collection. Note: set a higher value than set in the MDQN.
Labels:
‼️ : fundamental importance, needs to be configured;⚠️ : needs to be configured if the MDQN parameters are modified;
The IP Adress,most likely, will be the only value you should change.
The simulator simDRLSR v0.270 is based on published in the scientific article in [1]. We made minor changes to the original code and made it available in the folder called "simMDQN" (LUA/Torch) or at "PyMDQN" repository (Python,Pytorch; recomended).
The pyMDQN repository can be found at ,
To configure pyMDQN:
- Clone PyMDQN:
cd simDRLSR
git clone [email protected]:JPedroRBelo/pyMDQN.git pyMDQN
cd pyMDQN
git checkout master
⚠️ To use pyMDQN it is not necessary to use a docker container, however, we encourage the use of Conda to install modules, such as pytorch, pip, numpy, etc.- The IP address is seted to localhost IP
127.0.0.1
. You can change this inenvironment.py
pyMDQN script.
To run simMDQN it's necessary set the host IP address:
- Edit
robot_environment.lua
- Change the local variable
host
to the IP address were simDRLSR is running. If you are running in same system, enter the address localhost127.0.0.1
. If you are using a docker container, you need to check the IP of the host SO.
(Optional) If you prefer to use CPU instead of GPU, you need to configure the following files:
- Edit
train_ql.lua
and setlocal gpu = 0
to use CPU, orlocal gpu = 1
to use GPU; - Edit
TrainNQL.lua
and setself.gpu = 0
to use CPU, or 1 to use GPU.
As the configuration of MDQN with lua has some problems we are developing a version in Python 3. This version is a submodule available in this repository available in pyMDQN.
At v0.1 of simDRLS, we treined the simMDQN over 28000 interactions (14 eps., 2000 steps each ep.). To test the simulator with pretreined MDQM, folow this steps:
- To run the simulator, you need to execute:
cd simDRLSR
./simDRLSR.x86_64
- To run simMDQN:
- Open a new terminal, or enter on a docker container
- Execute:
cd simDRLSR/simMDQN
th validate.lua
The simulator is a socket server, and MDQN is a client. Thus, it is necessary to run the simulator first. The robot will execut 2000 steps, trying to interact with human throught the four legal actions wait, look, wave and handshake.
At this point, we validate the simDRLSR only with simMDQN.Therefore, we do not provide a model for pyMDQN.
- Run the simulator, as described above:
cd simDRLSR
./simDRLSR.x86_64
- On a new terminal, or docker container:
-
Erasing old train files and images:
cd simDRLSR/simMDQN rm -rf dataset/RGB/ep* rm -rf dataset/Depth/ep*
-
Initializing files and models:
th makefiles.lua th init_model.lua
-
Run the main script:
th main_train.lua
The main_train.lua
script will call the datageneration_ql.lua
followed by train_ql.lua
over N eps (N = 14 in original configuration).
This is all you need to do to run the simulator together with MDQN!
- Run the simulator, as described above:
cd simDRLSR
./simDRLSR.x86_64
- On a new terminal:
-
Erasing old train files and images:
cd simDRLSR/pyMDQN rm -rf dataset/RGB/ep* rm -rf dataset/Depth/ep*
-
If you are using Conda environment:
conda activate pytorch_env
-
Initializing files and models:
python3 makefiles.py python3 init_model.py
-
Run the main script:
python mdqn.py
Distributed under the MGNU GPL 3.0. See LICENSE
for more information.
[1] Ahmed Hussain Qureshi, Yutaka Nakamura, Yuichiro Yoshikawa and Hiroshi Ishiguro "Robot gains social intelligence through Multimodal Deep Reinforcement Learning" Proceedings of IEEE-RAS International Conference on Humanoid Robots (Humanoids) pp. 745-751, Cancun, Mexico 2016.