Skip to content

Commit

Permalink
dockerfile
Browse files Browse the repository at this point in the history
  • Loading branch information
jtoy committed Dec 1, 2017
1 parent 579bc0c commit d12412f
Show file tree
Hide file tree
Showing 3 changed files with 75 additions and 5 deletions.
44 changes: 44 additions & 0 deletions Dockerfile
@@ -0,0 +1,44 @@
# A Dockerfile that sets up a full SenseNet install
FROM ubuntu:14.04

RUN apt-get update \
&& apt-get install -y libav-tools \
python-numpy \
python-scipy \
python-pyglet \
python-setuptools \
libpq-dev \
libjpeg-dev \
curl \
cmake \
swig \
freeglut3 \
python-opengl \
libboost-all-dev \
libglu1-mesa \
libglu1-mesa-dev \
libsdl2-2.0-0\
libgles2-mesa-dev \
libsdl2-dev \
wget \
unzip \
git \
xserver-xorg-input-void \
xserver-xorg-video-dummy \
python-gtkglext1 \
xpra \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/* \
&& easy_install pip

WORKDIR /usr/local/sensenet
RUN mkdir -p sensenet && touch sensenet/__init__.py
COPY ./sensenet/version.py ./sensenet
COPY ./requirements.txt .
COPY ./setup.py .
RUN pip install -e .[all]

# Finally, upload our actual code!
COPY . /usr/local/sensenet

WORKDIR /root
10 changes: 5 additions & 5 deletions scripts/touch_test.py
Expand Up @@ -4,15 +4,15 @@
import pybullet as pb
obj_file = '../tests/data/cube.stl'
action_plan = [{'moves':14,'action':3}] #full frontal of cube
#action_plan = [{'moves':14,'action':3},{'moves':11,'action':4}] #top edge,vertical line
action_plan = [{'moves':14,'action':3},{'moves':11,'action':4}] #top edge,vertical line

obj_file = '../tests/data/sphere.stl'
action_plan = [{'moves':20,'action':3}] #sphere circular area

obj_file = '../tests/data/pyramid.stl'
action_plan = [{'moves':8,'action':3}] #pyramid angle
action_plan = [{'moves':8,'action':3},{'moves':10,'action':4},{'moves':5,'action':3}] #mid pyramid
action_plan = [{'moves':5,'action':1},{'moves':10,'action':3},{'moves':15,'action':4},{'moves':10,'action':3}] #top of pyramid
#obj_file = '../tests/data/pyramid.stl'
#action_plan = [{'moves':8,'action':3}] #pyramid angle
#action_plan = [{'moves':8,'action':3},{'moves':10,'action':4},{'moves':5,'action':3}] #mid pyramid
#action_plan = [{'moves':5,'action':1},{'moves':10,'action':3},{'moves':15,'action':4},{'moves':10,'action':3}] #top of pyramid
if len(sys.argv) == 2:
obj_file = sys.argv[1]
print("loading",obj_file)
Expand Down
26 changes: 26 additions & 0 deletions tests/envtest.py
@@ -0,0 +1,26 @@

import gym
from env import TouchEnv
from torch.autograd import Variable
import torch
def select_action(state):
state = torch.from_numpy(state).float().unsqueeze(0)
return state

tenv = SenseEnv()
env = gym.make("CartPole-v0")
input_dim = env.observation_space.shape[0]
output_dim = env.action_space.n
tinput_dim = tenv.observation_space()
toutput_dim = len(tenv.action_space())
print("gym observation space: ",input_dim)
print("gym action space: ",output_dim)
print("touch observation space: ",tinput_dim)
print("touch action space: ",toutput_dim)
state = env.reset()
tstate = tenv.reset()
print("gym state:",state)
print("touch state:",tstate)
print("new gym action:",select_action(state))
print("new touch action:",select_action(tstate))
#state, reward, done, _ = env.step(action[0,0])

0 comments on commit d12412f

Please sign in to comment.