ROS2 nodes for Waveshare Alphabot2-Pi mobile robot.

Overview

ROS2 for Waveshare Alphabot2-Pi

This repo contains ROS2 packages for the Waveshare Alphabot2-Pi mobile robot:

  • alphabot2: it contains the nodes used to manage Alphabot2 sensors and actuators.
  • alphabot2_interfaces: it contains all the custom interfaces (ROS messages) designed for AlphaBot2.

The current implementation includes nodes to manage the motors, the IR obstacle sensors and the camera. There is also a node for QR-code detection.

Please, see here for the ROS2 nodes topology and TODO.

The code has been originally developed for the final project of the Robotics course, University of Brescia.

Requirements

  • Robot: Waveshare Alphabot2-Pi mobile robot (see here), equipped a Raspberry Pi4 (8 GB).

  • OS: Ubuntu Server 20.04 (Focal Fossa) x64.

Ubuntu and ROS2 setup

Install Ubuntu Server 20.04 x64 on the RPi4 (see here).

Connect the RPi4 to WiFi and add auto-connection at boot (see here).

Install ROS2 Foxy Fitzroy Base (reference) and the dependencies:

/dev/null sudo apt update && sudo apt install ros-foxy-ros-base">
sudo apt update && sudo apt install curl gnupg2 lsb-release
sudo curl -sSL https://raw.githubusercontent.com/ros/rosdistro/master/ros.key  -o /usr/share/keyrings/ros-archive-keyring.gpg
echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/ros-archive-keyring.gpg] http://packages.ros.org/ros2/ubuntu $(source /etc/os-release && echo $UBUNTU_CODENAME) main" | sudo tee /etc/apt/sources.list.d/ros2.list > /dev/null
sudo apt update && sudo apt install ros-foxy-ros-base

Install python dependencies:

sudo apt install python3-pip python3-colcon-common-extensions python3-rosdep2
pip3 install RPi.GPIO argcomplete

Initialize rosdep and source the ROS2 core environment:

rosdep update
source /opt/ros/foxy/setup.bash

Fix GPiO permission problem (reference):

sudo apt install rpi.gpio-common
sudo usermod -aG dialout ubuntu

Suggestions

Source the ROS2 core environment (underlay) and the ROS2 local workspaces (overlays) in the file .bashrc so that they are automatically sourced in every bash shell:

source /opt/ros/foxy/setup.bash
source /path_to_your_ros_ws/install/local_setup.bash

Plug an additional external network adapter and setup it as a WiFi Access Point to easily SSH into the RPi4. Please follow this guide and also these additional tricks:

  • put optional: true for wlan0 in 50-cloud-init.yaml to prevent endless booting time.
  • don't put After=network-online.target and Wants=network-online.target
  • sudo systemctl enable dnsmasq

Camera node (v4l2_camera)

For the Raspberry Camera management we use the ROS2 implementation v4l2_camera (reference).

Install required tools:

sudo apt install v4l-utils
echo bcm2835-v4l2 | sudo tee -a /etc/modules

Add start_x=1 in /boot/config.txt

Clone the camera node and dependencies needed to compress images into the src folder of your ros workspace:

git clone -b foxy https://gitlab.com/boldhearts/ros2_v4l2_camera.git
git clone -b ros2 https://github.com/ros-perception/vision_opencv.git
git clone -b ros2 https://github.com/ros-perception/image_common.git                  
git clone -b ros2 https://github.com/ros-perception/image_transport_plugins.git 

To fix building errors, modify camera_info_manager.cpp:46 (in image_common/camera_info_manager/) to:

#include "rcpputils/get_env.hpp"

Source build:

cd your_ros_ws
rosdep install --from-paths src -r -y
colcon build

Build and usage

After you have all the requirements satisfied, clone this repo in your_ros_ws/src and build it:

git clone https://github.com/Mik3Rizzo/alphabot2-ros2
cd your_ros_ws
colcon build

I recommend to run all the nodes at once using the launch file:

ros2 launch alphabot2 alphabot2_launch.py

To move the robot, publish a Twist ROS2 message on the alphabot2/cmd_vel topic. For example:

ros2 topic pub --rate 1 alphabot2/cmd_vel geometry_msgs/msg/Twist "{linear: {x: 1.0, y: 0.0, z: 0.0}, angular: {x: 0.0, y: 0.0, z: 5.0}}"

This command publishes every second a linear velocity of 1 m/s and an angular rate of 5 rad/s.

Please note that the maximum theoretical linear velocity is 1.65 m/s while the angular rate is 38.8 rad/s. These quantities are estimated with the robot suspended from the floor and supplied with two Sony US14500VR Li-ion 3.7V batteries at full charge. In these conditions the maximum wheel RPM is 750.

About

Michele Rizzo, Master's Degree Computer Engineering student at University of Brescia.

Please, feel free to contact me for informations or problems.

Owner
Michele Rizzo
Philosophy, Engineering, Art. 🌶 Paparu' crusch enthusiast 🍃 Aequitas et elegantia
Michele Rizzo
Automatic CPU speed & power optimizer for Linux

Automatic CPU speed & power optimizer for Linux based on active monitoring of laptop's battery state, CPU usage, CPU temperature and system load. Ultimately allowing you to improve battery life witho

Adnan Hodzic 3.4k Jan 07, 2023
Controlling fireworks with micropython

Controlling-fireworks-with-micropython How the code works line 1-4 from machine

Montso Mokake 1 Jan 08, 2022
2D waypoints will be predefined in ROS based robots to navigate to the destination avoiding obstacles.

A number of 2D waypoints will be predefined in ROS based robots to navigate to the destination avoiding obstacles.

Arghya Chatterjee 5 Nov 05, 2022
View your medication from Medisafe Cloud in Home Assistant

Medisafe View your medication from Medisafe Cloud in Home Assistant. This integration adds sensors for today's upcoming, taken, skipped, and missed do

Sam Steele 12 Dec 27, 2022
Custom component for interacting with Octopus Energy

Home Assistant Octopus Energy ** WARNING: This component is currently a work in progress ** Custom component built from the ground up to bring your Oc

David Kendall 116 Jan 02, 2023
Pylorawan is a Micropython wrapper for lorawan devices from RAK Wireless.

pylorawan Pylorawan is a Micropython wrapper for lorawan devices from RAK Wireless. Tested on a Raspberry PI Pico with a RAK4200(H) Evaluation Board (

Peter Houghton 3 Nov 04, 2022
OPNsense integration with Home Assistant

hass-opnsense Join OPNsense with home-assistant! hass-opnsense uses the built-in xmlrpc service of OPNsense for all interactions. This project is curr

Travis Glenn Hansen 54 Jan 03, 2023
Aqara Camera G3 integration for Home Assistant

Aqara Camera G3 integration for Home Assistant ATTENTION: The component only works after enabled telnet. Only supportd stream. Not support still image

14 Dec 18, 2022
Run this code to blink your ThinkPad LED with a hidden mysterious Morse code! ;)

TMorse Run this code to blink your ThinkPad LED with a hidden mysterious Morse code! ;) Compatible with python3.9+. No third-party library is required

Mahyar 2 Jul 11, 2022
A flexible data historian based on InfluxDB, Grafana, MQTT and more. Free, open, simple.

Kotori Telemetry data acquisition and sensor networks for humans. Documentation: https://getkotori.org/ Source Code: https://github.com/daq-tools/koto

83 Nov 26, 2022
Kwcpu - An unobtrusive CPU meter that fits in the default Windows 11 taskbar. Supports up to 32 cores.

kwcpu An unobtrusive CPU meter that fits in the default Windows 11 taskbar. Supports up to 32 cores. kwcpu is provided as a Rainmeter skin. By default

Jay Oster 2 Nov 07, 2022
I made this so I can control my Tapo L510 light bulb and Govee H6159 light strip using the PyP100 module and the Govee public API

TAPO-And-Govee-Controller I made this so I can control my Tapo L510 light bulb and Govee H6159 light strip using the PyP100 module and the Govee publi

James Westhead 0 Nov 23, 2021
It is a serial communicator(controller, receiver...), communicate with sensor LP20 which is a laser ranger.

Intro It is a serial communicator(controller, receiver...), communicate with sensor LP20 which is a laser ranger. Its datasheet is contained in this r

3 Sep 19, 2022
OctoPrint is the snappy web interface for your 3D printer!

OctoPrint OctoPrint provides a snappy web interface for controlling consumer 3D printers. It is Free Software and released under the GNU Affero Genera

OctoPrint 7.1k Jan 03, 2023
a fork of the OnionShare software better optimized for lower spec lightweight machines and ARM processors

OnionShare-Optimized A fork of the OnionShare software better optimized for lower spec lightweight machines and ARM processors such as Raspberry Pi or

ALTPORT 4 Aug 05, 2021
ArduinoWaterHeaterIOT - IoT Probe of a solar PV water heating system - Arduino, Python, MQTT, MySQL

ArduinoWaterHeaterIOT IoT Probe of a solar PV water heating system - Arduino, Raspberry Pi, Python, MQTT, MySQL The Arduino sends the AC and DC watts

Jacques Fourie 1 Jan 11, 2022
emhass: Energy Management for Home Assistant

emhass EMHASS: Energy Management for Home Assistant Context This module was conceived as an energy management optimization tool for residential electr

David 70 Dec 24, 2022
The project is an open-source and low-cost kit to get started with underactuated robotics.

Torque Limited Simple Pendulum Introduction The project is an open-source and low-cost kit to get started with underactuated robotics. The kit targets

34 Dec 14, 2022
A Fear and Greed index visualiser for Bitcoin on a SSD1351 OLED Screen

We're Doomed - A Bitcoin Fear and Greed index OLED visualiser Doom is a first-person-shooter from the 1990s. The health status monitor was one of the

VEEB 19 Dec 29, 2022
Python module for the qwiic serial control motor driver

Qwiic_SCMD_Py Python module for the qwiic motor driver This python package is a port of the existing SparkFun Serial Controlled Motor Driver Arduino L

SparkFun Electronics 6 Dec 06, 2022