diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000000000000000000000000000000000000..12bea297ce4545d2021f3ed8e4c4f3fac01566d6 --- /dev/null +++ b/.gitignore @@ -0,0 +1,433 @@ +build/ +install/ +log/ +venv/ + + +.DS_Store + +### Folders ### +data/ +lightning_logs/ +wandb/ +/saved_models/ + +### Apptainer ### +*.sif + +### Slurm ### +slurm*.out + +### Files ### +*.csv +*.zip + +### JupyterNotebooks ### +Untitled* + +.ipynb_checkpoints +*/.ipynb_checkpoints/* + +# IPython +profile_default/ +ipython_config.py + +# Remove previous ipynb_checkpoints +# git rm -r .ipynb_checkpoints/ + +### Linux ### +*~ + +# temporary files which can be created if a process still has a handle open of a deleted file +.fuse_hidden* + +# KDE directory preferences +.directory + +# Linux trash folder which might appear on any partition or disk +.Trash-* + +# .nfs files are created when an open file is removed but is still being accessed +.nfs* + +### macOS ### +# General +.DS_Store +.AppleDouble +.LSOverride + +# Icon must end with two \r +Icon + + +# Thumbnails +._* + +# Files that might appear in the root of a volume +.DocumentRevisions-V100 +.fseventsd +.Spotlight-V100 +.TemporaryItems +.Trashes +.VolumeIcon.icns +.com.apple.timemachine.donotpresent + +# Directories potentially created on remote AFP share +.AppleDB +.AppleDesktop +Network Trash Folder +Temporary Items +.apdisk + +### macOS Patch ### +# iCloud generated files +*.icloud + +### PyCharm ### +# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio, WebStorm and Rider +# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839 + +# User-specific stuff +.idea/**/workspace.xml +.idea/**/tasks.xml +.idea/**/usage.statistics.xml +.idea/**/dictionaries +.idea/**/shelf + +# AWS User-specific +.idea/**/aws.xml + +# Generated files +.idea/**/contentModel.xml + +# Sensitive or high-churn files +.idea/**/dataSources/ +.idea/**/dataSources.ids +.idea/**/dataSources.local.xml +.idea/**/sqlDataSources.xml +.idea/**/dynamic.xml +.idea/**/uiDesigner.xml +.idea/**/dbnavigator.xml + +# Gradle +.idea/**/gradle.xml +.idea/**/libraries + +# Gradle and Maven with auto-import +# When using Gradle or Maven with auto-import, you should exclude module files, +# since they will be recreated, and may cause churn. Uncomment if using +# auto-import. +# .idea/artifacts +# .idea/compiler.xml +# .idea/jarRepositories.xml +# .idea/modules.xml +# .idea/*.iml +# .idea/modules +# *.iml +# *.ipr + +# CMake +cmake-build-*/ + +# Mongo Explorer plugin +.idea/**/mongoSettings.xml + +# File-based project format +*.iws + +# IntelliJ +out/ + +# mpeltonen/sbt-idea plugin +.idea_modules/ + +# JIRA plugin +atlassian-ide-plugin.xml + +# Cursive Clojure plugin +.idea/replstate.xml + +# SonarLint plugin +.idea/sonarlint/ + +# Crashlytics plugin (for Android Studio and IntelliJ) +com_crashlytics_export_strings.xml +crashlytics.properties +crashlytics-build.properties +fabric.properties + +# Editor-based Rest Client +.idea/httpRequests + +# Android studio 3.1+ serialized cache file +.idea/caches/build_file_checksums.ser + + +# Sonarlint plugin +# https://plugins.jetbrains.com/plugin/7973-sonarlint +.idea/**/sonarlint/ + +# SonarQube Plugin +# https://plugins.jetbrains.com/plugin/7238-sonarqube-community-plugin +.idea/**/sonarIssues.xml + +# Markdown Navigator plugin +# https://plugins.jetbrains.com/plugin/7896-markdown-navigator-enhanced +.idea/**/markdown-navigator.xml +.idea/**/markdown-navigator-enh.xml +.idea/**/markdown-navigator/ + +# Cache file creation bug +# See https://youtrack.jetbrains.com/issue/JBR-2257 +.idea/$CACHE_FILE$ + +# CodeStream plugin +# https://plugins.jetbrains.com/plugin/12206-codestream +.idea/codestream.xml + +# Azure Toolkit for IntelliJ plugin +# https://plugins.jetbrains.com/plugin/8053-azure-toolkit-for-intellij +.idea/**/azureSettings.xml + +### Python ### +# Byte-compiled / optimized / DLL files +__pycache__/ +*.py[cod] +*$py.class + +# C extensions +*.so + +# Distribution / packaging +.Python +develop-eggs/ +dist/ +downloads/ +eggs/ +.eggs/ +bin/ +share/ +lib/ +lib64/ +parts/ +sdist/ +var/ +wheels/ +share/python-wheels/ +*.egg-info/ +.installed.cfg +*.egg +MANIFEST + +# PyInstaller +# Usually these files are written by a python script from a template +# before PyInstaller builds the exe, so as to inject date/other infos into it. +*.manifest +*.spec + +# Installer logs +pip-log.txt +pip-delete-this-directory.txt + +# Unit test / coverage reports +htmlcov/ +.tox/ +.nox/ +.coverage +.coverage.* +.cache +nosetests.xml +coverage.xml +*.cover +*.py,cover +.hypothesis/ +.pytest_cache/ +cover/ + +# Translations +*.mo +*.pot + +# Django stuff: +*.log +local_settings.py +db.sqlite3 +db.sqlite3-journal + +# Flask stuff: +instance/ +.webassets-cache + +# Scrapy stuff: +.scrapy + +# Sphinx documentation +docs/_build/ + +# PyBuilder +.pybuilder/ +target/ + +# Jupyter Notebook + +# IPython + +# pyenv +# For a library or package, you might want to ignore these files since the code is +# intended to run in multiple environments; otherwise, check them in: +# .python-version + +# pipenv +# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control. +# However, in case of collaboration, if having platform-specific dependencies or dependencies +# having no cross-platform support, pipenv may install dependencies that don't work, or not +# install all needed dependencies. +#Pipfile.lock + +# poetry +# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control. +# This is especially recommended for binary packages to ensure reproducibility, and is more +# commonly ignored for libraries. +# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control +#poetry.lock + +# pdm +# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control. +#pdm.lock +# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it +# in version control. +# https://pdm.fming.dev/#use-with-ide +.pdm.toml + +# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm +__pypackages__/ + +# Celery stuff +celerybeat-schedule +celerybeat.pid + +# SageMath parsed files +*.sage.py + +# Environments +.env +.venv +env/ +venv/ +ENV/ +env.bak/ +venv.bak/ + +# Spyder project settings +.spyderproject +.spyproject + +# Rope project settings +.ropeproject + +# mkdocs documentation +/site + +# mypy +.mypy_cache/ +.dmypy.json +dmypy.json + +# Pyre type checker +.pyre/ + +# pytype static type analyzer +.pytype/ + +# Cython debug symbols +cython_debug/ + +# PyCharm +.idea/ + +### Python Patch ### +# Poetry local configuration file - https://python-poetry.org/docs/configuration/#local-configuration +poetry.toml + +# ruff +.ruff_cache/ + +# LSP config files +pyrightconfig.json + +### Vim ### +# Swap +[._]*.s[a-v][a-z] +!*.svg # comment out if you don't need vector files +[._]*.sw[a-p] +[._]s[a-rt-v][a-z] +[._]ss[a-gi-z] +[._]sw[a-p] + +# Session +Session.vim +Sessionx.vim + +# Temporary +.netrwhist +# Auto-generated tag files +tags +# Persistent undo +[._]*.un~ + +### VirtualEnv ### +# Virtualenv +# http://iamzed.com/2009/05/07/a-primer-on-virtualenv/ +[Bb]in +[Ii]nclude +[Ll]ib +[Ll]ib64 +[Ll]ocal +[Ss]cripts +pyvenv.cfg +pip-selfcheck.json + +### VisualStudioCode ### +.vscode/* +!.vscode/settings.json +!.vscode/tasks.json +!.vscode/launch.json +!.vscode/extensions.json +!.vscode/*.code-snippets + +# Local History for Visual Studio Code +.history/ + +# Built Visual Studio Code Extensions +*.vsix + +### VisualStudioCode Patch ### +# Ignore all local history of files +.history +.ionide + +### Windows ### +# Windows thumbnail cache files +Thumbs.db +Thumbs.db:encryptable +ehthumbs.db +ehthumbs_vista.db + +# Dump file +*.stackdump + +# Folder config file +[Dd]esktop.ini + +# Recycle Bin used on file shares +$RECYCLE.BIN/ + +# Windows Installer files +*.cab +*.msi +*.msix +*.msm +*.msp + +# Windows shortcuts +*.lnk diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..47f2851eba9a91885fb468ebb219eb603deb6c10 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,42 @@ +# Use an official ROS2 Humble base image +FROM osrf/ros:humble-desktop + +# Set environment variables +ENV LANG=C.UTF-8 \ + LC_ALL=C.UTF-8 \ + ROS_DISTRO=humble + +# Install necessary dependencies for vcs import and ROS workspace +RUN apt-get update && apt-get install -y \ + python3-colcon-common-extensions \ + python3-rosdep \ + python3-pip \ + && rm -rf /var/lib/apt/lists/* + +# Initialize rosdep only if it hasn't been initialized already +RUN if [ ! -f /etc/ros/rosdep/sources.list.d/20-default.list ]; then \ + rosdep init; \ + fi && rosdep update + +# Create the workspace directory +WORKDIR /ros_ws + +# Copy the source code +COPY src ./src + +# Install any dependencies specified in package.xml +RUN apt-get update && rosdep install --from-paths src --ignore-src -r -y + +# Build the workspace +RUN . /opt/ros/humble/setup.sh && colcon build + +# Source the setup script for future container sessions +RUN echo "source /opt/ros/humble/setup.bash" >> ~/.bashrc +RUN echo "source /ros_ws/install/setup.bash" >> ~/.bashrc + +# Copy and install Python dependencies +# COPY requirements.txt requirements.txt +# RUN pip3 install -r requirements.txt + +# Default command to run when container starts +CMD ["bash", "-c", "source /opt/ros/humble/setup.bash && source /ros_ws/install/setup.bash && exec bash"] \ No newline at end of file diff --git a/build.sh b/build.sh new file mode 100755 index 0000000000000000000000000000000000000000..5af7d6caaba75a5ad08ff021090fe12be5498adf --- /dev/null +++ b/build.sh @@ -0,0 +1 @@ +docker build -t minimal . diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000000000000000000000000000000000000..7e388828f9d989e7e2610b564212017cf801321b --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,25 @@ +version: '3' +services: + ros: + build: . + volumes: + - "./src:/ros_ws/src" + command: tail -f /dev/null + environment: + - DISPLAY=novnc:0.0 + depends_on: + - novnc + networks: + - x11 + novnc: + image: theasp/novnc:latest + environment: + - DISPLAY_WIDTH=1600 + - DISPLAY_HEIGHT=968 + ports: + - "8080:8080" + networks: + - x11 +networks: + x11: + driver: bridge \ No newline at end of file diff --git a/run_lin.sh b/run_lin.sh new file mode 100755 index 0000000000000000000000000000000000000000..e977661c7b68568102a9178eafb6b07af1be994c --- /dev/null +++ b/run_lin.sh @@ -0,0 +1,13 @@ +#!/bin/bash + +# xhost +local:root + +docker run -it \ + --mount type=bind,src="$(pwd)"/src,target=/ros_ws/src \ + --net=host \ + --env="DISPLAY=$DISPLAY" \ + --env="QT_X11_NO_MITSHM=1" \ + --volume="$HOME/.Xauthority:/root/.Xauthority:rw" \ + minimal:latest bash + + diff --git a/run_win.bat b/run_win.bat new file mode 100644 index 0000000000000000000000000000000000000000..a3f4f53190e67b8280506fdebc2a9b19a6c45dbe --- /dev/null +++ b/run_win.bat @@ -0,0 +1,33 @@ +@ECHO OFF +:: This is a batch file to run Docker container and setup necessary variables. +TITLE Run Cascar container + +ECHO Please wait... Setting up environment +:: Section 1: Setup +ECHO ========================== +ECHO NETWORK INFO +ECHO ============================ +ipconfig | findstr IPv4 + +SET ip_address_string="IPv4 Address" +for /f "usebackq tokens=2 delims=:" %%f in (`ipconfig ^| findstr /c:%ip_address_string%`) do ( + ECHO Using IP Address: %%f to forward Docker GUI + SET DispIP=%%f:0.0 + GOTO :end_loop +) + +:end_loop + set DispIP=%DispIP:~1% + + +:: Section 2: Docker +ECHO ========================== +ECHO RUN DOCKER CONTAINER +ECHO ============================ +ECHO docker run -ti --rm -e DISPLAY=%DispIP% --net=host --name ros-env -v %cd%/src:/ros_ws/src minimal +:: Command line version +docker run -ti --rm -e DISPLAY=%DispIP% --net=host --name ros-env -v %cd%/src:/ros_ws/src minimal + + +:: Powershell Version +:: docker run -ti --rm -e DISPLAY=%DispIP% --net=host --name ros-env -v ${PWD}/src:/ros_ws/src minimal \ No newline at end of file diff --git a/src/LICENSE b/src/LICENSE new file mode 100644 index 0000000000000000000000000000000000000000..e389cab541f9e6959e72e8d04d506318483fc82a --- /dev/null +++ b/src/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2021 Theodor Westny + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE.