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..9321dee --- /dev/null +++ b/.gitmodules @@ -0,0 +1,12 @@ +[submodule "src/turtlebot3_simulations"] + 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/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 + + + diff --git a/src/.devcontainer/Dockerfile b/src/.devcontainer/Dockerfile new file mode 100644 index 0000000..aea3afe --- /dev/null +++ b/src/.devcontainer/Dockerfile @@ -0,0 +1,60 @@ +# Use the official ROS Humble base image +FROM ros:humble + +# Set arguments for the 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-cartographer \ + ros-humble-cartographer-ros \ + ros-humble-navigation2 \ + ros-humble-nav2-bringup \ + 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=\(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 TurtleBot3 model environment variable +ENV TURTLEBOT3_MODEL=burger + +# Set the working directory +WORKDIR /home/$USERNAME + +# 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 + +# Create a ROS workspace directory +RUN mkdir -p /home/$USERNAME/ros2_ws/src + +# Switch to the new user +USER $USERNAME + +# Set the default command +CMD ["/bin/bash"] \ No newline at end of file diff --git a/src/.devcontainer/devcontainer.json b/src/.devcontainer/devcontainer.json new file mode 100644 index 0000000..80daea5 --- /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/krish/ros2_ws", + "workspaceMount": "source=${localWorkspaceFolder}/src,target=/home/krish/ros2_ws/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/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 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