Skip to content

Commit

Permalink
Upgrade demo to python 3, also closes peteanderson80#42
Browse files Browse the repository at this point in the history
  • Loading branch information
peteanderson80 committed Oct 14, 2019
1 parent cb196b6 commit 4dc6874
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 8 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ target_link_libraries(mattersim_main MatterSim)

add_subdirectory(pybind11)

find_package(PythonInterp 2.7)
find_package(PythonInterp 3)
message(${PYTHON_EXECUTABLE})

# Need to search for python executable again to pick up an activated
Expand Down
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -155,11 +155,13 @@ nvidia-docker run -it -e DISPLAY -v /tmp/.X11-unix:/tmp/.X11-unix --mount type=b
cd /root/mount/Matterport3DSimulator
```

If you get an error like `Error: BadShmSeg (invalid shared segment parameter) 128` you may also need to include `-e="QT_X11_NO_MITSHM=1"` in the docker run command above.

Build the simulator using any rendering option. Commands for running both python and C++ demos are provided below. These are very simple demos designed to illustrate the use of the simulator in python and C++. By default, these demos have depth rendering on. Check the code and turn it off if you haven't preprocessed the depth outputs (see Depth Outputs above).

Python demo:
```
python src/driver/driver.py
python3 src/driver/driver.py
```
C++ demo:
```
Expand Down
12 changes: 6 additions & 6 deletions src/driver/driver.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import sys
sys.path.append('build')

import MatterSim
import time
import math
Expand All @@ -18,7 +17,7 @@
sim = MatterSim.Simulator()
sim.setCameraResolution(WIDTH, HEIGHT)
sim.setCameraVFOV(VFOV)
sim.setDepthEnabled(True)
sim.setDepthEnabled(False) # Turn on depth only after running ./scripts/depth_to_skybox.py (see README.md)
sim.initialize()
#sim.newEpisode(['2t7WUuJeko7'], ['1e6b606b44df4a6086c0f97e826d4d15'], [0], [0])
#sim.newEpisode(['1LXtFkjw3qL'], ['0b22fa63d0f54a529c525afbf2e8bb25'], [0], [0])
Expand All @@ -29,9 +28,10 @@
location = 0
ANGLEDELTA = 5 * math.pi / 180

print '\nPython Demo'
print 'Use arrow keys to move the camera.'
print 'Use number keys (not numpad) to move to nearby viewpoints indicated in the RGB view.\n'
print('\nPython Demo')
print('Use arrow keys to move the camera.')
print('Use number keys (not numpad) to move to nearby viewpoints indicated in the RGB view.')
print('Depth outputs are turned off by default - check driver.py:L20 to enable.\n')

while True:
sim.makeAction([location], [heading], [elevation])
Expand Down

0 comments on commit 4dc6874

Please sign in to comment.