Reference car setup - Hiroyuki-Okuda/OpenMiniCarWorks GitHub Wiki

AD-RC Car TT02 Ver.1.00 Setup

[OS]

Raspberry Pi OS / Raspberry Pi Imager https://www.raspberrypi.com/software/

Raspberry Pi OS (32-bit) Bullseye : 2023-05-03 Released https://www.raspberrypi.com/software/operating-systems/#raspberry-pi-os-legacy-32-bit

Raspberry Pi OS (Legacy:Bullseye) with desktop : 2023-05-03 Released https://www.raspberrypi.com/software/operating-systems/#raspberry-pi-os-legacy-64-bit

[Setup]

  1. Connect internet : Wifi / Ethernet

  2. Update OS

sudo apt update sudo apt upgrade sudo pip install --upgrade pip

  1. (Language) 日本語化

  1. Camera setup

check camera availability

cameralib-hello

if cameralib-hello does not work

  • open "/boot/config.txt" file with admin permission (sudo geany /boot/config.txt)

  • add following in [all] section at last of the file [all] dtoverlay=imx708 (see also ラズパイの【libcamera】を使ってみた。) Frenove camera: dtoverlay=imx219 Raspberry Pi Camera V3: dtoverlay=imx708

  • update camera libraries sudo apt install -y python3-libcamera pip3 install picamera2 --upgrade sudo apt upgrade

  • reboot

  • testing camera libcamera-hello

Test legacy camera interface vcgencmd get_camera supported=1, detected=0, libcamera interface=1 (detected can be 0. supported and interface must be 1.)

if supported or interface = 0 config and enable legacy camera sudo raspi-config 3. Interfaces -> 1. Legacy camera -> enable -> reboot then, check vcgencmd get_camera again.


  1. Lidar setup Setup RPLidar A1M8 for python pip install rplidar-roboticia Or sudo pip3 install rplidar-roboticia

  1. Open CV setup numpy and atlas

pip3 install numpy --upgrade sudo apt install libatlas3-base sudo apt-get install libopenblas-base sudo apt install python3-opencv

(下記はなぜかものすごい時間がかかったうえ,失敗した) pip install opencv-python


  1. pigpio setup

(normally not necessary)

sudo apt install pigpio python3-pigpio

set auto launch pidpiod

sudo systemctl enable pigpiod.service

or open the auto-exec setting file

sudo geany /etc/rc.local

and write "pipiod" before exit command

pidpiod exit 0

[Device Tests]

  1. Get AD-RC Car repository for test Here use home directory for testing for example. adrrccar@raspberrypi:~ $ git clone https://github.com/Hiroyuki-Okuda/OpenMiniCarWorks/
  • if you have the error like:

fetch-pack: unexpected disconnect while reading sideband packet fatal: early EOF fatal: index-pack failed

execute the following command to extend the buffer:

sudo git config --global http.postBuffer 524288000

  1. Do tests cd OpenMiniCarWorks/scripts/device_test/rccar_tests

[camera test]

  • cd test_camera
  • python camera_test.py you may find 'test.jpg' if camera works.

[Lidar test]

  • cd test_lidar
  • python RPLidarA1M8_test.py you may see "Got xxx measurements" messages
  • if you find the error ttyUSB0 not found, please check and change micro-USB cable to connect RPLidar A1. The power supply to RPLidar can be a problem.

[Encoder test]

  • cd test_encoder
  • python speed_observer2.py you may see encoder counts and velocity

[Actuation test]

  • connect battery of RC Car
  • cd test_PWM
  • python key_jog.py
  • main switch on (beep sound; servo & speed controller alert when PWM signal for neutral position is missing)
  • Push keiboard to operate. -- 'a':steer left -- 'd':steer right -- 's':speeding up -- 'w':speeding down -- 'n':return to neutral -- 'enter': finish
  • Take note for the following values and threasholds -- Steering / Speed controller neutral (around 9.6 to 10.1) -- Steering left-max, right-max -- Speed forward-max, backward-max

[Note]

  • You need 'double action' for backward driving; 'back'->'neutral'->'back' command enables backward driving
  • Beep sounds means lacking of the PWM signal. Check the connection and pin# for PWM