Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Example Problem #9

Open
maxspahn opened this issue Feb 23, 2022 · 13 comments
Open

Example Problem #9

maxspahn opened this issue Feb 23, 2022 · 13 comments

Comments

@maxspahn
Copy link
Collaborator

When running the example in a fresh install some dependencies are missing:
gnuplot
Library GLU option

Also, some error in the documentation: pdbplanner must be replaced with pdplanner.

@maxspahn
Copy link
Collaborator Author

Set default to --no-open.

@niketagrawal
Copy link
Collaborator

(plannerbenchmark-nPaI4okZ-py3.8) nagrawal@TUD258754:~/DCC-assignments/localPlannerBench/experiments/example$ ../../plannerbenchmark/exec/runner -c setup/exp.yaml -p pdplanner setup/planner.yaml --render
start run
Composing the planner
Planner composed in 0.0 sec
Timestep : 0
Traceback (most recent call last):
  File "/home/nagrawal/.cache/pypoetry/virtualenvs/plannerbenchmark-nPaI4okZ-py3.8/lib/python3.8/site-packages/gym/envs/classic_control/rendering.py", line 27, in <module>
    from pyglet.gl import *
  File "/home/nagrawal/.cache/pypoetry/virtualenvs/plannerbenchmark-nPaI4okZ-py3.8/lib/python3.8/site-packages/pyglet/gl/__init__.py", line 95, in <module>
    from pyglet.gl.gl import *
  File "/home/nagrawal/.cache/pypoetry/virtualenvs/plannerbenchmark-nPaI4okZ-py3.8/lib/python3.8/site-packages/pyglet/gl/gl.py", line 45, in <module>
    from pyglet.gl.lib import link_GL as _link_function
  File "/home/nagrawal/.cache/pypoetry/virtualenvs/plannerbenchmark-nPaI4okZ-py3.8/lib/python3.8/site-packages/pyglet/gl/lib.py", line 149, in <module>
    from pyglet.gl.lib_glx import link_GL, link_GLU, link_GLX
  File "/home/nagrawal/.cache/pypoetry/virtualenvs/plannerbenchmark-nPaI4okZ-py3.8/lib/python3.8/site-packages/pyglet/gl/lib_glx.py", line 46, in <module>
    glu_lib = pyglet.lib.load_library('GLU')
  File "/home/nagrawal/.cache/pypoetry/virtualenvs/plannerbenchmark-nPaI4okZ-py3.8/lib/python3.8/site-packages/pyglet/lib.py", line 164, in load_library
    raise ImportError('Library "%s" not found.' % names[0])
ImportError: Library "GLU" not found.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "../../plannerbenchmark/exec/runner", line 216, in <module>
    newmain()
  File "../../plannerbenchmark/exec/runner", line 212, in newmain
    myRunner.run()
  File "../../plannerbenchmark/exec/runner", line 202, in run
    ob, t_new = self.applyAction(action, t)
  File "../../plannerbenchmark/exec/runner", line 128, in applyAction
    ob, _, _, _ = self._env.step(action)
  File "/home/nagrawal/.cache/pypoetry/virtualenvs/plannerbenchmark-nPaI4okZ-py3.8/lib/python3.8/site-packages/gym/wrappers/order_enforcing.py", line 11, in step
    observation, reward, done, info = self.env.step(action)
  File "/home/nagrawal/.cache/pypoetry/virtualenvs/plannerbenchmark-nPaI4okZ-py3.8/lib/python3.8/site-packages/planarenvs/planarCommon/planarEnv.py", line 82, in step
    self.render()
  File "/home/nagrawal/.cache/pypoetry/virtualenvs/plannerbenchmark-nPaI4okZ-py3.8/lib/python3.8/site-packages/planarenvs/pointRobot/envs/pointRobotEnv.py", line 57, in render
    self.renderCommon(self._limits)
  File "/home/nagrawal/.cache/pypoetry/virtualenvs/plannerbenchmark-nPaI4okZ-py3.8/lib/python3.8/site-packages/planarenvs/planarCommon/planarEnv.py", line 118, in renderCommon
    from gym.envs.classic_control import rendering
  File "/home/nagrawal/.cache/pypoetry/virtualenvs/plannerbenchmark-nPaI4okZ-py3.8/lib/python3.8/site-packages/gym/envs/classic_control/rendering.py", line 29, in <module>
    raise ImportError(
ImportError:
    Error occurred while running `from pyglet.gl import *`
    HINT: make sure you have OpenGL installed. On Ubuntu, you can run 'apt-get install python-opengl'.
    If you're running on a server, you may need a virtual frame buffer; something like this should work:
    'xvfb-run -s "-screen 0 1400x900x24" python <your_script.py>'

@maxspahn
Copy link
Collaborator Author

might be apt install freeglut3

@niketagrawal
Copy link
Collaborator

This example could be added as part of build test in CI.

@maxspahn
Copy link
Collaborator Author

Consider using docker image here. This might simplify making it work.
Consider using the manual flag for github actions.

@maxspahn
Copy link
Collaborator Author

maxspahn commented Mar 3, 2022

The error: Library 'GLU' not found is not related to this repository. An issue has been created in the corresponding repository, see maxspahn/gym_envs_planar#34

@maxspahn
Copy link
Collaborator Author

maxspahn commented Mar 3, 2022

If you run into that problem, you can run without the --render flag.

@maxspahn
Copy link
Collaborator Author

I have tried to reproduce the error in a docker container.
However, i was not able to open the GUI for the rendering.
I'll post the dockerfile here shortly.

@maxspahn
Copy link
Collaborator Author

FROM python:3.7

RUN apt-get update
RUN apt-get install -y git 
RUN apt-get install -y vim
RUN apt-get install -y freeglut3
RUN apt-get install -y dbus-x11
RUN apt-get install -y gedit
RUN apt-get install -y supervisor xinetd x11vnc xvfb openbox xdotool wmctrl x11-utils xterm
RUN apt-get install -y freeglut3-dev freeglut3 libgl1-mesa-dev libglu1-mesa-dev libxext-dev libxt-dev
RUN apt-get install -y python3-opengl libgl1-mesa-glx libglu1-mesa


ENV PYTHONPATH=${PYTHONPATH}:${PWD}

RUN pip3 install poetry

RUN git clone https://github.com/maxspahn/gym_envs_urdf

RUN cd gym_envs_urdf && poetry install -E scenes

# CMD /usr/bin/gedit
# CMD cd gym_envs_planar && poetry run python examples/point_robot.py
CMD cd gym_envs_urdf && poetry run python examples/boxer.py

@maxspahn
Copy link
Collaborator Author

FROM ubuntu:latest
ENV DEBIAN_FRONTEND=nointeractive

RUN apt-get update -q && \
  apt-get install -y git python3-pip python3 python3-dev vim python3-opengl xvfb gedit


ENV PYTHONPATH=${PYTHONPATH}:${PWD}

RUN pip3 install poetry

RUN git clone https://github.com/maxspahn/gym_envs_planar

RUN cd gym_envs_planar && poetry install -E scenes

ADD run_example.sh /run_example.sh

RUN chmod a+x /run_example.sh

CMD ./run_example.sh

@maxspahn
Copy link
Collaborator Author

This last example works very nice!

The run_example.sh script contains the following lines:

cd gym_envs_planar
poetry run python examples/point_robot.py

@maxspahn
Copy link
Collaborator Author

maxspahn/gym_envs_planar#37
The docker is added to the corresponding repository.
The Dockerfile suggests that the only library you need to install is python3-opengl.

@niketagrawal
Copy link
Collaborator

niketagrawal commented Mar 18, 2022

Thanks for the update.

I am currently unable to get this working on a Linux PC (Ubuntu 20.04) as per the steps mentioned in the README in the PR. It could be because of some internal settings or permissions.

Upon running the container, the GUI window appears momentarily and closes down immediately; I see the following error.

libGL  error: MESA-LOADER: failed to retrieve the device information
Segmentation fault (core dumped)

I tried to look up about the error on the internet but couldn't fix it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants