Low FPS in rviz running through Docker on WSL2 - docker

I am trying to run this docker file: A-LOAM-Docker.
My setup is docker desktop over WSL2 with ubuntu 20.04LTS and XLaunch. When I run roscore and then rviz in different terminal, it opens and shows ~30 FPS. Then, I try running the docker file with script:
#!/bin/bash
docker run -it --rm --net=host -e DISPLAY=$DISPLAY -v $1:/root/catkin_ws/src/A-LOAM/ a-loam:latest bash -i -c \
"source ~/.bashrc; \
cd /root/catkin_ws/; \
catkin config \
--cmake-args \
-DCMAKE_BUILD_TYPE=Release; \
catkin build; \
source devel/setup.bash; \
roslaunch aloam_velodyne aloam_velodyne_VLP_16.launch rviz:=true; \
source /opt/ros/kinetic/setup.bash; \
"
It instantly runs rviz, but this time from the very beginning it shows 1-3 FPS. I wonder what can cause such a difference and how to fix that.

Related

Issues running a docker container with a GUI application with host network mode

I am trying to create a docker container with a ROS install and a simulation setup to streamline the process for people joining the project later.
When I run rviz this way, I get the rviz window showing up on my host just fine, as expected following this ros tutorial:
sudo docker run -it --env="DISPLAY" --env="QT_X11_NO_MITSHM=1" --volume="/tmp/.X11-unix:/tmp/.X11-unix:rw" xrf-robot-repo rviz
ROS Master isn't running so this output is expected
Now my issue is that I want to run my container in the host network mode (--net=host) the rviz dialogue does not show up anymore. Here's what I run this:
sudo docker run -it --env="DISPLAY" --env="QT_X11_NO_MITSHM=1" --volume="/tmp/.X11-unix:/tmp/.X11-unix:rw" --net=host xrf-robot-repo rviz I don't think these errors have anything to do with the gui window not showing up
I have no idea why the GUI window does not show up. I was hoping for some guidance here. I would guess this would have something to do with the different network mode affecting how the x11 forwarding may work, but I am not sure how to further look into this.
Here's what my Dockerfile looks like that I used to build the image in case it may be helpful:
FROM osrf/ros:melodic-desktop-full
SHELL ["/bin/bash", "-c"]
RUN apt-get update && apt-get install -y --no-install-recommends \
git apt-utils python3-catkin-tools\
&& rm -rf /var/lib/apt/lists/*
RUN source ./ros_entrypoint.sh && git clone https://github.com/RumailM/xrf-robot-stack
RUN source ./ros_entrypoint.sh && cd xrf-robot-stack && catkin_init_workspace
RUN apt-get update
ARG DEBIAN_FRONTEND=noninteractive
RUN source ./ros_entrypoint.sh && cd xrf-robot-stack && rosdep install
--from-paths src --ignore-src -r -y
RUN source ./ros_entrypoint.sh && cd xrf-robot-stack && catkin build
The reason I need to use network mode is that I would like the host to be able to communicate with the rosmaster node and any other nodes within the container. I also do not know before hand what nodes may exist outside the container and at what ports they may communicate on, so the obvious answer of forwarding only the ports that I will use will not work (the ports may change at runtime). Forwarding large ranges of ports does not seem viable either.
Any guidance is appreciated!
You should add --privileged option to the docker run command. This is related to this issue Qt applications and network host .
I ran into a similar issue and was able to resolve by following this question on ROS Answers.
Also to be able to run rviz properly, I needed the docker container to access my graphics card drivers(NVIDIA) in my case. So I needed to add -e NVIDIA_VISIBLE_DEVICES=all and -e NVIDIA_DRIVER_CAPABILITIES=all and --runtime nvidia to the docker run command.
This was the final run command
docker run -it --rm \
--privileged \
--network host \
-e NVIDIA_VISIBLE_DEVICES=all \
-e NVIDIA_DRIVER_CAPABILITIES=all \
--env="DISPLAY" \
--env="QT_X11_NO_MITSHM=1" \
--volume="/tmp/.X11-unix:/tmp/.X11-unix:rw" \
--name "$CONTAINER_NAME" \
--runtime nvidia \
xrf-robot-repo \
/bin/bash
Hope this helps

GCC builds under teamcity docker agent

I'm trying out teamcity to build GCC binaries with docker agents on centos. I setup a docker agent to connect to builder2 TC server.
$ docker pull jetbrains/teamcity-agent
$ mkdir -p /mnt/builders/teamcity/agent1/conf
$ mkdir -p /mnt/builders/teamcity/agent/work
$ mkdir -p /mnt/builders/teamcity/agent/system
docker run -it --name agent1 \
-e SERVER_URL="http://builder2:8111" \
-e AGENT_NAME="builder2_agent1" \
--hostname builder2_agent \
--dns="xx.xxx.xx.xx" \
-v /mnt/builders/teamcity/agent1/conf:/data/teamcity_agent/conf \
-v /mnt/builders/teamcity/agent/work:/opt/buildagent/work \
-v /mnt/builders/teamcity/agent/system:/opt/buildagent/system \
--network='BuilderNetwork' \
jetbrains/teamcity-agent
All that works good but in order to make a build you must import the devtoolset like this
scl enable devtoolset-10 "/bin/bash"
$ which make
/opt/rh/devtoolset-10/root/usr/bin/make
So how is this done with docker agent? Are these tools to be built in the image or do you expose the /opt/rh dir to the container? Also if you were to expose the volume then how do you install /usr/bin/scl (i.e rh package scl-utils-20130529-19.el7.x86_64) into the docker container? Does it even make sense to run an agent in docker for this?

Run firefox in docker container on raspberry pi

I've followed this thread
to build a docker container to run on Raspberry pi. I've managed to run it on a normal centos, but on pi I always get this error (I always run in mobaxterm application on windows 10 because it has x11 support):
Unable to init server: broadway display type not supported 'machinename:0'
Error: cannot open display: machinename:0
I've tried to build it with 2 different dockerfile, the 1st:
FROM resin/rpi-raspbian:latest
# Make sure the package repository is up to date
RUN apt-get update && apt-get install -y firefox-esr
USER root
ENV HOME /root
CMD /usr/bin/firefox
And tried to run it with this script:
#!/usr/bin/env bash
CONTAINER=firefox_wo_vnc
COMMAND=/bin/bash
DISPLAY="machinename:0"
USER=$(whoami)
docker run -ti --rm \
-e DISPLAY \
-v "/c/Users/$USER:/home/$USER:rw" \
$CONTAINER
$COMMAND
and I got the error :(
The 2nd that I've tried:
# Firefox over VNC
#
# VERSION 0.1
# DOCKER-VERSION 0.2
FROM resin/rpi-raspbian:latest
RUN apt-get update
# Install vnc, xvfb in order to create a 'fake' display and firefox
RUN apt-get install -y x11vnc xvfb firefox-esr
RUN mkdir ~/.vnc
# Setup a password
RUN x11vnc -storepasswd 1234 ~/.vnc/passwd
# Autostart firefox (might not be the best way to do it, but it does the trick)
RUN bash -c 'echo "firefox" >> /.bashrc'
And tried to run:
#!/usr/bin/env bash
CONTAINER=firefoxvnc
COMMAND=/bin/bash
DISPLAY="machinename:0"
USER=$(whoami)
docker run \
-it \
--rm \
--user=$USER \
--workdir="/home/$USER" \
-v "/c/Users/$USER:/home/$USER:rw" \
-e DISPLAY \
$CONTAINER \
$COMMAND
This way I can login via VNC but firefox is not running and I can't see actually anything just an empty desktop.
I've read many thread, I've installed xorg, openbox, x11 apps ...

Docker container share screen over VNC

I am trying to follow the following dockerfile to create a container with qtCreator and run the container with the following command
docker run -it --rm -e DISPLAY=$DISPLAY -v /tmp/.X11-unix:/tmp/.X11-unix qtcreator
however this is throwing an error as below
PS D:\Docker\qtcreator> docker run -it --rm -e DISPLAY=$DISPLAY -v /tmp/.X11-unix:/tmp/.X11-unix qtcreator
QXcbConnection: Could not connect to display
Aborted
I tried to change the file a bit that looks as below based on some research I did to install VNC on this container.
FROM ubuntu:14.04
# Install vnc, xvfb in order to create a 'fake' display and qtcreator
RUN apt-get update && apt-get install -y qtcreator x11vnc xvfb
run mkdir ~/.vnc
# Setup a password
run x11vnc -storepasswd 1234 ~/.vnc/passwd
RUN export uid=1000 gid=1000 && \
mkdir -p /home/developer && \
echo "developer:x:${uid}:${gid}:Developer,,,:/home/developer:/bin/bash" >> /etc/passwd && \
echo "developer:x:${uid}:" >> /etc/group && \
echo "developer ALL=(ALL) NOPASSWD: ALL" > /etc/sudoers.d/developer && \
chmod 0440 /etc/sudoers.d/developer && \
chown ${uid}:${gid} -R /home/developer
USER developer
ENV HOME /home/developer
CMD /usr/bin/qtcreator
after this I tried to run this container using the following command
docker run -p 5900 -it --rm -v /tmp/.X11-unix:/tmp/.X11-unix qtcreator x11vnc -forever -usepw -create
this command seams to run and wait for termination I think, as the PS does not return back.
as I am new to docker can some one please let me know how to connect my VNC Client on my windows 10 parent machine or from a remote machine to the vnc server running in this container. i.e. how do I find the IP Address and port number to connect.
UPDATE 1
when i run the command docker ps --filter "status=running" I see the following log
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
a2ab1397bb2b qtcreator "x11vnc -forever -..." About an hour ago Up About an hour 0.0.0.0:32770->5900/tcp clever_haibt
69754e382042 qtcreator "x11vnc -forever -..." 2 hours ago Up 2 hours priceless_hugle

How to run enlightenment wayland in docker container?

I am trying to run enlightenment(https://www.enlightenment.org/start) in a docker container,previously enlightenment is based on X11,but the latest version of enlightenment support wayland. As I searched,we can use the -v parameter when use the "docker run" command to start a docker image like :
$ docker run -it \
--net host \ # may as well YOLO
--cpuset-cpus 0 \ # control the cpu
--memory 512mb \ # max memory it can use
-v /tmp/.X11-unix:/tmp/.X11-unix \ # mount the X11 socket
-e DISPLAY=unix$DISPLAY \ # pass the display
-v $HOME/Downloads:/root/Downloads \ # optional, but nice
-v $HOME/.config/google-chrome/:/data \ # if you want to save state
--device /dev/snd \ # so we have sound
--name chrome \
jess/chrome
(Reference: https://blog.jessfraz.com/post/docker-containers-on-the-desktop/)
But this is based on X11.Currently I do not use the X11,and use the wayland based enlightenment,How can I show my enlightenment UI in docker container?
According to
https://unix.stackexchange.com/questions/330366/how-can-i-run-a-graphical-application-in-a-container-under-wayland
you mount some device such as
/run/user/1000/wayland-0
in your
docker run
command
and here is an extract from
https://github.com/duzy/docker-wayland/blob/master/run.sh
docker run \
--name $container \
-v "$(pwd):/home/user/work" \
--device=/dev/dri/card0:/dev/dri/card0 \
--device=/dev/dri/card1:/dev/dri/card1 \
--device=/dev/dri/controlD64:/dev/dri/controlD64 \
--device=/dev/dri/controlD65:/dev/dri/controlD65 \

Resources