Skip to content

Compute ‐ Raspberry Pi

JonasFrey96 edited this page Apr 20, 2024 · 40 revisions

We are using the Raspberry Pi Compute Module 4.

Specifications

  • 4GB DDR4 RAM
  • Custom PCB

GPIO Library

https://github.com/joan2937/pigpio http://abyz.me.uk/rpi/pigpio/

Lessons Learned

  • PTP is not straight forward to get running with any Ubuntu Image available (THis I got running with ROS)
  • Therefore using Raspberry Pi OS Lite 64 bit - (This I got running with PTP)
  • Problem here latest version is on Debian Version 12 which does not work with ROS1 Buster

Option 1: Run PI on ROS2 with latest RaspbianOS - Here we can use a docker container for ROS2 installation Option 2: PTP should work also with Debian 10 Buster version of Image and ROS 1 supported (https://github.com/twteamware/raspberrypi-ptp/issues/9)

Flashing the PI with Debian 12

Follow this: https://www.jeffgeerling.com/blog/2020/how-flash-raspberry-pi-os-compute-module-4-emmc-usbboot

  • Use the development board
  • Connect directly to EMMC via USB cable
sudo apt install libusb-1.0-0-dev
cd git
git clone --depth=1 https://github.com/raspberrypi/usbboot
cd usbboot
make

Set jumper to disable eMMC boot Verify good USB micro USB cable Power cycle the dev board

sudo ./rpiboot

Install the RPI Imager

sudo snap install rpi-imager

Raspberry Pi OS Lite 64 bit

rsl@pi:~ $ cat /etc/os-release 
PRETTY_NAME="Debian GNU/Linux 12 (bookworm)"
NAME="Debian GNU/Linux"
VERSION_ID="12"
VERSION="12 (bookworm)"
VERSION_CODENAME=bookworm

Static IP Configuration Debian 12

Copy to sudo vi /etc/network/interfaces

auto eth0
iface eth0 inet static
    address 192.168.2.57
    netmask 255.255.255.0
    gateway 192.168.2.51
    dns-nameservers 8.8.8.8

PTP Debian 12

Follow tutorial here: https://github.com/jclark/rpi-cm4-ptp-guide/blob/main/os.md

Make the changes to the sudo raspi-config

Then append to /boot/firmware/config.txt

# Enable GPIO pin 18 for PPS (not always necessary, but useful for testing)
dtoverlay=pps-gpio,gpiopin=18
# realtime clock
dtoverlay=i2c-rtc,pcf85063a,i2c_csi_dsi
# fan
dtoverlay=i2c-fan,emc2301,i2c_csi_dsi
# Make /dev/ttyAMA0 be connected to GPIO header pins 8 and 10
# This always disables Bluetooth
dtoverlay=disable-bt
sudo systemctl disable hciuart
sudo dpkg-reconfigure tzdata

Check things

ethtool -T eth0
sudo hwclock --show

Copy over the two ptp services:

Run:

sudo box_configuration/pi/pi_configure.sh

PTP should now be working

Creates two system services. The exact configuration that needs to e added can be found in th ebox configuration. PTP is responsible for timesync between PCs And phc2sys is responsible to synchronize from hardware clock (of ethernet device) to the system clock. The service files need to be copied to: /lib/systemd/system

systemctl status phc2sys_eth0.service
systemctl status ptp4l_eth0.service

Small things change hostname

hostnamectl set-hostname pi

Responsibilities

  • Fan Control
  • Triggering of HDR cameras
  • Sending HDR camera trigger timestamp to NUC
  • Housing Temperature Sensing

Connections

Software

  • OS:
  • ROS Version:

/lib/systemd/system/pigpiod.service pigpiod -s 10

Documentation should contain

  • PTP
  • Kernel Driver ASL - Camera Driver Timestampen RTK?
  • IP
  • ROS1
  • IIO Driver - NTC-Temperature
  • Fan Speed Controller
  • ADIS/STIM

Instructions

Flashen

ROS Installation: Tutorial here

Create GitHub repo for the timer_stamper - Create fork with two branches and include twice as submodules.

time_stamper_adis16475 time_stamper_camera_trigger

build each of the repositories and add the .ko file to the kernel or so ?

Uncurated list on how to install ROS1 Noetic on Debian 12

sudo sh -c 'echo "deb http://packages.ros.org/ros/ubuntu buster main" > /etc/apt/sources.list.d/ros-latest.list'
sudo apt-key adv --keyserver 'hkp://keyserver.ubuntu.com:80' --recv-key C1CF6E31E6BADE8868B172B4F42ED6FBAB17C654

sudo apt-get update -y
sudo apt install -y build-essential cmake curl python3-rosdep python3-rosinstall-generator python3-wstool python3-rosinstall python3-empy python3-pip python3-catkin python3-catkin-pkg python3-catkin-pkg-modules python3-catkin-tools
sudo rosdep init
rosdep update
mkdir -p ~/ros_catkin_ws && cd ~/ros_catkin_ws
mkdir apt_fix && cd apt_fix
sudo apt install -y packaging-dev debian-keyring devscripts equivs
dget -x http://deb.debian.org/debian/pool/main/h/hddtemp/hddtemp_0.3-beta15-54.dsc
cd hddtemp-0.3-beta15
sudo mk-build-deps --install --remove
dpkg-buildpackage -us -uc
sudo apt install -y ../hddtemp_*_*.deb
sudo apt purge -y hddtemp-build-deps
cd ..
wget http://ports.ubuntu.com/pool/universe/g/geographiclib/geographiclib-tools_1.52-1_arm64.deb
wget http://ftp.de.debian.org/debian/pool/main/g/geographiclib/libgeographic17_1.49-4_arm64.deb
sudo apt-get install liborocos-kdl1.4
wget http://ftp.de.debian.org/debian/pool/main/l/log4cxx/liblog4cxx11_0.11.0-2_arm64.deb
wget http://ftp.debian.org/debian/pool/main/l/log4cxx/liblog4cxx-dev_0.11.0-2_arm64.deb
sudo apt install -y ./libgeographic17_1.49-4_arm64.deb 
sudo apt install -y ./libgeographic-dev_1.49-2_amd64.deb 
sudo apt install -y ./libgeographic-dev_1.49-2_arm64.deb 
wget http://ftp.de.debian.org/debian/pool/main/g/geographiclib/libgeographic-dev_1.51-1_arm64.deb
sudo apt install -y ./libgeographic-dev_1.51-1_arm64.deb 
wget https://debian.pkgs.org/10/debian-main-arm64/libgeographic-dev_1.49-4_arm64.deb.html
wget http://ftp.de.debian.org/debian/pool/main/g/geographiclib/libgeographic-dev_1.49-4_arm64.deb
sudo apt install -y ./libgeographic-dev_1.49-4_arm64.deb 
wget http://ports.ubuntu.com/pool/universe/o/orocos-kdl/liborocos-kdl1.4_1.4.0-7ubuntu1_arm64.deb
sudo apt install -y ./liborocos-kdl1.4_1.4.0-7ubuntu1_arm64.deb 
wget http://ports.ubuntu.com/pool/universe/o/ogre-1.9/libogre-1.9.0v5_1.9.0+dfsg1-12build1_arm64.deb
sudo apt install -y ./libogre-1.9.0v5_1.9.0+dfsg1-12build1_arm64.deb 
wget http://ports.ubuntu.com/pool/main/b/boost1.71/libboost-thread1.71-dev_1.71.0-6ubuntu6_arm64.deb
sudo apt install -y ./libboost-thread1.71-dev_1.71.0-6ubuntu6_arm64.deb 
sudo apt install -y ./libogre-1.9.0v5_1.9.0+dfsg1-12build1_arm64.deb 
sudo apt install libogre-1.9.0v5
sudo apt install -y ./libogre-1.9.0v5_1.9.0+dfsg1-12build1_arm64.deb 
wget http://ports.ubuntu.com/pool/universe/b/boost1.71/libboost1.71-all-dev_1.71.0-6ubuntu6_arm64.deb
sudo apt install -y ./libboost1.71-all-dev_1.71.0-6ubuntu6_arm64.deb 
wget http://ports.ubuntu.com/pool/main/b/boost1.71/libboost-thread1.71-dev_1.71.0-6ubuntu6_arm64.deb
sudo apt install -y ./libboost-thread1.71-dev_1.71.0-6ubuntu6_arm64.deb 
sudo apt install -y ./libboost1.71-all-dev_1.71.0-6ubuntu6_arm64.deb 
wget https://packages.ubuntu.com/source/focal/boost1.71
sudo apt install -y ./boost1.71
wget http://ports.ubuntu.com/pool/main/b/boost1.71/libboost1.71-dev_1.71.0-6ubuntu6_arm64.deb
sudo apt install -y ./libboost1.71-dev_1.71.0-6ubuntu6_arm64.deb 
sudo apt install -y ./libboost-thread1.71-dev_1.71.0-6ubuntu6_arm64.deb 
wget http://ports.ubuntu.com/pool/main/b/boost1.71/libboost-atomic1.71-dev_1.71.0-6ubuntu6_arm64.deb
sudo apt install -y ./libboost-atomic1.71-dev_1.71.0-6ubuntu6_arm64.deb 
wget  http://ports.ubuntu.com/pool/main/b/boost1.71/libboost-atomic1.71.0_1.71.0-6ubuntu6_arm64.deb
sudo apt install -y ./libboost-atomic1.71.0_1.71.0-6ubuntu6_arm64.deb 
sudo apt install -y ./libboost-atomic1.71-dev_1.71.0-6ubuntu6_arm64.deb 
sudo apt install -y ./libboost-thread1.71-dev_1.71.0-6ubuntu6_arm64.deb 
wget http://ports.ubuntu.com/pool/main/b/boost1.71/libboost-thread1.71.0_1.71.0-6ubuntu6_arm64.deb
sudo apt install -y ./libboost-thread1.71.0_1.71.0-6ubuntu6_arm64.deb 
sudo apt install -y ./libboost1.71-dev_1.71.0-6ubuntu6_arm64.deb 
sudo apt install -y ./libboost-thread1.71-dev_1.71.0-6ubuntu6_arm64.deb 
wget http://ports.ubuntu.com/pool/main/b/boost1.71/libboost-chrono1.71-dev_1.71.0-6ubuntu6_arm64.deb
sudo apt install -y ./libboost-chrono1.71-dev_1.71.0-6ubuntu6_arm64.deb 
http://ports.ubuntu.com/pool/main/b/boost1.71/libboost-chrono1.71.0_1.71.0-6ubuntu6_arm64.deb
wget http://ports.ubuntu.com/pool/main/b/boost1.71/libboost-chrono1.71.0_1.71.0-6ubuntu6_arm64.deb
sudo apt install -y ./libboost-chrono1.71.0_1.71.0-6ubuntu6_arm64.deb 
sudo apt install -y ./libboost-chrono1.71-dev_1.71.0-6ubuntu6_arm64.deb 
sudo apt install -y ./libboost-thread1.71-dev_1.71.0-6ubuntu6_arm64.deb 
wget http://ports.ubuntu.com/pool/main/b/boost1.71/libboost-date-time1.71-dev_1.71.0-6ubuntu6_arm64.deb
sudo apt install -y ./libboost-date-time1.71-dev_1.71.0-6ubuntu6_arm64.deb 
wget http://ports.ubuntu.com/pool/main/b/boost1.71/libboost-date-time1.71.0_1.71.0-6ubuntu6_arm64.deb
sudo apt install -y ./libboost-date-time1.71.0_1.71.0-6ubuntu6_arm64.deb 
sudo apt install -y ./libboost-date-time1.71-dev_1.71.0-6ubuntu6_arm64.deb 
wget http://ports.ubuntu.com/pool/main/b/boost1.71/libboost-serialization1.71.0_1.71.0-6ubuntu6_arm64.deb
sudo apt install -y ./libboost-serialization1.71.0_1.71.0-6ubuntu6_arm64.deb 
wget http://archive.ubuntu.com/ubuntu/pool/main/b/boost1.71/libboost-serialization1.71-dev_1.71.0-6ubuntu6_amd64.deb
sudo apt install -y ./libboost-serialization1.71-dev_1.71.0-6ubuntu6_amd64.deb 
wget http://ports.ubuntu.com/pool/main/b/boost1.71/libboost-serialization1.71-dev_1.71.0-6ubuntu6_arm64.deb
sudo apt install -y ./libboost-serialization1.71-dev_1.71.0-6ubuntu6_arm64.deb 
sudo apt install -y ./libboost-date-time1.71-dev_1.71.0-6ubuntu6_arm64.deb 
sudo apt install -y ./libboost-thread1.71-dev_1.71.0-6ubuntu6_arm64.deb 
wget http://ports.ubuntu.com/pool/main/b/boost1.71/libboost-system1.71.0_1.71.0-6ubuntu6_arm64.deb
sudo apt install -y ./libboost-system1.71.0_1.71.0-6ubuntu6_arm64.deb 
wget http://ports.ubuntu.com/pool/main/b/boost1.71/libboost-system1.71-dev_1.71.0-6ubuntu6_arm64.deb
sudo apt install -y ./libboost-system1.71-dev_1.71.0-6ubuntu6_arm64.deb 
sudo apt install -y ./libboost-thread1.71-dev_1.71.0-6ubuntu6_arm64.deb 
sudo apt install -y ./libogre-1.9.0v5_1.9.0+dfsg1-12build1_arm64.deb 
wget http://ports.ubuntu.com/pool/universe/o/ogre-1.9/libogre-1.9-dev_1.9.0+dfsg1-12.1ubuntu1_arm64.deb
sudo apt install -y ./libogre-1.9-dev_1.9.0+dfsg1-12.1ubuntu1_arm64.deb 
wget http://ports.ubuntu.com/pool/universe/o/ogre-1.9/libogre-1.9.0v5_1.9.0+dfsg1-12.1ubuntu1_arm64.deb
sudo apt install -y ./libogre-1.9.0v5_1.9.0+dfsg1-12.1ubuntu1_arm64.deb 
sudo apt install -y ./libogre-1.9-dev_1.9.0+dfsg1-12.1ubuntu1_arm64.deb 
sudo apt install -y ./liblog4cxx11_0.11.0-2_arm64.deb 
sudo apt install -y ./liblog4cxx-dev_0.11.0-2_arm64.deb 

# Maybe install python2

cd ~/ros_catkin_ws
rosinstall_generator ros_comm --rosdistro noetic --deps --wet-only --tar | tee ./noetic.rosinstall
sudo sed -i 's/yaml.load/yaml.safe_load/g' /usr/lib/python3/dist-packages/vcstools/tar.py
wstool init src ./noetic.rosinstall
cd src
git clone -b master https://github.com/ros/roslint.git
git clone -b noetic-devel https://github.com/ros/diagnostics.git
rm -rf common_msgs && git clone -b noetic-devel https://github.com/ros/common_msgs.git # incomplete
git clone -b master https://github.com/ros/angles.git
git clone -b noetic-devel https://github.com/ros/geometry.git
rm -rf geometry2 && git clone -b noetic-devel https://github.com/ros/geometry2.git # missing tf2_eigen
git clone -b noetic-devel https://github.com/ros/actionlib.git
git clone -b kinetic-devel https://github.com/ros/rosconsole_bridge.git
git clone -b melodic-devel https://github.com/ros/urdf.git
git clone -b noetic-devel https://github.com/ros/dynamic_reconfigure.git
git clone -b noetic-devel https://github.com/ros/nodelet_core.git
git clone -b kinetic-devel https://github.com/ros/bond_core.git
git clone -b noetic-devel https://github.com/ros-perception/image_common.git
git clone -b noetic-devel https://github.com/ros-perception/pcl_msgs.git
git clone -b melodic-devel https://github.com/ros-perception/perception_pcl.git
git clone -b master https://github.com/ros-geographic-info/unique_identifier.git
git clone -b master https://github.com/ros-geographic-info/geographic_info.git
git clone -b noetic-devel https://github.com/clearpathrobotics/robot_upstart.git
git clone -b kinetic-devel https://github.com/ros-controls/control_msgs.git
git clone -b noetic-devel https://github.com/ros-controls/control_toolbox.git
git clone -b noetic-devel https://github.com/ros-controls/realtime_tools.git
# rm -rf mavlink && git clone https://github.com/mavlink/mavlink.git # if version from generator causes compilation errors

cd ../apt-fix
wget http://ftp.de.debian.org/debian/pool/main/b/boost1.67/libboost-thread1.67.0_1.67.0-13+deb10u1_arm64.deb
sudo apt install -y ./libboost-thread1.67.0_1.67.0-13+deb10u1_arm64.deb 
wget http://ftp.de.debian.org/debian/pool/main/b/boost1.67/libboost-atomic1.67.0_1.67.0-13+deb10u1_arm64.deb
sudo apt install -y ./libboost-atomic1.67.0_1.67.0-13+deb10u1_arm64.deb 
wget http://ftp.de.debian.org/debian/pool/main/b/boost1.67/libboost-system1.67.0_1.67.0-13+deb10u1_arm64.deb
sudo apt install -y ./libboost-system1.67.0_1.67.0-13+deb10u1_arm64.deb 
sudo apt install -y ./libboost-thread1.67.0_1.67.0-13+deb10u1_arm64.deb 
rosdep install -y --from-paths src --ignore-src --rosdistro noetic --os=debian:buster -r -j3

wget http://ports.ubuntu.com/pool/universe/b/boost1.74/libboost-log1.74.0_1.74.0-14ubuntu3_arm64.deb

In addition in the first here here ros did not run because of the system python 3.11 version - Instead we should install 3.8.

Installing python3.8 https://www.linuxcapable.com/how-to-install-python-3-8-on-debian-linux/ Use sudo make install instead of sudo make altinstall. ->Kill system python installation.

Weird things sudo pip install -U rosdep

sudo pip install catkin-tools sudo apt-get install python3-catkin-pkg pip3 install python3-catkin-pkg sudo apt-get remove python3-rosdep

PCB

grand_tour_pi_breakout_board.pdf

(Always output trigger - feedback pin) FAN_PWM_25kHz -PWM0_0 -> GPIO18 -GPIO16 (feedback for PWM speed) ->

CAM_PWM_30Hz

  • PWM0_1 -> GPIO19
  • GPIO26

ADIS_CLK_1.6kHz

  • GPCLK0 -> GPIO4
  • GPIO27
    • (SPI)

SAFRAN_CLK_2kHz

  • GPCLK1 -> GPIO5
  • GPIO22
  • (+RS422)

HONEY_CLK_1.2kHz

  • GPCLK2 -> GPIO6
  • GPIO25
  • (+RS422)

NTC (I2C):

  • SCL - I2C1_SCL -> GPIO3
  • SDA - I2C1_SDA -> GPIO2

Links

Clone this wiki locally