Refactored render script location (inside /env)

This commit is contained in:
Zhiyang He 2017-08-16 17:40:43 -07:00
parent 9ecc226f73
commit 9c37b031c0
12 changed files with 38 additions and 27 deletions

View File

@ -1,4 +0,0 @@
#!/bin/bash
g++ -std=c++11 render.cpp -o render.so -shared -fPIC -O2 -D_GLIBCXX_USE_CXX11_ABI=0

View File

@ -1,3 +1,5 @@
./realenv/envs/build.sh
x_display=1
Xvnc4 :$x_display -PasswordFile pw -Zliblevel 0 -depth 24 -geometry 512x256 2>&1 &
echo "Using display: x_display=$x_display"
@ -5,4 +7,4 @@ echo "Using display: x_display=$x_display"
export DISPLAY=":$x_display"
xsetroot -solid grey -cursor_name left_ptr
python show_3d.py --dataroot ~/Development/data/viewsyn_tiny/ --idx 3 --model compG_epoch3_10000.pth
python realenv/envs/show_3d.py --dataroot ~/Development/data/viewsyn_tiny/ --idx 3 --model compG_epoch3_10000.pth

View File

@ -35,12 +35,11 @@ if __name__ == '__main__':
observation, infos, err = client.reset()
else:
action = agent.act(ob)
print('action', action)
observation, infos, err = client.step(action)
# display
## display
if any(infos[i]['stats.vnc.updates.n'] for i in infos.keys()):
# TODO: is network causing bottleneck here?
for ob in observation.keys():
# print(observation[ob])
viewer.imshow(observation[ob])
time.sleep(0.2)

View File

@ -55,7 +55,9 @@ class VNCClient:
def step(self, action):
observations, infos, errors = self.vnc_session.step({CONNECTION_NAME: [("KeyEvent", keycode(action), 1)]})
observations, infos, errors = self.vnc_session.step({CONNECTION_NAME: [("KeyEvent", keycode(action), 0)]})
# TODO: botton release causes bug here
# self.vnc_session.step({CONNECTION_NAME: [("KeyEvent", keycode(action), 0)]})
# observations, infos, errors = self.vnc_session.step({CONNECTION_NAME: [("KeyEvent", keycode(action), 0)]})
return observations, infos, errors

4
realenv/envs/build.sh Executable file
View File

@ -0,0 +1,4 @@
#!/bin/bash
g++ -std=c++11 ./realenv/envs/render.cpp -o ./realenv/envs/render.so -shared -fPIC -O2 -D_GLIBCXX_USE_CXX11_ABI=0

View File

@ -1,3 +1,4 @@
#include <cstdlib>
#include <cstdio>
#include <vector>
#include <algorithm>

View File

@ -1,6 +1,7 @@
import numpy as np
import ctypes as ct
import cv2
import os
import sys
import argparse
from datasets import ViewDataSet3D
@ -24,7 +25,9 @@ mousedown = False
clickstart = (0,0)
fps = 0
dll=np.ctypeslib.load_library('render','.')
dir_path = os.path.dirname(os.path.realpath(__file__)) + "/"
print(dir_path)
dll=np.ctypeslib.load_library('render', dir_path)
def onmouse(*args):

View File

@ -5,28 +5,32 @@ from subprocess import check_call
from distutils.command.build_py import build_py as _build_py
import sys, os.path
'''
class PostInstallCommand(install):
"""Post-installation for installation mode."""
def run(self):
print('post installation')
check_call("bash build.sh".split())
check_call("bash realenv/envs/build.sh".split())
install.run(self)
'''
setup(name='realenv',
description='Real Environment Developed by Stanford University',
url='https://github.com/fxia22/realenv',
author='Stanford University',
zip_safe=False,
install_requires=[
'numpy>=1.10.4',
'go-vncdriver>=0.4.19',
'pyglet>=1.2.0',
'gym>=0.9.2'
],
tests_require=[],
cmdclass={
'install': PostInstallCommand
}
version='0.0.1',
description='Real Environment Developed by Stanford University',
url='https://github.com/fxia22/realenv',
author='Stanford University',
zip_safe=False,
install_requires=[
'numpy>=1.10.4',
'go-vncdriver>=0.4.19',
'pyglet>=1.2.0',
'gym>=0.9.2'
],
tests_require=[],
# cmdclass={
# 'install': PostInstallCommand
#}
)
# check_call("bash realenv/envs/build.sh".split())