ROS2 on Raspberry Pi 4 Ubuntu Server 22.04

Posted

OS Image:

Linux ubuntu 5.15.0-1070-raspi #73-Ubuntu SMP PREEMPT Thu Dec 19 17:56:10 UTC 2024 aarch64 aarch64 GNU/Linux
Ubuntu 22.04.5 LTS (Jammy Jellyfish)

Ref:

  1. https://www.unitree.com/LiDAR
  2. https://github.com/unitreerobotics
  3. https://github.com/unitreerobotics/unilidar_sdk/blob/main/unitree_lidar_ros2/src/unitree_lidar_ros2/README.md
  4. https://github.com/unitreerobotics/point_lio_unilidar
  5. https://docs.ros.org/en/foxy/How-To-Guides/Installing-on-Raspberry-Pi.html
  6. https://roboticsbackend.com/install-ubuntu-on-raspberry-pi-without-monitor/
  7. https://roboticsbackend.com/install-ros2-on-raspberry-pi/
  8. https://linuxconfig.org/ubuntu-22-04-connect-to-wifi-from-command-line
  9. https://github.com/unitreerobotics/unilidar_sdk2
  10. https://github.com/dfloreaa/point_lio_ros2

Setup Ubuntu:

sudo apt update
sudo apt install net-tools
sudo apt install htpdate
sudo timedatectl set-timezone Asia/Bangkok
sudo apt install zram-config
sudo apt install ubuntu-desktop
sudo reboot
sudo vi /boot/firmware/config.txt
{
dtoverlay=vc4-fkms-v3d
max_framebuffer_height=1920
max_usb_current=1
hdmi_mode=87
extra_transpose_buffer=2
over_voltage=4
arm_freq=1850
v3d_freq=650
gpu_freq=650
hdmi_enable_4kp60=1
hdmi_force_hotplug=1
max_framebuffers=2
gpu_mem=512
}
sudo swapon --show
sudo swapoff -a
sudo rm /swapfile
sudo fallocate -l 5G /swapfile
sudo chmod 600 /swapfile
sudo mkswap /swapfile
sudo swapon /swapfile
sudo reboot
sudo vcgencmd get_mem gpu
sudo free -h
sudo add-apt-repository universe
sudo apt update
sudo apt install build-essential software-properties-common -y
sudo apt install libopenblas-dev libblas-dev m4 cmake python3-dev python3-yaml python3-setuptools git
sudo apt update 
sudo apt install curl -y
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 $(. /etc/os-release && echo $UBUNTU_CODENAME) main" | sudo tee /etc/apt/sources.list.d/ros2.list > /dev/null

Install ROS core:

sudo apt update
sudo apt upgrade
#sudo apt install ros-humble-ros-base
sudo apt install ros-humble-desktop
sudo apt install python3-colcon-common-extensions
sudo apt install ros-humble-example-interfaces

Setup ROS2 environment:

source /opt/ros/humble/setup.bash
echo "source /opt/ros/humble/setup.bash" >> ~/.bashrc

Setup Unitree LidarL1 sdk:

sudo apt install ros-humble-pcl-ros
sudo apt install ros-humble-pcl-conversions
sudo apt install ros-humble-visualization-msgs
sudo apt install libeigen3-dev
git clone https://github.com/unitreerobotics/unilidar_sdk.git
cd unilidar_sdk/unitree_lidar_ros2
colcon build
cd unilidar_sdk/unitree_lidar_ros2
source install/setup.bash
ros2 launch unitree_lidar_ros2 launch.py
sudo su
free -h && sync && echo 3 > /proc/sys/vm/drop_caches && free -h
exit

Setup Livox ROS Driver 2:

cd ~
git clone https://github.com/Livox-SDK/Livox-SDK2.git
cd ./Livox-SDK2/
mkdir build
cd build
cmake .. && make -j
sudo make install
cd ~
git clone https://github.com/Livox-SDK/livox_ros_driver2.git ws_livox/src/livox_ros_driver2
cd ./ws_livox/src/livox_ros_driver2
source /opt/ros/humble/setup.sh
./build.sh humble
source ~/ws_livox/install/setup.bash
ros2 launch livox_ros_driver2 rviz_HAP_launch.py

Setup Point-LIO-ROS2:

RUN:

Author