Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
43a4d53
Added novnc proxy
nassir90 Aug 6, 2022
8bc887b
Added instructions on how to install docker-compose
nassir90 Aug 6, 2022
3a39f4f
Added DWM guide
nassir90 Aug 6, 2022
59dca53
Fixed typo
nassir90 Aug 6, 2022
7e7a5e3
Small fixes
nassir90 Aug 6, 2022
5ebe4ff
5900 doesnt need to be exposed
nassir90 Aug 6, 2022
ad2ff27
Added and Changed Dwm help guide
alexandersep Aug 6, 2022
f48c4cb
Changed dwm help guide to have a markdown table
alexandersep Aug 6, 2022
d451735
Make last line more helpful
nassir90 Aug 6, 2022
3cc6725
Now using super instead of alt for mod key
nassir90 Aug 6, 2022
4a6adee
Build suckless software locally to prevent binary incompatibility
nassir90 Aug 6, 2022
6f8efbf
Change workflow to reflect new method of building the container
nassir90 Aug 6, 2022
fd60f17
Changed dockerFile to properly isntall dwm and st
alexandersep Aug 6, 2022
1a755a3
modified dwm section to point to our forked repository
alexandersep Aug 6, 2022
7f381b5
Suggest using a VNC client if using a web browser doesn't work
nassir90 Aug 6, 2022
381dac9
H7 english -> H6 english
nassir90 Aug 6, 2022
abd2dcf
Added/Modified information regarding VNC client section
alexandersep Aug 6, 2022
817ad8c
Fixed markdown alignment on section VNC
alexandersep Aug 6, 2022
22e6c71
Windows should no longer clobber line endings
nassir90 Aug 6, 2022
dad0166
Expose directive redundant here
nassir90 Aug 6, 2022
5a0d14f
Restructured VNC section. The command given now exposes both the VNC …
nassir90 Aug 7, 2022
70d20b1
Added python3-numpy
nassir90 Aug 11, 2022
dd92d6b
Reintroduced rocker tutorial since as its better than VNC, added pass…
nassir90 Aug 11, 2022
257c0c0
Light=>lite
nassir90 Aug 11, 2022
4fddb93
Use docker compose services for VSCode users
nassir90 Aug 11, 2022
85128eb
Everything is now conditional because apparently some processes are p…
nassir90 Aug 12, 2022
dab17da
Fix update step
nassir90 Sep 3, 2022
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
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
*.sh text eol=lf
2 changes: 1 addition & 1 deletion .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- run: docker build .
- run: docker compose build
35 changes: 11 additions & 24 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,26 +1,13 @@
# pull container from https://hub.docker.com/_/ros, choosing the melodic-robot-bionic version
FROM ros:melodic-robot-bionic

FROM ros:noetic
# install dependencies for the F1Tenth simulator and wget (and now pip)
RUN sudo apt-get update

RUN sudo apt-get -y install ros-melodic-ackermann-msgs ros-melodic-tf2-geometry-msgs ros-melodic-interactive-markers ros-melodic-cv-bridge ros-melodic-image-transport ros-melodic-rviz ros-melodic-joy ros-melodic-map-server wget vim python3-pip
# switch to bash for running commands

# mightn't be necessary
RUN pip3 install -U pip

RUN rm /bin/sh && ln -s /bin/bash /bin/sh
# initialise ROS, pull useful scripts from our repo and clone the F1Tenth simulator into a new catkin workspace
RUN source /ros_entrypoint.sh && \
source /opt/ros/melodic/setup.bash && \
git clone https://github.com/FT-Autonomous/f1tenth-ros-setup.git && \
mv f1tenth-ros-setup/utils /utils && \
rm -rf f1tenth-ros-setup && \
mkdir -p f1tenth_workspace/src && \
cd f1tenth_workspace/src && \
git clone https://github.com/f1tenth/f1tenth_simulator.git && \
cd f1tenth_simulator/maps && \
git init && \
git remote add racetracks https://github.com/f1tenth/f1tenth_racetracks && \
git pull racetracks main
RUN apt update && apt install -y ros-noetic-xacro ros-noetic-ackermann-msgs ros-noetic-tf2-geometry-msgs ros-noetic-interactive-markers ros-noetic-cv-bridge ros-noetic-image-transport ros-noetic-rviz ros-noetic-joy ros-noetic-map-server wget neovim python3-pip x11vnc xvfb xorg-dev git python3-numpy
# Initialise code for geting graphical output from the docker container
RUN git clone https://git.suckless.org/st/ && cd st && make clean install ; \
git clone https://github.com/FT-Autonomous/dwm && cd dwm && make clean install ; \
git clone https://github.com/novnc/noVNC.git /noVNC ; \
git clone https://github.com/novnc/websockify /noVNC/utils/websockify
# Pull in utility scripts
COPY ./utils /utils
RUN cp -f /bin/bash /bin/sh
RUN /utils/setup-workspace.sh /f1tenth_workspace
118 changes: 69 additions & 49 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,39 +5,47 @@ A simplified setup and workspace for using F1Tenth with ROS and Docker.
## Prerequisites

### Windows/Mac

* [git](https://www.atlassian.com/git/tutorials/install-git)
* [Docker Desktop](https://www.docker.com/products/docker-desktop)
* [Docker Compose](https://docs.docker.com/compose/install/)

### Editor

* [Visual Studio Code](https://www.toolsqa.com/blogs/install-visual-studio-code/) (unless you have some other preference)

### Linux
* Make sure to sync packages before installing new packages
* [git](https://www.atlassian.com/git/tutorials/install-git)
* Debian based
* `sudo apt update` (syncing packages)
* `sudo apt install git`
* Arch based
* `sudo pacman -Sy` (syncing packages)
* `sudo pacman -S git`
* Gentoo based
* `sudo emerge --sync` (syncing packages)
* `sudo emerge git`

Make sure to sync packages before installing new packages

#### Git - <https://www.atlassian.com/git/tutorials/install-git>

* Debian based
* `sudo apt update` (syncing packages)
* `sudo apt install git`
* Arch based
* `sudo pacman -Sy` (syncing packages)
* `sudo pacman -S git`
* Gentoo based
* `sudo emerge --sync` (syncing packages)
* `sudo emerge git`

* [Docker](https://www.docker.com/products/docker-desktop)
* [Debian based](https://docs.docker.com/engine/install/ubuntu/)
* [Arch based](https://wiki.archlinux.org/title/Docker)
* `sudo pacman -S yay base-devel`
* `yay -S docker-git`
* [Gentoo based](https://wiki.gentoo.org/wiki/Docker)
* `sudo emerge app-containers/docker app-containers/docker-cli`

#### Systemd based - Debian/Arch etc
#### Docker - <https://www.docker.com/products/docker-desktop>

* [Debian based](https://docs.docker.com/engine/install/ubuntu/)
* See [here](https://www.digitalocean.com/community/tutorials/how-to-install-and-use-docker-compose-on-ubuntu-20-04) for instructions on how to install docker compose on ubuntu.
* [Arch based](https://wiki.archlinux.org/title/Docker)
* `sudo pacman -S yay base-devel`
* `yay -S docker-git docker-compose`
* [Gentoo based](https://wiki.gentoo.org/wiki/Docker)
* `sudo emerge app-containers/docker app-containers/docker-cli app-containers/docker-compose`

#### Starting the Docker daemon

##### Systemd based - Debian/Ubuntu/Arch etc
* `sudo systemctl enable docker`
* `sudo systemctl start docker`

#### Init Systems

##### OpenRC - Gentoo
* `sudo rc-update add docker`
* `sudo rc-service docker start`
Expand All @@ -62,18 +70,18 @@ The build might take a while to load the first time you run it.

```
cd f1tenth-ros-setup
docker build -t f1tenth-ros .
docker compose build
```

#### 4. Run a Container

This step will ensure the build has worked by running a container. Later we will run the simulator in this container.

```
docker run -it f1tenth-ros
docker compose run f1tenth-ros
```

You should see your terminal display something like
You should see your terminal display something like:

```
root@...:/#
Expand Down Expand Up @@ -193,48 +201,60 @@ chmod +x <filepath>

* Having multiple terminals open can get confusing, luckily in VSCode you can rename each terminal to something more convenient: Right-click terminal name -> rename.

## Enabling the container to display GUIs on the host machine (Windows)

Prerequisite: Chocolatey must be installed on your computer.
## Using the GUI within the Docker Container via VNC

Warning: Some firewalls may block access so it might be necessary to disable your firewall when running the simulator.

Open Windows Powershell as Administrator and install the `xming` package
First, run the container with the VNC ports exposed.

```
choco install xming
docker compose run --rm --service-ports f1tenth-ros-vnc
```

Open the XLaunch Application
### Connecting to the Docker Container Using a VNC Client

<img src="https://i.imgur.com/q6bDsQV.jpg" width="300">
There is a universal method, though you will have a better experience using a dedicated VNC client.

Follow the default settings for each step except the following
#### MacOS

<img src="https://i.imgur.com/zn3YArf.jpg" width="400">
MacOS comes with a built in VNC client.
Once the docker container is running, you can open it using `open vnc://root:f1tenth@localhost:5900`.

Once the XLaunch setup is finished, find your local IP Address by entering an ipconfig command in your local terminal
#### Linux

```
ipconfig
```
A VNC client can be installed called remmina:

Your local IP should be found similarly to where its shown below (ignore the white marks)
* [Debian based](https://remmina.org/how-to-install-remmina/)
* It is not found in the apt repository but you can use snap/flatpaks or adding it to the apt repository
* Arch based
* `sudo pacman -S remmina libvncserver`
* [Gentoo based](https://wiki.gentoo.org/wiki/USE_flag) (see more on how to use use flags)
* Make sure to update USE flag for package to include the `vnc` USE Flag
* `sudo emerge net-misc/remmina net-libs/libvncserver`

<img src="https://i.imgur.com/JsNgYMO.jpg" width="400">
Create a new connection to `localhost:5900` with the password `f1tenth` using the VNC plugin.

Execute the setup-display script in the container passing your local IP Address as a parameter.
On Remmina if some keystrokes are not captured such as modifier keys like shift/ctrl/alt.
Make sure to turn on `Grab all keyboard events` on the left hand side.
You can also activate it by pressing `Control_R`

```
source /utils/set-display.sh <Local IP Address>
```
#### Universal

Open `localhost:6080/vnc_lite.html` in your browser.
Enter the password `f1tenth` when prompted.

*Key combinations may work properly if you use the in browser VNC client*

### Running the Simulator

[DWM Keybindings](https://github.com/FT-Autonomous/dwm) (keybindings for general use in the docker container)

Open a terminal and then type in `source /utils/run-simulator.sh Silverstone`.

Now when you run the simulator you should see the display open in a new window.
## Enabling the Container to display GUIs on the host machine using rocker (Linux)

### Enabling the Container to display GUIs on the host machine (Ubuntu, and other)
Rocker integrates much better with the host machine than a VNC client.

First, install [Rocker](https://github.com/osrf/rocker), then after you have built your image (step 3), run the following command in your Terminal to run the Docker image:

```
rocker [optional: --nvidia or --devices /dev/dri/card0] --x11 docker-ros
rocker [optional: --nvidia or --devices /dev/dri/card0] --x11 <image name>
```
19 changes: 19 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
version: '3'

services:
f1tenth-ros: &f1tenth-ros
user: root
build:
context: .
dockerfile: Dockerfile
stdin_open: true
volumes:
- ./utils:/utils
- ./utils/setup-vnc.sh:/setup.sh
ports:
- 5900:5900
- 6080:6080

f1tenth-ros-vnc:
<<: *f1tenth-ros
entrypoint: /setup.sh
7 changes: 7 additions & 0 deletions utils/setup-vnc.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/bin/sh
export SCREEN=0 DISPLAY=:0 WINDOW_MANAGER=dwm
source /ros_entrypoint.sh
pgrep Xvfb || (rm -fr /tmp/.X* && Xvfb "$DISPLAY" -screen $SCREEN 1280x720x16 -ac -pn -noreset) & sleep 1
pgrep $WINDOW_MANAGER || nohup $WINDOW_MANAGER > /tmp/${WINDOW_MANAGER}.log &
pgrep x11vnc || x11vnc -forever -noxdamage -noxrecord -display $DISPLAY -passwd f1tenth &
pgrep novnc_proxy || ./noVNC/utils/novnc_proxy --vnc localhost:5900 --listen 6080
6 changes: 6 additions & 0 deletions utils/setup-workspace.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
workspace_dir="${1-f1tenth_shared_workspace}/src"
mkdir -p "$workspace_dir"
cd "$workspace_dir"
git clone https://github.com/f1tenth/f1tenth_simulator.git
cd f1tenth_simulator/maps
git init && git pull https://github.com/f1tenth/f1tenth_racetracks