Skip to content

Commit

Permalink
New lib for GPIO (#99)
Browse files Browse the repository at this point in the history
* New lib for GPIO

* Update .wordlist.txt

* Update .wordlist.txt

* Update rosbot_utils/rosbot_utils/flash-firmware.py

* clean up

* spellcheck fix

* Jakub suggestions

* Use gpiozero

* readme

* Update .wordlist.txt

* Update rosbot_utils/package.xml

* Add author

* better

* GPIOD

---------

Co-authored-by: Jakub Delicat <[email protected]>
  • Loading branch information
rafal-gorecki and delihus authored Feb 1, 2024
1 parent b05a2fe commit abec541
Show file tree
Hide file tree
Showing 15 changed files with 138 additions and 128 deletions.
7 changes: 7 additions & 0 deletions .wordlist.txt
Original file line number Diff line number Diff line change
Expand Up @@ -150,4 +150,11 @@ subprocess
cbus
Dockerfile
unbuffered
libgpiod
REQ
gpiochip
gpiod
Rafal
Gorecki
gpiozero
sp
73 changes: 51 additions & 22 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,20 +1,27 @@
# Rosbot ROS

ROS2 packages for ROSbot 2R and ROSbot 2 PRO.

## ROS packages

### `rosbot`

Metapackage that contains dependencies to other repositories.

### `rosbot_bringup`

Package that contains launch, which starts all base functionalities. Also configuration for [robot_localization](https://github.com/cra-ros-pkg/robot_localization) and [ros2_controllers](https://github.com/ros-controls/ros2_controllers) are defined there.

### `rosbot_description`

URDF model used as a source of transforms on the physical robot. It was written to be compatible with ROS Industrial and preconfigured for ROS2 control.

### `rosbot_gazebo`

Launch files for Ignition Gazebo working with ROS2 control.

### `rosbot_controller`

ROS2 hardware controllers configuration for ROSbots.

## ROS API
Expand All @@ -31,14 +38,16 @@ For detailed instructions refer to the [rosbot_ros2_firmware repository](https:/

### Prerequisites

Install `colcon`, `vcs` and `rosdep`:
```
Install all necessary tools:

```bash
sudo apt-get update
sudo apt-get install -y python3-colcon-common-extensions python3-vcstool python3-rosdep python3-pip
sudo apt-get install -y ros-dev-tools python3-pip
```

Create workspace folder and clone `rosbot_ros` repository:
```

```bash
mkdir -p ros2_ws/src
cd ros2_ws
git clone https://github.com/husarion/rosbot_ros src/
Expand All @@ -47,7 +56,8 @@ git clone https://github.com/husarion/rosbot_ros src/
### Build and run on hardware

Building:
```

```bash
export HUSARION_ROS_BUILD=hardware

source /opt/ros/$ROS_DISTRO/setup.bash
Expand All @@ -65,31 +75,44 @@ rosdep install -i --from-path src --rosdistro $ROS_DISTRO -y
colcon build --cmake-args -DCMAKE_BUILD_TYPE=Release
```

> **Prerequisites**
>
> Before starting the software on the robot please make sure that you're using the latest firmware and run the `micro-ROS` agent (as described in the *Usage on hardware* step).
Flash firmware:

Running:
```bash
source install/setup.bash
ros2 launch rosbot_utils flash_firmware
```

Running:

```bash
source install/setup.bash
ros2 launch rosbot_bringup bringup.launch.py
ros2 launch rosbot_bringup combined.launch.py
```

### Build and run Gazebo simulation

Prerequisites:

> **Warning**
> The simulation is compatible with the Gazebo Fortress LTS version. Use [this installation guide ](https://gazebosim.org/docs/fortress/install_ubuntu#binary-installation-on-ubuntu) to install the proper version and remove the another versions e. g. Gazebo Garden:
> `sudo apt remove gz-garden && sudo apt autoremove`
> Look at [the table](https://gazebosim.org/docs/garden/ros_installation#summary-of-compatible-ros-and-gazebo-combinations) to see the compatible ROS 2 and Gazebo versions.
> [!TIP]
> The default version of Gazebo Ignition will be installed with the instructions below. If you want to install a different version of the simulator, it is necessary to:
>
> - Check compatible versions of ROS 2 and Gazebo in [this table](https://gazebosim.org/docs/garden/ros_installation#summary-of-compatible-ros-and-gazebo-combinations)
> - [Install the appropriate version](https://gazebosim.org/docs/fortress/install_ubuntu#binary-installation-on-ubuntu),
> - Add the `GZ_VERSION` environment variable appropriate to your version
>
> ```bash
> export GZ_VERSION=fortress
> ```
If you have installed multiple versions of Gazebo use the global variable to select the correct one:
```bash
export GZ_VERSION=fortress
```
Building:
```
```bash
export HUSARION_ROS_BUILD=simulation
source /opt/ros/$ROS_DISTRO/setup.bash
Expand All @@ -107,14 +130,16 @@ colcon build --cmake-args -DCMAKE_BUILD_TYPE=Release
```
Running:
```
```bash
source install/setup.bash
ros2 launch rosbot_gazebo simulation.launch.py
```
## Testing package
## Developer info
### pre-commit
[pre-commit configuration](.pre-commit-config.yaml) prepares plenty of tests helping for developing and contributing. Usage:
```bash
Expand All @@ -131,20 +156,23 @@ pre-commit run -a
After initialization [pre-commit configuration](.pre-commit-config.yaml) will applied on every commit.
### Industrial CI
```
```bash
colcon test
```
> [!NOTE]
> Command `colcon test` does not build the code. Remember to build your code after changes.
If tests finish with errors print logs:
```
``` bash
colcon test-result --verbose
```
### Format python code with [Black](https://github.com/psf/black)
```
```bash
cd src/
black rosbot*
```
Expand All @@ -153,18 +181,19 @@ black rosbot*
At fist install [act](https://github.com/nektos/act):
```
```bash
cd /
curl -s https://raw.githubusercontent.com/nektos/act/master/install.sh | sudo bash
```
And test the workflow with:
```
```bash
act -W .github/workflows/industrial_ci.yaml
```
## Demo
Below you can find demos with ROSbots:
| link | description |
| - | - |
Expand Down
6 changes: 3 additions & 3 deletions rosbot/CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,6 @@
Changelog for package rosbot
^^^^^^^^^^^^^^^^^^^^^^^^^^^^

0.10.5 (2023-12-05)
-------------------

0.13.0 (2024-01-15)
-------------------

Expand All @@ -17,6 +14,9 @@ Changelog for package rosbot
0.11.0 (2023-12-08)
-------------------

0.10.5 (2023-12-05)
-------------------

0.10.4 (2023-12-01)
-------------------

Expand Down
13 changes: 5 additions & 8 deletions rosbot/package.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,27 +3,24 @@
<package format="3">
<name>rosbot</name>
<version>0.13.0</version>

<description>Meta package that contains all packages of Rosbot 2 2R PRO</description>
<license>Apache License 2.0</license>

<author email="[email protected]">Jakub Delicat</author>
<maintainer email="[email protected]">Husarion</maintainer>
<license>Apache License 2.0</license>

<url type="website">https://husarion.com/</url>
<url type="repository">https://github.com/husarion/rosbot_ros</url>
<url type="bugtracker">https://github.com/husarion/rosbot_ros/issues</url>

<author email="[email protected]">Jakub Delicat</author>

<buildtool_depend>ament_cmake</buildtool_depend>

<depend>rosbot_bringup</depend>
<depend>rosbot_description</depend>
<depend>rosbot_controller</depend>
<depend>rosbot_description</depend>
<depend>rosbot_utils</depend>

<depend condition="($HUSARION_ROS_BUILD == simulation) and ($SIMULATION_ENGINE == ignition-gazebo)">
rosbot_gazebo
</depend>
<depend condition="($HUSARION_ROS_BUILD == simulation)">rosbot_gazebo</depend>

<export>
<build_type>ament_cmake</build_type>
Expand Down
6 changes: 3 additions & 3 deletions rosbot_bringup/CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,6 @@
Changelog for package rosbot_bringup
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

0.10.5 (2023-12-05)
-------------------

0.13.0 (2024-01-15)
-------------------

Expand All @@ -17,6 +14,9 @@ Changelog for package rosbot_bringup
0.11.0 (2023-12-08)
-------------------

0.10.5 (2023-12-05)
-------------------

0.10.4 (2023-12-01)
-------------------

Expand Down
8 changes: 5 additions & 3 deletions rosbot_bringup/package.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,22 @@
<name>rosbot_bringup</name>
<version>0.13.0</version>
<description>ROSbot 2, 2R, PRO bringup package</description>
<license>Apache License 2.0</license>

<author email="[email protected]">Jakub Delicat</author>
<maintainer email="[email protected]">Husarion</maintainer>
<license>Apache License 2.0</license>

<url type="website">https://husarion.com/</url>
<url type="repository">https://github.com/husarion/rosbot_ros</url>
<url type="bugtracker">https://github.com/husarion/rosbot_ros/issues</url>

<author email="[email protected]">Jakub Delicat</author>
<author email="[email protected]">Rafal Gorecki</author>

<exec_depend>launch</exec_depend>
<exec_depend>launch_ros</exec_depend>
<exec_depend>rosbot_controller</exec_depend>
<exec_depend>robot_localization</exec_depend>
<exec_depend>micro_ros_agent</exec_depend>
<exec_depend>micro_ros_msgs</exec_depend>

<test_depend>python3-pytest</test_depend>
<test_depend>launch</test_depend>
Expand Down
6 changes: 3 additions & 3 deletions rosbot_controller/CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,6 @@
Changelog for package rosbot_controller
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

0.10.5 (2023-12-05)
-------------------

0.13.0 (2024-01-15)
-------------------

Expand All @@ -17,6 +14,9 @@ Changelog for package rosbot_controller
0.11.0 (2023-12-08)
-------------------

0.10.5 (2023-12-05)
-------------------

0.10.4 (2023-12-01)
-------------------

Expand Down
7 changes: 3 additions & 4 deletions rosbot_controller/package.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,16 @@
<package format="3">
<name>rosbot_controller</name>
<version>0.13.0</version>

<description>Hardware configuration for ROSbot 2, 2R, PRO</description>
<maintainer email="[email protected]">Husarion</maintainer>
<license>Apache License 2.0</license>

<author email="[email protected]">Jakub Delicat</author>
<maintainer email="[email protected]">Husarion</maintainer>

<url type="website">https://husarion.com/</url>
<url type="repository">https://github.com/husarion/rosbot_ros</url>
<url type="bugtracker">https://github.com/husarion/rosbot_ros/issues</url>

<author email="[email protected]">Jakub Delicat</author>

<buildtool_depend>ament_cmake</buildtool_depend>

<exec_depend>launch</exec_depend>
Expand Down
6 changes: 3 additions & 3 deletions rosbot_description/CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,6 @@
Changelog for package rosbot_description
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

0.10.5 (2023-12-05)
-------------------

0.13.0 (2024-01-15)
-------------------

Expand All @@ -17,6 +14,9 @@ Changelog for package rosbot_description
0.11.0 (2023-12-08)
-------------------

0.10.5 (2023-12-05)
-------------------

0.10.4 (2023-12-01)
-------------------

Expand Down
9 changes: 4 additions & 5 deletions rosbot_description/package.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,17 @@
<package format="3">
<name>rosbot_description</name>
<version>0.13.0</version>

<description>ROSbot 2, 2R, PRO description package</description>
<maintainer email="[email protected]">Husarion</maintainer>
<license>Apache License 2.0</license>

<author email="[email protected]">Jakub Delicat</author>
<author email="[email protected]">Maciej Stepien</author>
<maintainer email="[email protected]">Husarion</maintainer>

<url type="website">https://husarion.com/</url>
<url type="repository">https://github.com/husarion/rosbot_ros</url>
<url type="bugtracker">https://github.com/husarion/rosbot_ros/issues</url>

<author email="[email protected]">Jakub Delicat</author>
<author email="[email protected]">Maciej Stepien</author>

<buildtool_depend>ament_cmake</buildtool_depend>

<export>
Expand Down
6 changes: 3 additions & 3 deletions rosbot_gazebo/CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,6 @@
Changelog for package rosbot_gazebo
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

0.10.5 (2023-12-05)
-------------------

0.13.0 (2024-01-15)
-------------------

Expand All @@ -20,6 +17,9 @@ Changelog for package rosbot_gazebo
Test gazebo fix
* Contributors: Dominik Nowak

0.10.5 (2023-12-05)
-------------------

0.10.4 (2023-12-01)
-------------------

Expand Down
Loading

0 comments on commit abec541

Please sign in to comment.