Skip to content

Commit

Permalink
modify setup and requirements and add pylintrc support [currently fai…
Browse files Browse the repository at this point in the history
…ling]
  • Loading branch information
svenkreiss committed Sep 27, 2018
1 parent 6e1a200 commit 0633366
Show file tree
Hide file tree
Showing 10 changed files with 75 additions and 50 deletions.
9 changes: 8 additions & 1 deletion .gitignore
@@ -1,7 +1,14 @@
# editors
.idea/
.vscode/

# Python
*.egg-info/
.pytest_cache/
__pycache__
data/
.cache/
venv*/

# data
data/
*.mp4
14 changes: 14 additions & 0 deletions .pylintrc
@@ -0,0 +1,14 @@
[BASIC]

#variable-rgx=[a-z0-9_]{1,30}$
good-names=dx,dy,i,j,k,px,py,r,th,vx,vy,x,y,z

[TYPECHECK]

# List of members which are set dynamically and missed by pylint inference
# system, and so shouldn't trigger E1101 when accessed. Python regular
# expressions are accepted.
generated-members=numpy.*,torch.*


disable=missing-docstring,useless-object-inheritance
33 changes: 14 additions & 19 deletions README.md
@@ -1,6 +1,6 @@
# CrowdNav
This repository contains the codes for our ICRA 2018 submission. For more details, please refer to the paper
[Crowd-Robot Interaction: Crowd-aware Robot Navigation with Attention-based Deep Reinforcement Learning](https://arxiv.org/abs/1809.08835).
[Crowd-Robot Interaction: Crowd-aware Robot Navigation with Attention-based Deep Reinforcement Learning](https://arxiv.org/abs/1809.08835).

If you find the codes or paper useful for your research, please cite our paper:
```
Expand All @@ -13,15 +13,15 @@ Eprint = {arXiv:1809.08835},
```

## Abstract
Mobility in an effective and socially-compliant manner is an essential yet challenging task for robots operating in crowded spaces.
Recent works have shown the power of deep reinforcement learning techniques to learn socially cooperative policies.
However, their cooperation ability deteriorates as the crowd grows since they typically relax the problem as a one-way Human-Robot interaction problem.
In this work, we want to go beyond first-order Human-Robot interaction and more explicitly model Crowd-Robot Interaction (CRI).
We propose to (i) rethink pairwise interactions with a self-attention mechanism, and
(ii) jointly model Human-Robot as well as Human-Human interactions in the deep reinforcement learning framework.
Our model captures the Human-Human interactions occurring in dense crowds that indirectly affects the robot's anticipation capability.
Our proposed attentive pooling mechanism learns the collective importance of neighboring humans with respect to their future states.
Various experiments demonstrate that our model can anticipate human dynamics and navigate in crowds with time efficiency,
Mobility in an effective and socially-compliant manner is an essential yet challenging task for robots operating in crowded spaces.
Recent works have shown the power of deep reinforcement learning techniques to learn socially cooperative policies.
However, their cooperation ability deteriorates as the crowd grows since they typically relax the problem as a one-way Human-Robot interaction problem.
In this work, we want to go beyond first-order Human-Robot interaction and more explicitly model Crowd-Robot Interaction (CRI).
We propose to (i) rethink pairwise interactions with a self-attention mechanism, and
(ii) jointly model Human-Robot as well as Human-Human interactions in the deep reinforcement learning framework.
Our model captures the Human-Human interactions occurring in dense crowds that indirectly affects the robot's anticipation capability.
Our proposed attentive pooling mechanism learns the collective importance of neighboring humans with respect to their future states.
Various experiments demonstrate that our model can anticipate human dynamics and navigate in crowds with time efficiency,
outperforming state-of-the-art methods.


Expand All @@ -34,22 +34,17 @@ outperforming state-of-the-art methods.
```
pip install -e .
```
3. Install all the dependencies listed in requirements.txt
```
pip install -r requirements.txt
```


## Getting started
This repository are organized in two parts: gym_crowd/ folder contains the simulation environment and
crowd_nav/ folder contains codes for training and testing the policies. Details of the simulation framework can be found
[here](crowd_sim/README.md). Below are the instructions for training and testing policies, and they should be executed
crowd_nav/ folder contains codes for training and testing the policies. Details of the simulation framework can be found
[here](crowd_sim/README.md). Below are the instructions for training and testing policies, and they should be executed
inside the crowd_nav/ folder.


1. Train a policy.
```
python train.py --policy sarl
python -m crowd_nav.train --policy sarl
```
2. Test policies with 500 test cases.
```
Expand All @@ -67,7 +62,7 @@ python utils/plot.py data/output/output.log
```

## Simulation Videos
CADRL | LSTM-RL
CADRL | LSTM-RL
:-------------------------:|:-------------------------:
<img src="https://i.imgur.com/vrWsxPM.gif" width="400" />|<img src="https://i.imgur.com/6gjT0nG.gif" width="400" />
SARL | OM-SARL
Expand Down
4 changes: 0 additions & 4 deletions crowd_nav/.gitignore

This file was deleted.

2 changes: 1 addition & 1 deletion crowd_nav/test.py
Expand Up @@ -5,9 +5,9 @@
import numpy as np
import gym
import os
from crowd_sim.envs.utils.robot import Robot
from crowd_nav.utils.explorer import Explorer
from crowd_nav.policy.policy_factory import policy_factory
from crowd_sim.envs.utils.robot import Robot
from crowd_sim.envs.policy.orca import ORCA


Expand Down
2 changes: 1 addition & 1 deletion crowd_sim/__init__.py
Expand Up @@ -3,4 +3,4 @@
register(
id='CrowdSim-v0',
entry_point='crowd_sim.envs:CrowdSim',
)
)
2 changes: 1 addition & 1 deletion crowd_sim/envs/__init__.py
@@ -1 +1 @@
from crowd_sim.envs.crowd_sim import CrowdSim
from .crowd_sim import CrowdSim
16 changes: 8 additions & 8 deletions crowd_sim/envs/crowd_sim.py
Expand Up @@ -306,11 +306,11 @@ def reset(self, phase='test', test_case=None):

# get current observation
if self.robot.sensor == 'coordinates':
ob = [human.get_observable_state() for human in self.humans]
obs = [human.get_observable_state() for human in self.humans]
elif self.robot.sensor == 'RGB':
raise NotImplemented

return ob
return obs

def onestep_lookahead(self, action):
return self.step(action, update=False)
Expand All @@ -323,9 +323,9 @@ def step(self, action, update=True):
human_actions = []
for human in self.humans:
# observation for humans is always coordinates
ob = [other_human.get_observable_state() for other_human in self.humans if other_human != human]
obs = [other_human.get_observable_state() for other_human in self.humans if other_human != human]
if self.robot.visible:
ob += [self.robot.get_observable_state()]
obs += [self.robot.get_observable_state()]
human_actions.append(human.act(ob))

# collision detection
Expand Down Expand Up @@ -409,19 +409,19 @@ def step(self, action, update=True):

# compute the observation
if self.robot.sensor == 'coordinates':
ob = [human.get_observable_state() for human in self.humans]
obs = [human.get_observable_state() for human in self.humans]
elif self.robot.sensor == 'RGB':
raise NotImplemented
else:
if self.robot.sensor == 'coordinates':
ob = [human.get_next_observable_state(action) for human, action in zip(self.humans, human_actions)]
obs = [human.get_next_observable_state(action) for human, action in zip(self.humans, human_actions)]
elif self.robot.sensor == 'RGB':
raise NotImplemented

return ob, reward, done, info
return obs, reward, done, info

def render(self, mode='human', output_file=None):
import matplotlib.animation as animation
from matplotlib import animation
import matplotlib.pyplot as plt
plt.rcParams['animation.ffmpeg_path'] = '/usr/bin/ffmpeg'

Expand Down
7 changes: 0 additions & 7 deletions requirements.txt

This file was deleted.

36 changes: 28 additions & 8 deletions setup.py
@@ -1,12 +1,32 @@
from setuptools import setup


setup(name='crowd_sim',
version='0.0.1',
install_requires=['gym', 'numpy', 'matplotlib']
setup(
name='crowdnav',
version='0.0.1',
packages=[
'crowd_nav',
'crowd_nav.configs',
'crowd_nav.policy',
'crowd_nav.utils',
'crowd_sim',
'crowd_sim.envs',
'crowd_sim.envs.policy',
'crowd_sim.envs.utils',
],
install_requires=[
'gitpython',
'gym',
'matplotlib',
'numpy',
'scipy',
'torch',
'torchvision',
],
extras_require={
'test': [
'pylint',
'pytest',
],
},
)

setup(name='crowd_nav',
version='0.0.1',
install_requires=['gym', 'numpy', 'torch', 'matplotlib']
)

0 comments on commit 0633366

Please sign in to comment.