Skip to content

Commit

Permalink
feat: Base Setup
Browse files Browse the repository at this point in the history
Setup base site and docs for installation of ros2
  • Loading branch information
FallenDeity committed Jan 6, 2024
0 parents commit 869724b
Show file tree
Hide file tree
Showing 19 changed files with 1,935 additions and 0 deletions.
6 changes: 6 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
version: 2
updates:
- package-ecosystem: "pip"
directory: "/"
schedule:
interval: "weekly"
37 changes: 37 additions & 0 deletions .github/workflows/format-and-lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: Code formatter and linter

on:
push:
branches: [ master ]

permissions:
contents: write

jobs:

build:

runs-on: Ubuntu-latest
steps:
- uses: actions/checkout@v3

- name: Install Python
uses: actions/setup-python@v3
with:
python-version: '3.10'

- name: Install Dependencies
run: |
python -m pip install --upgrade pip
pip install poetry
poetry install
- name: Format with isort and black
run: |
poetry run isort .
poetry run black .
- name: Linting with ruff
run: |
poetry run ruff .
- name: Build docs
run: |
poetry run mkdocs gh-deploy --force
120 changes: 120 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,120 @@
.Python
[Bb]in
[Ii]nclude
[Ll]ib
[Ll]ib64
[Ll]ocal
[Ss]cripts
pyvenv.cfg
.venv
pip-selfcheck.json
*.d
*.slo
*.lo
*.o
*.obj
*.gch
*.pch
*.so
*.dylib
*.dll
*.mod
*.smod
*.lai
*.la
*.a
*.lib
*.exe
*.out
*.app
install/
log/
build/
*.dox
*.wikidoc
.project
.cproject
CMakeLists.txt.user
srv/_*.py
*.pcd
*.pyc
qtcreator-*
*.user
*~
.#*
COLCON_IGNORE
AMENT_IGNORE
__pycache__/
*.py[cod]
*$py.class
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
share/python-wheels/
*.egg-info/
.installed.cfg
*.egg
MANIFEST
*.manifest
*.spec
pip-log.txt
pip-delete-this-directory.txt
htmlcov/
.tox/
.nox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*.cover
*.py,cover
.hypothesis/
.pytest_cache/
cover/
*.mo
*.pot
*.log
local_settings.py
db.sqlite3
db.sqlite3-journal
instance/
.webassets-cache
.scrapy
docs/_build/
.pybuilder/
target/
.ipynb_checkpoints
profile_default/
ipython_config.py
.pdm.toml
__pypackages__/
celerybeat-schedule
celerybeat.pid
*.sage.py
.env
env/
venv/
ENV/
env.bak/
venv.bak/
.spyderproject
.spyproject
.ropeproject
/site
.mypy_cache/
.dmypy.json
dmypy.json
.pyre/
.pytype/
cython_debug/
.idea/
.vscode/
49 changes: 49 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
repos:

- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
hooks:
- id: end-of-file-fixer
- id: trailing-whitespace
args:
- --markdown-linebreak-ext=md
- id: check-toml

- repo: https://github.com/pre-commit/pygrep-hooks
rev: v1.10.0
hooks:
- id: python-use-type-annotations
- id: python-check-blanket-noqa

- repo: local
hooks:
- id: isort
name: isort
pass_filenames: false
entry: poetry
args: ["run", "isort", "."]
language: python
stages:
- commit

- repo: local
hooks:
- id: black
name: black
pass_filenames: false
entry: poetry
args: ["run", "black", "."]
language: python
stages:
- commit

- repo: local
hooks:
- id: ruff
name: ruff
pass_filenames: false
entry: poetry
args: ["run", "ruff", "."]
language: python
stages:
- commit
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2024 FallenDeity

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.
30 changes: 30 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# Learn ROS2

A repository to learn ROS2, contains examples and tutorials.

## For Developers

### Setup

To setup the repository, run the following commands.

```bash
git clone https://github.com/RoboManipal/Learn-ROS2
cd Learn-ROS2
```

### Installation

To install the required dependencies, run the following commands.

```bash
poetry install
```

### Serving the Website

To serve the website, run the following commands.

```bash
poetry run mkdocs serve
```
Binary file added docs/assets/doctor.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/assets/install.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/assets/logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/assets/repo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/assets/ros.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/assets/setup.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/assets/source.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/assets/talker_listener.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
95 changes: 95 additions & 0 deletions docs/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
<h1 align="center">ROS2 Tutorials</h1>
<p align="center">
<img src="assets/logo.png" width="250" alt="logo" />
<br /><br />
The Robot Operating System (ROS) is a set of software libraries and tools for building robot applications.
From drivers and state-of-the-art algorithms to powerful developer tools, ROS has the open source tools you need for your next robotics project.
The official documentation for ROS2 and its distributions can be found <a href="https://index.ros.org/">here</a>.
</p>

!!! info "Note"
This tutorial assumes that you have dual booted your system with Ubuntu 22.04 or have a [WSL2](https://ubuntu.com/tutorials/install-ubuntu-on-wsl2-on-windows-10#1-overview) installation of Ubuntu 22.04 on your Windows machine.

## Installation

To install ROS2, you need the `Ubuntu 22.04` Jammy Jellyfish release. You can download the ISO file from [here](https://releases.ubuntu.com/22.04/).

### Installing ROS2

Once you have installed Ubuntu 22.04, open a terminal instance and run the following commands:

```bash
sudo apt install software-properties-common # install add-apt-repository
sudo add-apt-repository universe # add universe repository
```

This will add the [universe repository](https://help.ubuntu.com/community/Repositories/Ubuntu) to your system. Now, run the following commands to install `curl` and add the ROS2 keyring to your system.

```bash
sudo apt update && sudo apt install curl -y # update and install curl
sudo curl -sSL https://raw.githubusercontent.com/ros/rosdistro/master/ros.key -o /usr/share/keyrings/ros-archive-keyring.gpg # add ROS2 keyring
```

!!! note "Note"
A keyring is a collection of cryptographic keys that are stored in a file on your system. The keyring is used to verify the authenticity of the packages that you install on your system.
Here, we are adding the ROS2 keyring to our system.

![Setup](assets/setup.png)

Now, add the ROS2 repository to your system and install ROS2.

```bash
echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/ros-archive-keyring.gpg] http://packages.ros.org/ros2/ubuntu $(. /etc/os-release && echo $UBUNTU_CODENAME) main" | sudo tee /etc/apt/sources.list.d/ros2.list > /dev/null # add ROS2 repository
sudo apt update && sudo apt upgrade # update the package list and upgrade the packages
```

!!! note "Note"
The `tee` command is used to write the output of a command to a file. Here, we are writing the ROS2 repository to the `/etc/apt/sources.list.d/ros2.list` file. The `> /dev/null` part is used to suppress the output of the command.

![Adding the repository](assets/repo.png)

Now, install ROS2.

```bash
sudo apt install ros-humble-desktop # install ROS2
```

![Install](assets/install.png)

With this, you have successfully installed ROS2 on your system. Now, you need to source the ROS2 setup file to your `.bashrc` file. This will allow you to use ROS2 commands in your terminal.

```bash
echo "source /opt/ros/humble/setup.bash" >> ~/.bashrc # source the ROS2 setup file, run this only once
source ~/.bashrc # source the .bashrc file, reloads the current terminal instance
tail ~/.bashrc # check if the setup file has been sourced
```

!!! note "Note"
The `>>` operator is used to append the output of a command to a file. Here, we are appending the `source /opt/ros/humble/setup.bash` command to the `.bashrc` file.
`.bashrc` is a hidden file in your home directory that is executed every time you open a terminal instance.

![Sourcing the setup file](assets/source.png)

Now, run the following command to check if ROS2 has been installed successfully.

```bash
ros2 doctor # check if ROS2 has been installed successfully
```

![Doctor](assets/doctor.png)

### Running examples

Now, let's run some examples to check if ROS2 is working properly. Run the following commands to run the `talker` and `listener` examples.

```bash
ros2 run demo_nodes_cpp talker # run the talker example
```

Now, open a new terminal instance and run the following command.

```bash
ros2 run demo_nodes_py listener # run the listener example
```

![Talker and Listener](assets/talker_listener.png)
Loading

0 comments on commit 869724b

Please sign in to comment.