adeept / Adeept_RaspTank

Example programs for Adeept RaspTank
MIT License
93 stars 92 forks source link

Raspbian Bookworm 64-bit #36

Open jtakacs opened 10 months ago

jtakacs commented 10 months ago

The setup.py was not working with the latest Raspbian OS, and the image file provided by Adeept was not working with the Raspberry PI 4. I wrote this script to install the dependencies, and to set up the init script. Now everything seems to work, I get video from the camera, the motors/servos react to button presses on the web UI. I still need to assemble the robot, so I can't say for sure this fixes everything, but here is the script if anyone needs it.

#!/bin/bash

# RaspTank setup script for Raspberry Pi 4, OS: Bookworm 64-bit

if [ $(id -u) -ne 0 ]
then
    echo "Please run this script as:"
    echo "sudo ${0}"
    exit 1
fi

set -e
set -x

apt update
apt upgrade -y
apt install -y python-dev-is-python3 python3-pip libfreetype6-dev libjpeg-dev \
    build-essential i2c-tools python3-smbus libatlas-base-dev libgstreamer1.0-0 \
    util-linux procps hostapd iproute2 iw haveged dnsmasq libqt5gui5 libqt5webkit5 \
    libqt5test5 libhdf5-dev libhdf5-serial-dev libatlas-base-dev opencv-data \
    python3-opencv libcamera-v4l2 libcamera-tools
apt clean

pip3 install --break-system-packages luma.oled adafruit-pca9685 rpi_ws281x \
    mpu6050-raspberrypi flask flask_cors websockets RPi.GPIO numpy opencv-contrib-python \
    picamera2 imutils zmq pybase64 psutil

cd /opt
git clone https://github.com/oblique/create_ap
cd create_ap 
make install

cd /opt
git clone https://github.com/adeept/Adeept_RaspTank.git
cd Adeept_RaspTank

cp -vaf ./server/config.txt /etc/config.txt

STARTER=$(readlink -e ./server/webServer.py)
# libcamerify will make legacy opncv code work
LEGACY_CAM=$(which libcamerify)
PY_RUNTIME=$(which python3)

sed -i /etc/rc.local -e "s@^exit 0@${LEGACY_CAM} ${PY_RUNTIME} ${STARTER}\nexit 0\n@"

# updating boot config to enable i2c
echo -ne "\ndtparam=i2c_arm=on\n" >> /boot/config.txt

# fix conflict with onboard Raspberry Pi audio
echo "blacklist snd_bcm2835" > /etc/modprobe.d/snd-blacklist.conf
InnovateFusionLLC commented 10 months ago

Awesome I'll give this a try I recently made a few adjutants and got it working on a pi 3. I wonder if we can get 2 way audio working. I am pretty sure we are using WebRTC with this so we should be able to. I was initially using an Logitech web cam but I am going to swap to a separate pi cam and usb microphone because I think that was part of my issue. I also was truing to implement PyAudio to test our playing stored audio files which was working.

InnovateFusionLLC commented 10 months ago

Yep worked like on my Pi 4 with Bookworm thanks !! Do you have any clue on how we can get 2 way audio going in the GUI ?

jtakacs commented 10 months ago

@LaserGrunt The audio driver is blacklisted, because it clashes with the RGB leds, as far as I know. I'm not planning to use the audio yet, so I can't help you with that.

InnovateFusionLLC commented 10 months ago

Thanks that pints me in the right direction anyways I don't need RGB function