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 e4f427ad542e4f8caeceb676665613a0ab04f8f0 Mon Sep 17 00:00:00 2001 From: Krish-Mathur Date: Fri, 8 Nov 2024 15:45:15 -0500 Subject: [PATCH 5/7] Update Dockerfile --- src/.devcontainer/Dockerfile | 29 ++++++++++++++++------------- 1 file changed, 16 insertions(+), 13 deletions(-) diff --git a/src/.devcontainer/Dockerfile b/src/.devcontainer/Dockerfile index 40475cc..e90f49d 100644 --- a/src/.devcontainer/Dockerfile +++ b/src/.devcontainer/Dockerfile @@ -1,51 +1,54 @@ # Use the official ROS Humble base image FROM ros:humble -# Set arguments for user creation -ARG USERNAME=krish +# Set arguments for the user creation +ARG USERNAME=user 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 +# 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-pkgs \ + ros-humble-gazebo-* \ ros-humble-cartographer \ ros-humble-cartographer-ros \ ros-humble-navigation2 \ ros-humble-nav2-bringup \ - ros-humble-rviz2 \ - mesa-utils \ + ros-humble-turtlebot3* \ + 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=(ALL) NOPASSWD:ALL" > /etc/sudoers.d/$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=$DISPLAY -ENV LIBGL_ALWAYS_INDIRECT=1 +ENV DISPLAY=:0 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 TurtleBot3 model environment variable +ENV TURTLEBOT3_MODEL=burger # Set the working directory WORKDIR /home/$USERNAME -# Source ROS environment in .bashrc -RUN echo "source /opt/ros/humble/setup.bash" >> /home/$USERNAME/.bashrc +# Source ROS environment in .bashrc and set up TurtleBot3 simulation setup +RUN echo "source /opt/ros/humble/setup.bash" >> /home/$USERNAME/.bashrc \ + && echo "export TURTLEBOT3_MODEL=\$TURTLEBOT3_MODEL" >> /home/$USERNAME/.bashrc # Switch to the new user USER $USERNAME From 4625b7d339eaa6d379617487267d9b0d0c0e17c6 Mon Sep 17 00:00:00 2001 From: Krish-Mathur Date: Fri, 8 Nov 2024 17:08:50 -0500 Subject: [PATCH 6/7] uhhh --- src/.devcontainer/Dockerfile | 5 ++++- src/.devcontainer/devcontainer.json | 16 ++++++++-------- 2 files changed, 12 insertions(+), 9 deletions(-) diff --git a/src/.devcontainer/Dockerfile b/src/.devcontainer/Dockerfile index e90f49d..dedc25b 100644 --- a/src/.devcontainer/Dockerfile +++ b/src/.devcontainer/Dockerfile @@ -2,7 +2,7 @@ FROM ros:humble # Set arguments for the user creation -ARG USERNAME=user +ARG USERNAME=krish ARG USER_UID=1000 ARG USER_GID=$USER_UID @@ -50,6 +50,9 @@ WORKDIR /home/$USERNAME RUN echo "source /opt/ros/humble/setup.bash" >> /home/$USERNAME/.bashrc \ && echo "export TURTLEBOT3_MODEL=\$TURTLEBOT3_MODEL" >> /home/$USERNAME/.bashrc +# Create a ROS workspace directory +RUN mkdir -p /home/$USERNAME/ros2_ws/src + # Switch to the new user USER $USERNAME diff --git a/src/.devcontainer/devcontainer.json b/src/.devcontainer/devcontainer.json index 7f5f8e6..789e424 100644 --- a/src/.devcontainer/devcontainer.json +++ b/src/.devcontainer/devcontainer.json @@ -8,11 +8,11 @@ "USERNAME": "krish" } }, - "workspaceFolder": "/home/CAM-SLAM", - "workspaceMount": "source=${localWorkspaceFolder},target=/home/CAM-SLAM/src,type=bind", + "workspaceFolder": "/home/krish/ros2_ws", + "workspaceMount": "source=${localWorkspaceFolder}/src,target=/home/krish/ros2_ws/src,type=bind", "customizations": { "vscode": { - "extensions":[ + "extensions": [ "ms-vscode.cpptools", "ms-vscode.cpptools-themes", "twxs.cmake", @@ -32,11 +32,11 @@ "-e", "DISPLAY=${env:DISPLAY}" ], "mounts": [ - "source=/tmp/.X11-unix,target=/tmp/.X11-unix,type=bind,consistency=cached", + "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" + "source=${localWorkspaceFolder}/../cache/build,target=/home/krish/ros2_ws/build,type=bind", + "source=${localWorkspaceFolder}/../cache/install,target=/home/krish/ros2_ws/install,type=bind", + "source=${localWorkspaceFolder}/../cache/log,target=/home/krish/ros2_ws/log,type=bind" ], - "postCreateCommand": "sudo rosdep update && sudo rosdep install --from-paths src --ignore-src -y && sudo chown -R USERNAME /home/ws/" + "postCreateCommand": "sudo rosdep update && sudo rosdep install --from-paths src --ignore-src -y && sudo chown -R krish /home/krish/ros2_ws" } From bd57e08ddccae86c96d61891f042f595e9d32b0a Mon Sep 17 00:00:00 2001 From: Krish-Mathur Date: Mon, 11 Nov 2024 11:53:59 -0500 Subject: [PATCH 7/7] Environment --- .gitmodules | 8 ++++++++ src/.devcontainer/Dockerfile | 2 +- src/.devcontainer/devcontainer.json | 2 +- src/.devcontainer/turtlebot_ws/src/hello.py | 0 src/.devcontainer/turtlebot_ws/turtlebot3 | 1 + src/.devcontainer/turtlebot_ws/turtlebot3_simulations | 1 + 6 files changed, 12 insertions(+), 2 deletions(-) create mode 100644 src/.devcontainer/turtlebot_ws/src/hello.py create mode 160000 src/.devcontainer/turtlebot_ws/turtlebot3 create mode 160000 src/.devcontainer/turtlebot_ws/turtlebot3_simulations diff --git a/.gitmodules b/.gitmodules index 9198c85..9321dee 100644 --- a/.gitmodules +++ b/.gitmodules @@ -2,3 +2,11 @@ path = src/turtlebot3_simulations url = https://github.com/ROBOTIS-GIT/turtlebot3_simulations.git branch = humble-devel +[submodule "src/.devcontainer/turtlebot_ws/turtlebot3"] + path = src/.devcontainer/turtlebot_ws/turtlebot3 + url = https://github.com/ROBOTIS-GIT/turtlebot3.git + branch = humble-devel +[submodule "src/.devcontainer/turtlebot_ws/turtlebot3_simulations"] + path = src/.devcontainer/turtlebot_ws/turtlebot3_simulations + url = https://github.com/ROBOTIS-GIT/turtlebot3_simulations.git + branch = humble-devel diff --git a/src/.devcontainer/Dockerfile b/src/.devcontainer/Dockerfile index dedc25b..aea3afe 100644 --- a/src/.devcontainer/Dockerfile +++ b/src/.devcontainer/Dockerfile @@ -57,4 +57,4 @@ RUN mkdir -p /home/$USERNAME/ros2_ws/src USER $USERNAME # Set the default command -CMD ["/bin/bash"] +CMD ["/bin/bash"] \ No newline at end of file diff --git a/src/.devcontainer/devcontainer.json b/src/.devcontainer/devcontainer.json index 789e424..80daea5 100644 --- a/src/.devcontainer/devcontainer.json +++ b/src/.devcontainer/devcontainer.json @@ -39,4 +39,4 @@ "source=${localWorkspaceFolder}/../cache/log,target=/home/krish/ros2_ws/log,type=bind" ], "postCreateCommand": "sudo rosdep update && sudo rosdep install --from-paths src --ignore-src -y && sudo chown -R krish /home/krish/ros2_ws" -} +} \ No newline at end of file diff --git a/src/.devcontainer/turtlebot_ws/src/hello.py b/src/.devcontainer/turtlebot_ws/src/hello.py new file mode 100644 index 0000000..e69de29 diff --git a/src/.devcontainer/turtlebot_ws/turtlebot3 b/src/.devcontainer/turtlebot_ws/turtlebot3 new file mode 160000 index 0000000..a7dd05a --- /dev/null +++ b/src/.devcontainer/turtlebot_ws/turtlebot3 @@ -0,0 +1 @@ +Subproject commit a7dd05ae176f3f3778b0a36f7065dc9655b050e3 diff --git a/src/.devcontainer/turtlebot_ws/turtlebot3_simulations b/src/.devcontainer/turtlebot_ws/turtlebot3_simulations new file mode 160000 index 0000000..d16cdbe --- /dev/null +++ b/src/.devcontainer/turtlebot_ws/turtlebot3_simulations @@ -0,0 +1 @@ +Subproject commit d16cdbe7ecd601ccad48f87f77b6d89079ec5ac1