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
Rasberry Pie GPIO memory game. Press the corresponding key to the lit LED.

RPie-keyboard-game Rasberry Pie GPIO memory game. Press the corresponding key to the lit LED. Randem LED (general output) is lit up on rasberrypi rand

Shawn Dowling 1 Oct 24, 2021
Small Robot, with LIDAR and DepthCamera. Using ROS for Maping and Navigation

🤖 RoboCop 🤖 Small Robot, with LIDAR and DepthCamera. Using ROS for Maping and Navigation Made by Clemente Donoso, 📍 Chile 🇨🇱 RoboCop Lateral Fron

Clemente Donoso Krauss 2 Jan 04, 2022
A LiteX project which builds a SoC with DRAM / HDIM output via the GPDI SYZYGY addon.

ButterStick GPDI LiteX demo A LiteX project which builds a SoC with DRAM / HDIM output via the GPDI SYZYGY addon. Getting started Connect GPDI board t

4 Nov 21, 2021
MPY tool - manage files on devices running MicroPython

mpytool MPY tool - manage files on devices running MicroPython It is an alternative to ampy Target of this project is to make more clean code, faster,

Pavel Revak 5 Aug 17, 2022
Monitor Live USB Plug In & Plug Out Events

I/O - Live USB Monitoring Author: Jonathan Scott @jonathandata1 Date: 3/13/2021 CURRENT VERSION 1.0 This is just a simple bash script that calls a pyt

Jonathan Scott 17 Dec 03, 2022
This OctoPrint plugin will make the initial connection to 3D Hub a breeze

3D Hub Connector This OctoPrint plugin will make the initial connection to 3D Hub a breeze. In future it will help in setting up a tunnel connection a

3D Hub 2 Aug 03, 2022
This allows you to record keyboard and mouse input, and play it back using pynput.

Record and Play with Python! This allows you to record keyboard and mouse input, and play it back (with looping) using pynput. It allows for automatio

George Jensen 45 Jan 02, 2023
Transform a Raspberry Pi into a network diagnostic machine.

EtherView Last updated jan 30, 2022. Welcome to the EtherView project! This is a project to transform a RaspberryPi into a portable network diagnostic

1 Jan 30, 2022
circuitpython version of PyBasic for microcontrollers

cPyBasic Circuitpython version of PyBasic for microcontrollers Current version work only for Adafruit titano & CardKB for now. The origninal PyBasic w

BeBoXoS 3 Nov 14, 2021
[unmaintained] WiFi tools for linux

Note: This project is unmaintained. While I would love to keep up the development on this project, it is difficult for me for several reasons: I don't

Rocky Meza 288 Dec 13, 2022
LUNA: a USB multitool & nMigen library

LUNA is a full toolkit for working with USB using FPGA technology; and provides hardware, gateware, and software to enable USB applications.

Great Scott Gadgets 750 Dec 28, 2022
Baseline model for Augmented Home Assistant

Dataset Preparation Step 1. Rename the Virtual-Home output directory to 'vh.[name]', for example: 'vh.door' Make sure the directory contains 100+ fram

Stanford HCI 1 Aug 24, 2022
Doughskript interpreter for converting simple command sequences into executable Arduino C++ code.

Doughskript interpreter for converting simple command sequences into executable Arduino C++ code.

Svjatoslav 2 Jan 11, 2022
This application works with serial communication. Use a simple gui to send and receive serial data from arduino and control leds and motor direction

This application works with serial communication. Use a simple gui to send and receive serial data from arduino and control leds and motor direction

ThyagoKZKR 2 Jul 18, 2022
Keystroke logging, often referred to as keylogging or keyboard capturing

Keystroke logging, often referred to as keylogging or keyboard capturing, is the action of recording the keys struck on a keyboard, typically covertly, so that a person using the keyboard is unaware

Bhumika R 2 Jan 11, 2022
Plug and Play on Internet of Things with LoRa wireless modulation.

IoT-PnP Plug and Play on Internet of Things with LoRa wireless modulation. Device Side In the '505_PnP' folder has a modified ardunino template code s

Lambert Yang 1 May 19, 2022
An open source operating system designed primarily for the Raspberry Pi Pico, written entirely in MicroPython

PycOS An open source operating system designed primarily for the Raspberry Pi Pico, written entirely in MicroPython. "PycOS" is an combination of the

8 Oct 06, 2022
Hotplugger: Real USB Port Passthrough for VFIO/QEMU!

Hotplugger: Real USB Port Passthrough for VFIO/QEMU! Welcome to Hotplugger! This app, as the name might tell you, is a combination of some scripts (py

DARKGuy (Alemar) 66 Nov 24, 2022
A simple portable USB MIDI controller based on Raspberry-PI Pico and a 16-button keypad, written in Circuit Python

RPI-Pico-16-BTn-MIDI-Controller-using-CircuitPython A simple portable USB MIDI controller based on Raspberry-PI Pico, written in Circuit Python. Link

Rounak Dutta 3 Dec 04, 2022
Like htop (CPU and memory usage), but for your case LEDs. 😄

Like htop (CPU and memory usage), but for your case LEDs. 😄

Derek Anderson 3 Dec 08, 2021