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

Use virtualgl egl backend to run simulation without X server. #747

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions subt/docker/cloudsim/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
FROM osrf/subt-virtual-testbed:cloudsim_sim_latest

RUN cd /tmp && \
curl -sSO https://s3.amazonaws.com/virtualgl-pr/dev/linux/virtualgl_2.6.80_amd64.deb && \
sudo apt-get install ./virtualgl_*

#ENTRYPOINT ["/usr/bin/env"]

COPY subt/docker/cloudsim/run_wrapped.bash .

ENTRYPOINT ["./run_wrapped.bash"]
5 changes: 5 additions & 0 deletions subt/docker/cloudsim/run_wrapped.bash
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/bin/bash

echo "running wrapped"

xvfb-run -a -s '-screen 0 1x1x24' vglrun -d /dev/dri/card1 ./run_sim.bash $@
14 changes: 7 additions & 7 deletions subt/tools/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,9 +113,9 @@ def _create_docker(client, name, image, command, mounts=[], environment={}):
privileged = True,
#network_mode = "host",
environment = {
"DISPLAY": os.environ["DISPLAY"],
"QT_X11_NO_MITSHM": 1,
"XAUTHORITY": str(XAUTH),
#"DISPLAY": os.environ["DISPLAY"],
#"QT_X11_NO_MITSHM": 1,
#"XAUTHORITY": str(XAUTH),
},
#stdout = True,
#stderr = True,
Expand All @@ -126,10 +126,10 @@ def _create_docker(client, name, image, command, mounts=[], environment={}):
#entrypoint="/bin/bash",
#command = "/opt/ros/melodic/bin/rviz",
mounts = [
docker.types.Mount(str(XAUTH), str(XAUTH), "bind"),
docker.types.Mount("/tmp/.X11-unix/", "/tmp/.X11-unix/", "bind"),
#docker.types.Mount(str(XAUTH), str(XAUTH), "bind"),
#docker.types.Mount("/tmp/.X11-unix/", "/tmp/.X11-unix/", "bind"),
docker.types.Mount("/etc/localtime", "/etc/localtime", "bind", read_only=True),
docker.types.Mount("/dev/input/", "/dev/input/", "bind"),
#docker.types.Mount("/dev/input/", "/dev/input/", "bind"),
],
)
opts["mounts"] += mounts
Expand Down Expand Up @@ -170,7 +170,7 @@ def _run_sim(client, circuit, logdir, world, robots):
f"robotName{n}:={name}",
f"robotConfig{n}:={kind}"
]
sim = _create_docker(client, "sim", "osrf/subt-virtual-testbed:cloudsim_sim_latest", command, mounts, environment)
sim = _create_docker(client, "sim", "cloudsim:latest", command, mounts, environment)
Copy link
Member

@m3d m3d Dec 18, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder how not to forget to rebuild local cloudsim when external is upgraded?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The solution is the same as we are using for our base image. We can start using specific versions instead of "latest".

print(f" connecting to simnet as 172.28.1.1")
simnet.connect(sim, ipv4_address="172.28.1.1")
sim.start()
Expand Down