From 7d239734523a670fe28017d6f919eeeecf26d552 Mon Sep 17 00:00:00 2001 From: Krish-Mathur <39839303+Krish-Mathur@users.noreply.github.com> Date: Wed, 3 Jul 2024 21:39:30 -0400 Subject: [PATCH 1/7] Update README.md --- README.md | 100 +++++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 99 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index b8b6790..1b74aa1 100644 --- a/README.md +++ b/README.md @@ -1 +1,99 @@ -# Collaborative-Autonomous-Multi-Agent-SLAM \ No newline at end of file +# Collaborative-Autonomous-Multi-Agent-SLAM +## Table of Contents +- [Setup Development Environment](#setup-development-environment) + - [ROS](#ros) + - [Gazebo](#gazebo) + - [Python](#python) +- [Troubleshooting Help](#troubleshooting-help) +- [Interacting with the Platform](#interacting-with-the-platform) +- [Resources](#resources) + +## Setup Development Environment + +### ROS +To set up the ROS environment, follow these steps: + +1. **Install ROS** + - Open the "x64 Native Tools Command Prompt for VS 2019" as Administrator. + - Install Chocolatey package manager: + ```sh + @"%SystemRoot%\System32\WindowsPowerShell\v1.0\powershell.exe" -NoProfile -InputFormat None -ExecutionPolicy Bypass -Command "iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))" && SET "PATH=%PATH%;%ALLUSERSPROFILE%\chocolatey\bin" + ``` + - Install Git: + ```sh + choco upgrade git -y + ``` + - Install ROS: + ```sh + mkdir c:\opt\chocolatey + set ChocolateyInstall=c:\opt\chocolatey + choco source add -n=ros-win -s="https://aka.ms/ros/public" --priority=1 + choco upgrade ros-noetic-desktop_full -y --execution-timeout=0 + ``` + +2. **Source the ROS Environment** + - Open the Visual Studio Command Prompt as Administrator. + - Source the setup script: + ```sh + c:\opt\ros\noetic\x64\setup.bat + ``` + +3. **Verify the ROS Installation** + - Check the ROS version: + ```sh + rosversion -d + ``` + +For more detailed instructions, refer to the [Installing and Configuring Your ROS Environment](https://wiki.ros.org/ROS/Tutorials/InstallingandConfiguringROSEnvironment) tutorial. + +### Gazebo +To set up Gazebo, follow these steps: + +1. **Install Gazebo** + - Use the ROS package manager to install Gazebo: + ```sh + sudo apt-get install ros-noetic-gazebo-ros-pkgs ros-noetic-gazebo-ros-control + ``` + +2. **Verify the Gazebo Installation** + - Run Gazebo to ensure it's installed correctly: + ```sh + gazebo + ``` + +### Python +To set up Python for ROS: + +1. **Install Python** + - Download and install Python from the [official website](https://www.python.org/downloads/). + +2. **Install ROS Python Dependencies** + - Install the necessary Python packages for ROS: + ```sh + pip install -U rosdep rosinstall_generator wstool rosinstall six vcstools + ``` + +## Troubleshooting Help +If you encounter issues during setup, here are some common troubleshooting steps: + +- Ensure all paths are correctly set in your environment variables. +- Verify that you are running the commands in the appropriate shell (e.g., Visual Studio Command Prompt for VS 2019). +- Check for any typos or syntax errors in the commands. +- Refer to the [ROS Troubleshooting Guide](https://wiki.ros.org/ROS/Installation/Windows#Troubleshooting). + +## Interacting with the Platform +To start working with the platform, follow these steps: + +1. **Create a Catkin Workspace** + ```sh + mkdir -p ~/catkin_ws/src + cd ~/catkin_ws/ + catkin_make + source devel/setup.bash + cd ~/catkin_ws/src + catkin_create_pkg my_package std_msgs rospy roscpp + cd ~/catkin_ws + catkin_make + + + From 3dc591f112940ba4e9ec8176e23bc54cb09130a4 Mon Sep 17 00:00:00 2001 From: Ziyan Ishani Date: Tue, 17 Sep 2024 19:30:16 -0400 Subject: [PATCH 2/7] Updated Dockerfile Works for ROS packages, still needs GUI --- .gitignore | 18 +++++++++++++ .gitmodules | 4 +++ src/.devcontainer/Dockerfile | 42 +++++++++++++++++++++++++++++ src/.devcontainer/devcontainer.json | 42 +++++++++++++++++++++++++++++ 4 files changed, 106 insertions(+) create mode 100644 .gitignore create mode 100644 .gitmodules create mode 100644 src/.devcontainer/Dockerfile create mode 100644 src/.devcontainer/devcontainer.json diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..b405a01 --- /dev/null +++ b/.gitignore @@ -0,0 +1,18 @@ +# Exclude build artifacts and logs +/cache/ +*.log + +# Exclude other potential build artifacts +*.o +*.a +*.so + +# Exclude IDE and system-specific files +*.swp +*.swo +.DS_Store +*.pyc +*.pyo + +# Exclude local configuration files +*.env diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000..9198c85 --- /dev/null +++ b/.gitmodules @@ -0,0 +1,4 @@ +[submodule "src/turtlebot3_simulations"] + path = src/turtlebot3_simulations + url = https://github.com/ROBOTIS-GIT/turtlebot3_simulations.git + branch = humble-devel diff --git a/src/.devcontainer/Dockerfile b/src/.devcontainer/Dockerfile new file mode 100644 index 0000000..77f6f6d --- /dev/null +++ b/src/.devcontainer/Dockerfile @@ -0,0 +1,42 @@ +# Use the official ROS Humble base image +FROM ros:humble +# Set arguments for the user creation +ARG USERNAME=ziyan +ARG USER_UID=1000 +ARG USER_GID=$USER_UID +# Switch to root to install packages +USER root +# Install necessary packages including X11 and Qt dependencies +RUN apt-get update && apt-get install -y \ + sudo \ + python3-pip \ + ros-humble-desktop \ + ros-humble-gazebo-* \ + ros-humble-cartographer \ + ros-humble-cartographer-ros \ + ros-humble-navigation2 \ + ros-humble-nav2-bringup \ + libxcb-xinerama0 \ + x11-apps \ + libgl1-mesa-glx \ + libqt5gui5 \ + && rm -rf /var/lib/apt/lists/* +# Create the user +RUN groupadd --gid $USER_GID $USERNAME \ + && useradd --uid $USER_UID --gid $USER_GID -m $USERNAME \ + && echo $USERNAME ALL=\(root\) NOPASSWD:ALL > /etc/sudoers.d/$USERNAME \ + && chmod 0440 /etc/sudoers.d/$USERNAME +# Set the default shell +ENV SHELL /bin/bash +# Set environment variables for GUI support +ENV DISPLAY=:0 +ENV QT_X11_NO_MITSHM=1 +ENV XDG_RUNTIME_DIR=/tmp/runtime-$USERNAME +# Set the working directory +WORKDIR /home/$USERNAME +# Source ROS environment in .bashrc +RUN echo "source /opt/ros/humble/setup.bash" >> /home/$USERNAME/.bashrc +# Switch to the new user +USER $USERNAME +# Set the default command +CMD ["/bin/bash"] diff --git a/src/.devcontainer/devcontainer.json b/src/.devcontainer/devcontainer.json new file mode 100644 index 0000000..7f5f8e6 --- /dev/null +++ b/src/.devcontainer/devcontainer.json @@ -0,0 +1,42 @@ +{ + "name": "ROS 2 Development Container", + "privileged": true, + "remoteUser": "krish", + "build": { + "dockerfile": "Dockerfile", + "args": { + "USERNAME": "krish" + } + }, + "workspaceFolder": "/home/CAM-SLAM", + "workspaceMount": "source=${localWorkspaceFolder},target=/home/CAM-SLAM/src,type=bind", + "customizations": { + "vscode": { + "extensions":[ + "ms-vscode.cpptools", + "ms-vscode.cpptools-themes", + "twxs.cmake", + "donjayamanne.python-extension-pack", + "eamodio.gitlens", + "ms-iot.vscode-ros" + ] + } + }, + "containerEnv": { + "DISPLAY": "unix:0", + "ROS_LOCALHOST_ONLY": "1", + "ROS_DOMAIN_ID": "42" + }, + "runArgs": [ + "--net=host", + "-e", "DISPLAY=${env:DISPLAY}" + ], + "mounts": [ + "source=/tmp/.X11-unix,target=/tmp/.X11-unix,type=bind,consistency=cached", + "source=/dev/dri,target=/dev/dri,type=bind,consistency=cached", + "source=${localWorkspaceFolder}/../cache/build,target=/home/ws/build,type=bind", + "source=${localWorkspaceFolder}/../cache/install,target=/home/ws/install,type=bind", + "source=${localWorkspaceFolder}/../cache/log,target=/home/ws/log,type=bind" + ], + "postCreateCommand": "sudo rosdep update && sudo rosdep install --from-paths src --ignore-src -y && sudo chown -R USERNAME /home/ws/" +} From 2d0a7f8912d4aa21a0cbc6ae2bf3c0c1a3c5a8c9 Mon Sep 17 00:00:00 2001 From: Krish-Mathur Date: Tue, 1 Oct 2024 18:59:06 -0400 Subject: [PATCH 3/7] update dockerfile praying it works --- src/.devcontainer/Dockerfile | 30 +++++++++++++++++++++--------- 1 file changed, 21 insertions(+), 9 deletions(-) diff --git a/src/.devcontainer/Dockerfile b/src/.devcontainer/Dockerfile index 77f6f6d..fd0e9ba 100644 --- a/src/.devcontainer/Dockerfile +++ b/src/.devcontainer/Dockerfile @@ -1,42 +1,54 @@ # Use the official ROS Humble base image FROM ros:humble -# Set arguments for the user creation -ARG USERNAME=ziyan + +# Set arguments for user creation +ARG USERNAME=krish ARG USER_UID=1000 ARG USER_GID=$USER_UID + # Switch to root to install packages USER root + # Install necessary packages including X11 and Qt dependencies RUN apt-get update && apt-get install -y \ sudo \ python3-pip \ ros-humble-desktop \ - ros-humble-gazebo-* \ + ros-humble-gz \ ros-humble-cartographer \ ros-humble-cartographer-ros \ ros-humble-navigation2 \ ros-humble-nav2-bringup \ - libxcb-xinerama0 \ + ros-humble-rviz2 \ + mesa-utils \ x11-apps \ - libgl1-mesa-glx \ - libqt5gui5 \ && rm -rf /var/lib/apt/lists/* + # Create the user RUN groupadd --gid $USER_GID $USERNAME \ && useradd --uid $USER_UID --gid $USER_GID -m $USERNAME \ - && echo $USERNAME ALL=\(root\) NOPASSWD:ALL > /etc/sudoers.d/$USERNAME \ + && echo "$USERNAME ALL=(ALL) NOPASSWD:ALL" > /etc/sudoers.d/$USERNAME \ && chmod 0440 /etc/sudoers.d/$USERNAME + # Set the default shell ENV SHELL /bin/bash + # Set environment variables for GUI support -ENV DISPLAY=:0 +ENV DISPLAY=$DISPLAY +ENV LIBGL_ALWAYS_INDIRECT=1 ENV QT_X11_NO_MITSHM=1 -ENV XDG_RUNTIME_DIR=/tmp/runtime-$USERNAME + +# Grant access to the X server (on host, not needed if using Xming or VcXsrv with no access control) +RUN apt-get install -y xauth + # Set the working directory WORKDIR /home/$USERNAME + # Source ROS environment in .bashrc RUN echo "source /opt/ros/humble/setup.bash" >> /home/$USERNAME/.bashrc + # Switch to the new user USER $USERNAME + # Set the default command CMD ["/bin/bash"] From 67ffe16f1e37631cbe8e884befb86c0d173a78be Mon Sep 17 00:00:00 2001 From: Krish-Mathur Date: Tue, 1 Oct 2024 19:20:06 -0400 Subject: [PATCH 4/7] fix? fix --- src/.devcontainer/Dockerfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/.devcontainer/Dockerfile b/src/.devcontainer/Dockerfile index fd0e9ba..40475cc 100644 --- a/src/.devcontainer/Dockerfile +++ b/src/.devcontainer/Dockerfile @@ -9,12 +9,12 @@ ARG USER_GID=$USER_UID # Switch to root to install packages USER root -# Install necessary packages including X11 and Qt dependencies +## Install necessary packages including X11 and Qt dependencies RUN apt-get update && apt-get install -y \ sudo \ python3-pip \ ros-humble-desktop \ - ros-humble-gz \ + ros-humble-gazebo-ros-pkgs \ ros-humble-cartographer \ ros-humble-cartographer-ros \ ros-humble-navigation2 \ From 4550c03f89eb8367fb418aedf35058101a09e055 Mon Sep 17 00:00:00 2001 From: Krish-Mathur Date: Wed, 2 Oct 2024 05:17:07 -0400 Subject: [PATCH 5/7] Trying for mac Gui showed black screen but is it bc of school laptop ? --- src/.devcontainer/Dockerfile | 52 +++++++++++++++++++++++------------- 1 file changed, 34 insertions(+), 18 deletions(-) diff --git a/src/.devcontainer/Dockerfile b/src/.devcontainer/Dockerfile index 40475cc..aa70739 100644 --- a/src/.devcontainer/Dockerfile +++ b/src/.devcontainer/Dockerfile @@ -1,27 +1,46 @@ # Use the official ROS Humble base image FROM ros:humble - # Set arguments for user creation ARG USERNAME=krish ARG USER_UID=1000 ARG USER_GID=$USER_UID - # Switch to root to install packages USER root - -## Install necessary packages including X11 and Qt dependencies RUN apt-get update && apt-get install -y \ + curl \ + && curl -sSL 'http://packages.ros.org/ros.key' | apt-key add - \ + && echo "deb http://packages.ros.org/ros2/ubuntu jammy main" > /etc/apt/sources.list.d/ros2-latest.list \ + && apt-get update +# Set up the ROS 2 repository +RUN apt-get update && apt-get install -y --no-install-recommends \ + build-essential \ + cmake \ + git \ sudo \ python3-pip \ + mesa-utils \ + x11-apps \ + xorg \ + xorg-dev \ + openbox \ + xauth \ + mesa-common-dev \ + libglu1-mesa-dev \ + libgl1-mesa-glx \ + libgl1-mesa-dri \ + libturbojpeg-dev \ + libxtst-dev \ + opencl-headers \ + ocl-icd-opencl-dev \ + libxcb-keysyms1-dev \ ros-humble-desktop \ - ros-humble-gazebo-ros-pkgs \ ros-humble-cartographer \ ros-humble-cartographer-ros \ ros-humble-navigation2 \ ros-humble-nav2-bringup \ ros-humble-rviz2 \ - mesa-utils \ - x11-apps \ + x11-xserver-utils \ + && apt-get clean \ && rm -rf /var/lib/apt/lists/* # Create the user @@ -29,26 +48,23 @@ RUN groupadd --gid $USER_GID $USERNAME \ && useradd --uid $USER_UID --gid $USER_GID -m $USERNAME \ && echo "$USERNAME ALL=(ALL) NOPASSWD:ALL" > /etc/sudoers.d/$USERNAME \ && chmod 0440 /etc/sudoers.d/$USERNAME - # Set the default shell ENV SHELL /bin/bash - # Set environment variables for GUI support -ENV DISPLAY=$DISPLAY +#ENV DISPLAY=$DISPLAY +ENV DISPLAY=host.docker.internal:0 ENV LIBGL_ALWAYS_INDIRECT=1 +# Enable software rendering +#ENV LIBGL_ALWAYS_SOFTWARE=1 ENV QT_X11_NO_MITSHM=1 - -# Grant access to the X server (on host, not needed if using Xming or VcXsrv with no access control) -RUN apt-get install -y xauth - +ENV QT_QPA_PLATFORM=xcb +# Grant access to the X server +#RUN apt-get install -y xauth # Set the working directory WORKDIR /home/$USERNAME - # Source ROS environment in .bashrc RUN echo "source /opt/ros/humble/setup.bash" >> /home/$USERNAME/.bashrc - # Switch to the new user USER $USERNAME - # Set the default command -CMD ["/bin/bash"] +CMD ["/bin/bash"] \ No newline at end of file From 4897bdd5466b6b209cf27a7e888e2a8878fdf22b Mon Sep 17 00:00:00 2001 From: Krish-Mathur Date: Thu, 3 Oct 2024 01:03:29 -0400 Subject: [PATCH 6/7] changes need to use realvnc viewer --- src/.devcontainer/Dockerfile | 103 ++++++++++++++++++--------------- src/.devcontainer/start_vnc.sh | 11 ++++ 2 files changed, 68 insertions(+), 46 deletions(-) create mode 100644 src/.devcontainer/start_vnc.sh diff --git a/src/.devcontainer/Dockerfile b/src/.devcontainer/Dockerfile index aa70739..89b242c 100644 --- a/src/.devcontainer/Dockerfile +++ b/src/.devcontainer/Dockerfile @@ -1,70 +1,81 @@ # Use the official ROS Humble base image FROM ros:humble -# Set arguments for user creation + +# Set arguments for user creation and VNC password ARG USERNAME=krish ARG USER_UID=1000 ARG USER_GID=$USER_UID +ARG VNC_PASSWORD=vncpassword + # Switch to root to install packages USER root -RUN apt-get update && apt-get install -y \ - curl \ - && curl -sSL 'http://packages.ros.org/ros.key' | apt-key add - \ - && echo "deb http://packages.ros.org/ros2/ubuntu jammy main" > /etc/apt/sources.list.d/ros2-latest.list \ - && apt-get update -# Set up the ROS 2 repository -RUN apt-get update && apt-get install -y --no-install-recommends \ - build-essential \ - cmake \ - git \ - sudo \ - python3-pip \ - mesa-utils \ - x11-apps \ - xorg \ - xorg-dev \ - openbox \ - xauth \ - mesa-common-dev \ - libglu1-mesa-dev \ - libgl1-mesa-glx \ - libgl1-mesa-dri \ - libturbojpeg-dev \ - libxtst-dev \ - opencl-headers \ - ocl-icd-opencl-dev \ - libxcb-keysyms1-dev \ - ros-humble-desktop \ - ros-humble-cartographer \ - ros-humble-cartographer-ros \ - ros-humble-navigation2 \ - ros-humble-nav2-bringup \ - ros-humble-rviz2 \ - x11-xserver-utils \ - && apt-get clean \ - && rm -rf /var/lib/apt/lists/* # Create the user RUN groupadd --gid $USER_GID $USERNAME \ && useradd --uid $USER_UID --gid $USER_GID -m $USERNAME \ && echo "$USERNAME ALL=(ALL) NOPASSWD:ALL" > /etc/sudoers.d/$USERNAME \ && chmod 0440 /etc/sudoers.d/$USERNAME + +# Update and install necessary packages +RUN apt-get update && apt-get install -y \ + curl build-essential cmake git sudo python3-pip x11vnc mesa-utils \ + libgl1-mesa-dri libgl1-mesa-glx libglu1-mesa-dev x11-apps xorg xorg-dev \ + openbox xauth libxtst-dev libxcb-keysyms1-dev \ + ros-humble-desktop ros-humble-cartographer ros-humble-cartographer-ros \ + ros-humble-navigation2 ros-humble-nav2-bringup ros-humble-rviz2 \ + libosmesa6-dev wget \ + xvfb fluxbox x11vnc net-tools \ + && apt-get clean \ + && rm -rf /var/lib/apt/lists/* + +# Create X11 socket directory +RUN mkdir -p /tmp/.X11-unix && chmod 1777 /tmp/.X11-unix +RUN touch /home/$USERNAME/.Xauthority && \ + chown $USERNAME:$USERNAME /home/$USERNAME/.Xauthority + +# Set up VNC password +RUN mkdir -p /home/$USERNAME/.vnc && \ + x11vnc -storepasswd $VNC_PASSWORD /home/$USERNAME/.vnc/passwd && \ + chmod 600 /home/$USERNAME/.vnc/passwd && \ + chown -R $USERNAME:$USERNAME /home/$USERNAME/.vnc + +# Create Fluxbox configuration +RUN mkdir -p /home/$USERNAME/.fluxbox && \ + echo "[begin] (Fluxbox)" > /home/$USERNAME/.fluxbox/menu && \ + echo "[exec] (Terminal) {x-terminal-emulator}" >> /home/$USERNAME/.fluxbox/menu && \ + echo "[exit] (Exit)" >> /home/$USERNAME/.fluxbox/menu && \ + echo "[end]" >> /home/$USERNAME/.fluxbox/menu && \ + touch /home/$USERNAME/.fluxbox/init && \ + touch /home/$USERNAME/.fluxbox/keys && \ + chown -R $USERNAME:$USERNAME /home/$USERNAME/.fluxbox + +# Add a script to start VNC server +COPY start_vnc.sh /start_vnc.sh +RUN chmod +x /start_vnc.sh + # Set the default shell -ENV SHELL /bin/bash +ENV SHELL=/bin/bash + # Set environment variables for GUI support -#ENV DISPLAY=$DISPLAY -ENV DISPLAY=host.docker.internal:0 +ENV DISPLAY=:0 ENV LIBGL_ALWAYS_INDIRECT=1 -# Enable software rendering -#ENV LIBGL_ALWAYS_SOFTWARE=1 +ENV LIBGL_ALWAYS_SOFTWARE=1 +ENV GALLIUM_DRIVER=llvmpipe +ENV MESA_GL_VERSION_OVERRIDE=3.3 ENV QT_X11_NO_MITSHM=1 ENV QT_QPA_PLATFORM=xcb -# Grant access to the X server -#RUN apt-get install -y xauth + # Set the working directory WORKDIR /home/$USERNAME + # Source ROS environment in .bashrc RUN echo "source /opt/ros/humble/setup.bash" >> /home/$USERNAME/.bashrc + +# Expose VNC port +EXPOSE 5900 + # Switch to the new user USER $USERNAME -# Set the default command -CMD ["/bin/bash"] \ No newline at end of file + +# Set the default command to start VNC +CMD ["/start_vnc.sh"] \ No newline at end of file diff --git a/src/.devcontainer/start_vnc.sh b/src/.devcontainer/start_vnc.sh new file mode 100644 index 0000000..1439b17 --- /dev/null +++ b/src/.devcontainer/start_vnc.sh @@ -0,0 +1,11 @@ +#!/bin/bash +# Ensure Xvfb is launched on display :0 +export DISPLAY=:0 +Xvfb :0 -screen 0 1280x1024x24 > /tmp/xvfb.log 2>&1 & +sleep 2 +# Start Fluxbox window manager +fluxbox & +# Start VNC server on display :0 +x11vnc -display :0 -forever -usepw -create > /tmp/x11vnc.log 2>&1 & +# Keep the container running +tail -f /dev/null From 858cc6ccca7efea1feced4976bc5c234cd00ed08 Mon Sep 17 00:00:00 2001 From: Krish-Mathur Date: Mon, 28 Oct 2024 20:07:04 -0400 Subject: [PATCH 7/7] tsinghua --- src/.devcontainer/Dockerfile | 81 ----------------------------- src/.devcontainer/devcontainer.json | 42 --------------- src/.devcontainer/start_vnc.sh | 11 ---- src/rviz-mac/Dockerfile | 53 +++++++++++++++++++ src/rviz-mac/conf.d/fluxbox.conf | 3 ++ src/rviz-mac/conf.d/websockify.conf | 3 ++ src/rviz-mac/conf.d/x11vnc.conf | 3 ++ src/rviz-mac/conf.d/xterm.conf | 3 ++ src/rviz-mac/conf.d/xvfb.conf | 3 ++ src/rviz-mac/entrypoint.sh | 19 +++++++ src/rviz-mac/supervisord.conf | 5 ++ 11 files changed, 92 insertions(+), 134 deletions(-) delete mode 100644 src/.devcontainer/Dockerfile delete mode 100644 src/.devcontainer/devcontainer.json delete mode 100644 src/.devcontainer/start_vnc.sh create mode 100644 src/rviz-mac/Dockerfile create mode 100644 src/rviz-mac/conf.d/fluxbox.conf create mode 100644 src/rviz-mac/conf.d/websockify.conf create mode 100644 src/rviz-mac/conf.d/x11vnc.conf create mode 100644 src/rviz-mac/conf.d/xterm.conf create mode 100644 src/rviz-mac/conf.d/xvfb.conf create mode 100644 src/rviz-mac/entrypoint.sh create mode 100644 src/rviz-mac/supervisord.conf diff --git a/src/.devcontainer/Dockerfile b/src/.devcontainer/Dockerfile deleted file mode 100644 index 89b242c..0000000 --- a/src/.devcontainer/Dockerfile +++ /dev/null @@ -1,81 +0,0 @@ -# Use the official ROS Humble base image -FROM ros:humble - -# Set arguments for user creation and VNC password -ARG USERNAME=krish -ARG USER_UID=1000 -ARG USER_GID=$USER_UID -ARG VNC_PASSWORD=vncpassword - -# Switch to root to install packages -USER root - -# Create the user -RUN groupadd --gid $USER_GID $USERNAME \ - && useradd --uid $USER_UID --gid $USER_GID -m $USERNAME \ - && echo "$USERNAME ALL=(ALL) NOPASSWD:ALL" > /etc/sudoers.d/$USERNAME \ - && chmod 0440 /etc/sudoers.d/$USERNAME - -# Update and install necessary packages -RUN apt-get update && apt-get install -y \ - curl build-essential cmake git sudo python3-pip x11vnc mesa-utils \ - libgl1-mesa-dri libgl1-mesa-glx libglu1-mesa-dev x11-apps xorg xorg-dev \ - openbox xauth libxtst-dev libxcb-keysyms1-dev \ - ros-humble-desktop ros-humble-cartographer ros-humble-cartographer-ros \ - ros-humble-navigation2 ros-humble-nav2-bringup ros-humble-rviz2 \ - libosmesa6-dev wget \ - xvfb fluxbox x11vnc net-tools \ - && apt-get clean \ - && rm -rf /var/lib/apt/lists/* - -# Create X11 socket directory -RUN mkdir -p /tmp/.X11-unix && chmod 1777 /tmp/.X11-unix -RUN touch /home/$USERNAME/.Xauthority && \ - chown $USERNAME:$USERNAME /home/$USERNAME/.Xauthority - -# Set up VNC password -RUN mkdir -p /home/$USERNAME/.vnc && \ - x11vnc -storepasswd $VNC_PASSWORD /home/$USERNAME/.vnc/passwd && \ - chmod 600 /home/$USERNAME/.vnc/passwd && \ - chown -R $USERNAME:$USERNAME /home/$USERNAME/.vnc - -# Create Fluxbox configuration -RUN mkdir -p /home/$USERNAME/.fluxbox && \ - echo "[begin] (Fluxbox)" > /home/$USERNAME/.fluxbox/menu && \ - echo "[exec] (Terminal) {x-terminal-emulator}" >> /home/$USERNAME/.fluxbox/menu && \ - echo "[exit] (Exit)" >> /home/$USERNAME/.fluxbox/menu && \ - echo "[end]" >> /home/$USERNAME/.fluxbox/menu && \ - touch /home/$USERNAME/.fluxbox/init && \ - touch /home/$USERNAME/.fluxbox/keys && \ - chown -R $USERNAME:$USERNAME /home/$USERNAME/.fluxbox - -# Add a script to start VNC server -COPY start_vnc.sh /start_vnc.sh -RUN chmod +x /start_vnc.sh - -# Set the default shell -ENV SHELL=/bin/bash - -# Set environment variables for GUI support -ENV DISPLAY=:0 -ENV LIBGL_ALWAYS_INDIRECT=1 -ENV LIBGL_ALWAYS_SOFTWARE=1 -ENV GALLIUM_DRIVER=llvmpipe -ENV MESA_GL_VERSION_OVERRIDE=3.3 -ENV QT_X11_NO_MITSHM=1 -ENV QT_QPA_PLATFORM=xcb - -# Set the working directory -WORKDIR /home/$USERNAME - -# Source ROS environment in .bashrc -RUN echo "source /opt/ros/humble/setup.bash" >> /home/$USERNAME/.bashrc - -# Expose VNC port -EXPOSE 5900 - -# Switch to the new user -USER $USERNAME - -# Set the default command to start VNC -CMD ["/start_vnc.sh"] \ No newline at end of file diff --git a/src/.devcontainer/devcontainer.json b/src/.devcontainer/devcontainer.json deleted file mode 100644 index 7f5f8e6..0000000 --- a/src/.devcontainer/devcontainer.json +++ /dev/null @@ -1,42 +0,0 @@ -{ - "name": "ROS 2 Development Container", - "privileged": true, - "remoteUser": "krish", - "build": { - "dockerfile": "Dockerfile", - "args": { - "USERNAME": "krish" - } - }, - "workspaceFolder": "/home/CAM-SLAM", - "workspaceMount": "source=${localWorkspaceFolder},target=/home/CAM-SLAM/src,type=bind", - "customizations": { - "vscode": { - "extensions":[ - "ms-vscode.cpptools", - "ms-vscode.cpptools-themes", - "twxs.cmake", - "donjayamanne.python-extension-pack", - "eamodio.gitlens", - "ms-iot.vscode-ros" - ] - } - }, - "containerEnv": { - "DISPLAY": "unix:0", - "ROS_LOCALHOST_ONLY": "1", - "ROS_DOMAIN_ID": "42" - }, - "runArgs": [ - "--net=host", - "-e", "DISPLAY=${env:DISPLAY}" - ], - "mounts": [ - "source=/tmp/.X11-unix,target=/tmp/.X11-unix,type=bind,consistency=cached", - "source=/dev/dri,target=/dev/dri,type=bind,consistency=cached", - "source=${localWorkspaceFolder}/../cache/build,target=/home/ws/build,type=bind", - "source=${localWorkspaceFolder}/../cache/install,target=/home/ws/install,type=bind", - "source=${localWorkspaceFolder}/../cache/log,target=/home/ws/log,type=bind" - ], - "postCreateCommand": "sudo rosdep update && sudo rosdep install --from-paths src --ignore-src -y && sudo chown -R USERNAME /home/ws/" -} diff --git a/src/.devcontainer/start_vnc.sh b/src/.devcontainer/start_vnc.sh deleted file mode 100644 index 1439b17..0000000 --- a/src/.devcontainer/start_vnc.sh +++ /dev/null @@ -1,11 +0,0 @@ -#!/bin/bash -# Ensure Xvfb is launched on display :0 -export DISPLAY=:0 -Xvfb :0 -screen 0 1280x1024x24 > /tmp/xvfb.log 2>&1 & -sleep 2 -# Start Fluxbox window manager -fluxbox & -# Start VNC server on display :0 -x11vnc -display :0 -forever -usepw -create > /tmp/x11vnc.log 2>&1 & -# Keep the container running -tail -f /dev/null diff --git a/src/rviz-mac/Dockerfile b/src/rviz-mac/Dockerfile new file mode 100644 index 0000000..41d3b2d --- /dev/null +++ b/src/rviz-mac/Dockerfile @@ -0,0 +1,53 @@ +# Use the official ROS Humble base image +FROM ros:humble +# Update apt sources to use Tsinghua mirrors +RUN sed -i 's/ports\.ubuntu\.com/mirrors\.tuna\.tsinghua\.edu\.cn/g' /etc/apt/sources.list && \ + sed -i 's/packages\.ros\.org/mirrors\.tuna\.tsinghua\.edu\.cn/g' /etc/apt/sources.list.d/ros2-latest.list +# Install necessary packages +RUN apt-get update && apt-get install -y \ + iputils-ping \ + net-tools \ + wget \ + sudo \ + python3-pip \ + mesa-utils \ + mesa-utils-extra \ + ros-humble-desktop \ + ros-humble-cartographer \ + ros-humble-cartographer-ros \ + ros-humble-navigation2 \ + ros-humble-nav2-bringup \ + ros-humble-rviz2 \ + bash \ + fluxbox \ + git \ + novnc \ + supervisor \ + x11vnc \ + xterm \ + xvfb && \ + rm -rf /var/lib/apt/lists/* +# Create a workspace +RUN mkdir -p /root/catkin_ws +WORKDIR /root/catkin_ws +# Source ROS environment +RUN echo "source /opt/ros/humble/setup.bash" >> /root/.bashrc +# Set environment variables +ENV HOME=/root \ + DEBIAN_FRONTEND=noninteractive \ + LANG=en_US.UTF-8 \ + LANGUAGE=en_US.UTF-8 \ + LC_ALL=C.UTF-8 \ + DISPLAY=:0.0 \ + DISPLAY_WIDTH=1024 \ + DISPLAY_HEIGHT=768 \ + RUN_XTERM=yes \ + RUN_FLUXBOX=yes \ + ROS_MASTER_URI=http://172.16.0.240:11311 \ + ROS_HOSTNAME=ros +# Copy application files +COPY . /app +# Set the default command +CMD ["/app/entrypoint.sh"] +# Expose port +EXPOSE 8080 \ No newline at end of file diff --git a/src/rviz-mac/conf.d/fluxbox.conf b/src/rviz-mac/conf.d/fluxbox.conf new file mode 100644 index 0000000..96793ad --- /dev/null +++ b/src/rviz-mac/conf.d/fluxbox.conf @@ -0,0 +1,3 @@ +[program:fluxbox] +command=fluxbox +autorestart=true diff --git a/src/rviz-mac/conf.d/websockify.conf b/src/rviz-mac/conf.d/websockify.conf new file mode 100644 index 0000000..d15418c --- /dev/null +++ b/src/rviz-mac/conf.d/websockify.conf @@ -0,0 +1,3 @@ +[program:websockify] +command=websockify --web /usr/share/novnc 8080 localhost:5900 +autorestart=true diff --git a/src/rviz-mac/conf.d/x11vnc.conf b/src/rviz-mac/conf.d/x11vnc.conf new file mode 100644 index 0000000..2fff49a --- /dev/null +++ b/src/rviz-mac/conf.d/x11vnc.conf @@ -0,0 +1,3 @@ +[program:x11vnc] +command=x11vnc -forever -shared +autorestart=true diff --git a/src/rviz-mac/conf.d/xterm.conf b/src/rviz-mac/conf.d/xterm.conf new file mode 100644 index 0000000..da1af44 --- /dev/null +++ b/src/rviz-mac/conf.d/xterm.conf @@ -0,0 +1,3 @@ +[program:xterm] +command=xterm +autorestart=true diff --git a/src/rviz-mac/conf.d/xvfb.conf b/src/rviz-mac/conf.d/xvfb.conf new file mode 100644 index 0000000..29949d8 --- /dev/null +++ b/src/rviz-mac/conf.d/xvfb.conf @@ -0,0 +1,3 @@ +[program:xvfb] +command=Xvfb :0 -screen 0 "%(ENV_DISPLAY_WIDTH)s"x"%(ENV_DISPLAY_HEIGHT)s"x24 -listen tcp -ac +autorestart=true diff --git a/src/rviz-mac/entrypoint.sh b/src/rviz-mac/entrypoint.sh new file mode 100644 index 0000000..283ca62 --- /dev/null +++ b/src/rviz-mac/entrypoint.sh @@ -0,0 +1,19 @@ +#!/bin/bash +set -ex + +RUN_FLUXBOX=${RUN_FLUXBOX:-yes} +RUN_XTERM=${RUN_XTERM:-yes} + +case $RUN_FLUXBOX in + false|no|n|0) + rm -f /app/conf.d/fluxbox.conf + ;; +esac + +case $RUN_XTERM in + false|no|n|0) + rm -f /app/conf.d/xterm.conf + ;; +esac + +exec supervisord -c /app/supervisord.conf diff --git a/src/rviz-mac/supervisord.conf b/src/rviz-mac/supervisord.conf new file mode 100644 index 0000000..3dd2ac7 --- /dev/null +++ b/src/rviz-mac/supervisord.conf @@ -0,0 +1,5 @@ +[supervisord] +nodaemon=true + +[include] +files = /app/conf.d/*.conf