I have a raspi-4, 4gb ram. 32gb uSd sandisk card, medium fast, should sort out more 64gb cards for the stockpile Installed apsync-rpi-ubuntu-t265-latest.img via flashing image using balena etcher. Image installed from here: https://firmware.ardupilot.org/Companion/apsync/ Date of file: Thu Sep 3 02:42:00 2020 Install ~10 min Initial wakeup successful user: apsync password apsyn IP: 192.168.2.129 python 3.6.9 installed already Lets walk through the install process: details from here: https://ardupilot.org/rover/docs/common-realsense-depth-camera.html go thru install here: https://github.com/IntelRealSense/librealsense/blob/master/doc/installation_raspbian.md * GCC version: 7.5.0 * cmake version 3.10.2 * before starting, ran [sudo apt update;sudo apt upgrade], 307mb of goodies to be updated * Adding swap -> 2gb * forcing a restart * htop doesnt show the swap space or ram accuratley, weird Package install time * upgrade cmake to 3.11.4 * this process takes forever * make is a long boi * surprisingly only 400mA at 5v for the raspi4 * added small fan as the rpi4 was getting warm * finished upgrading cmake install Protobuf * install isnt working, need to find different route, went with sudo apt install python3-protobuf - not sure if this is right, need to look into this more, * installed protobuf via sudo snap install protobuf --classic Install TBB * this does not work because i'm running arm64(raspi4) not armhf (raspi3) * trying to install from http://launchpadlibrarian.net/235475110/libtbb-dev_4.4~20151115-0ubuntu3_arm64.deb - some success: dpkg: dependency problems prevent configuration of libtbb-dev:arm64: libtbb-dev:arm64 depends on libtbb2 (= 4.4~20151115-0ubuntu3); however: Version of libtbb2:arm64 on system is 2017~U7-8. dpkg: error processing package libtbb-dev:arm64 (--install): dependency problems - leaving unconfigured * notes: that package is old as fuck [2016?] * tried a sudo apt-get install libtbb-dev and it works Install opencv * again steps dont work for raspi4, - trying install from https://github.com/mt08xx/files/blob/master/opencv-rpi/raspbian-buster/libopencv4_4.2.0-20191223.1_armv7l.deb - trying a simpler approach: "pip3 install opencv-python" * ran into issue: ModuleNotFoundError: No module named 'skbuild' * ran "pip3 install --upgrade pip" - Re-running "pip3 install opencv-python" * successfully installed! - running "pip3 install pyrealsense2" * no matching distribution found for pyrealsense2 * literally does not work for non x86, neato -following instructions from [install RealSense SDK/librealsense] https://github.com/IntelRealSense/librealsense/blob/master/doc/installation_raspbian.md -worked fine: cmake .. -DBUILD_EXAMPLES=true -DCMAKE_BUILD_TYPE=Release -DFORCE_LIBUVC=true -running make, should take a while: 100% cpu on one of the 4 cores, shows as 400mA at 5v -died at 12% with a compiler error - ok this isnt gonna work, lets try something else - sorting out swapfile: sudo apt-get install dphys-swapfile sudo nano /etc/dphys-swapfile - CONF_SWAPSIZE=2048 - sudo /etc/init.d/dphys-swapfile restart swapon -s - swap still not showing up in htop, may need to actually restart : / - this is possibly an artifact of running ubuntu on the pi4 - Different guide thats raspi4 specific * https://github.com/acrobotic/Ai_Demos_RPi/wiki/Raspberry-Pi-4-and-Intel-RealSense-D435 * start with an update: sudo apt-get update && sudo apt-get dist-upgrade * git clone https://github.com/IntelRealSense/librealsense.git * cd librealsense * sudo cp config/99-realsense-libusb.rules /etc/udev/rules.d/ Install time! - moved protobuf old -> protobuf2 - git clone --depth=1 -b v3.10.0 https://github.com/google/protobuf.git - running ./autogen.sh (takes a bit does some things) - running ./configure (does a lot of things and 'checking' a lot of things) - running make -j1 (takes a while, does a bit of making, update like 30 minutes of awhile) * complained a bit about protobuf/message_lite.lo -running "sudo make install" -running everything up to python3 setup.py build --cpp_implementation python3 setup.py test --cpp_implementation sudo python3 setup.py install --cpp_implementation * yaay protobuf [libprotoc 3.10.0 installed!] Install libtbb-dev parallelism library for C++: (im doubtful this works) - yeah it doesnt work because raspi4 isnt armhf : / going to ignore this for now Install RealSense SDK librealsense: * cd ~/librealsense * mkdir build && cd build * cmake .. -DBUILD_EXAMPLES=true -DCMAKE_BUILD_TYPE=Release -DFORCE_LIBUVC=true * make -j1 (seems to be working, taking its time!) -died at 13% ds5-motion.cpp.o -trying to cheat with a sudo make -j1 WAIT THIS LOOKS LIKE A MEMORY THING, ITS SHOWING 855/908MB RAM AND NO SWAP, MAYBE WHY IT FAILS. Glerg so HTOP shows 1gb ram, unit should have 2 or 4gb ram, also 0 swap. NEED TO FIX THE RAM / SWAP THING check if other raspi 4 is also 1gb ram?_? oh man other raspi is a 4gb not a friggin 1gb, yessss 4gb raspi shows 4gb ram, and also boots with same usd card, yessss re-running cmake & make -j1, seeing it hovering around 650mb ram, peak 1.7gb @8% build. ok its taking its time ~50 min? it finished at 8% ?? running sudo make install SEEMED TO WORK ! Install RealSense SDK pyrealsense2 Python bindings for librealsense: * running cmake .. -DBUILD_PYTHON_BINDINGS=bool:true -DPYTHON_EXECUTABLE=$(which python3) * running make -j1 * seems to still only run on one core ?_? * YAAY 100% INSTALL tried running d4xx_to_mavlink.py (python3 d4xx_to_mavlink.py) but it died with: * gi.require_version('Gst', '1.0') tried sudo apt-get install gstreamer-1.0 it also complained tried sudo apt --fix-broken install re-trying lol it worked, installed gstreamer-1.0 python script still crashes tried sudo apt-get install gir1.2-gst-rtsp-server-1.0 also trying pip install PyQt5 something is not working and im not sure what at this point Ok, lets start from scratch and see if we can do this from a ubuntu 20.04 server image for raspi4 using image: ubuntu-20.04.2-preinstalled-server-arm64+raspi.img * Flashing onto 32gb uSd card using balena etcher * installing on a raspi4 4gb ram board * up and running 4gb ram shows up on htop * following from here: https://github.com/IntelRealSense/librealsense/blob/master/doc/installation_raspbian.md - ran sudo apt-get update; sudo apt-get upgrade - chugs along, uname-a shows: Linux ubuntu 5.4.0-1028-raspi aarch64 aarch64 aarch64 GNU/Linux - somehow gcc isnt installed by default, so install gcc: * sudo apt install gcc * this takes a bit * gcc -v shows: gcc version 9.3.0 (Ubuntu 9.3.0-17ubuntu1~20.04) - somehow cmake inst installed by default, so install: * sudo apt install cmake * cmake --version: 3.16.3 * start installing things: - sudo apt-get install -y libglu1-mesa libglu1-mesa-dev mesa-utils mesa-utils-extra xorg-dev libgtk-3-dev libusb-1.0-0-dev * this takes a bit - sudo apt-get install -y libglu1-mesa libglu1-mesa-dev glusterfs-common libglu1-mesa libglu1-mesa-dev * install realsense stuff - git clone https://github.com/IntelRealSense/librealsense.git - cd librealsense - sudo cp config/99-realsense-libusb.rules /etc/udev/rules.d/ - sudo udevadm control --reload-rules && udevadm trigger neat everything worked this time : ] * set path - nano ~/.bashrc add in: #export LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH - source ~/.bashrc * install protobuf - cd .. - git clone --depth=1 -b v3.10.0 https://github.com/google/protobuf.git - cd protobuf - for whatever reason autoconf was not installed, so install it: sudo apt-get install autoconf - for whatever reason libtool is not installed, install libtool - ./autogen.sh *its doing things - for whatever reason, g++ is missing, apt-get install g++ - ./configure - make -j1 * this takes a while. on a pi 4 with a lil fan, like an hour? - sudo make install - cd python - export LD_LIBRARY_PATH=../src/.libs - looks like python3 isnt happy, sudo apt-get install python3-dev - python3 setup.py build --cpp_implementation - python3 setup.py test --cpp_implementation - sudo python3 setup.py install --cpp_implementation - export PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION=cpp - export PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION_VERSION=3 - sudo ldconfig - protoc --version YAAY its 3.10.0 * install TBB - ignoring instructions, using sudo apt-get install libtbb-dev * we're gonna skip installing OPENCV just yet, will return to it eventiually * install RealSense SDK/librealsense - cd .. - cd .. - cd librealsense - mkdir build && cd build - cmake .. -DBUILD_EXAMPLES=true -DCMAKE_BUILD_TYPE=Release -DFORCE_LIBUVC=true * it worked! - make -j1 * this may take some time(34% and its been 45min) * 44% = 57min : / * 55% = 1hr 10min * lost track idk nearly 2hrs - sudo make install *Install RealSense SDK - cd ~/librealsense/build - cmake .. -DBUILD_PYTHON_BINDINGS=bool:true -DPYTHON_EXECUTABLE=$(which python3) - make -j1 * this is also taking some time @__@ - sudo make install *Modify the path by adding the following line to the .bashrc file: - export PYTHONPATH=$PYTHONPATH:/usr/local/lib *Apply the change: - source ~/.bashrc *Install OpenGL: - sudo apt-get install python-opengl - sudo -H pip3 install pyopengl - sudo -H pip3 install pyopengl_accelerate==3.1.3rc1 *Install raspi-config, because its missing in ubuntu - wget https://archive.raspberrypi.org/debian/pool/main/r/raspi-config/raspi-config_20200601_all.deb -P /tmp - sudo apt-get install libnewt0.52 whiptail parted triggerhappy lua5.1 alsa-utils -y - # Auto install dependancies on eg. ubuntu server on RPI - sudo apt-get install -fy - sudo dpkg -i /tmp/raspi-config_20200601_all.deb * may be making a mistake here, installing lightdm (for remote desktoping), remove if not actually needed? install sudo raspi-config so i can use uart ****************************** Ok so we're starting over again, and just folllowing this exactly and see where we get: https://github.com/acrobotic/Ai_Demos_RPi/wiki/Raspberry-Pi-4-and-Intel-RealSense-D435 I flashed a desktop image onto a 64gb card, 2021-01-11-raspios-buster-armhf was the image chosen i have the full desktop up and running for this test, ssh enabled, serial port enabled Pre-install Requirements * sudo apt-get update && sudo apt-get dist-upgrade * sudo apt-get install automake libtool vim cmake libusb-1.0-0-dev libx11-dev xorg-dev libglu1-mesa-dev expand file system: * sudo raspi-config -> advanced options Increase swap size: * sudo nano /etc/dphys-swapfile * sudo /etc/init.d/dphys-swapfile restart swapon -s Create a new udev rule: * git clone https://github.com/IntelRealSense/librealsense.git * cd librealsense * sudo cp config/99-realsense-libusb.rules /etc/udev/rules.d/ Apply the change (needs to be run by root): * sudo su * udevadm control --reload-rules && udevadm trigger * exit Modify the path by adding the following line to the .bashrc file: * export LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH Apply the change: * source ~/.bashrc Installation TIME BABIEEE. I have the gui desktop up with HTOP open for monitoring status: * Install protobuf — Google's language-neutral, platform-neutral, extensible mechanism for serializing structured data: - cd ~ - git clone --depth=1 -b v3.10.0 https://github.com/google/protobuf.git - cd protobuf - ./autogen.sh In previous tests this fucked up a bit, so keeping an eye on it.huh it worked - ./configure dang it worked - make -j1 (time this, it takes a bit, about 30 min) - sudo make install - cd python - export LD_LIBRARY_PATH=../src/.libs - python3 setup.py build --cpp_implementation - sudo python3 setup.py install --cpp_implementation - export PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION=cpp - export PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION_VERSION=3 - sudo ldconfig - protoc --version * Install libtbb-dev parallelism library for C++: - cd ~ - wget https://github.com/PINTO0309/TBBonARMv7/raw/master/libtbb-dev_2018U2_armhf.deb - sudo dpkg -i ~/libtbb-dev_2018U2_armhf.deb - sudo ldconfig - rm libtbb-dev_2018U2_armhf.deb * Install RealSense SDK librealsense: - cd ~/librealsense - mkdir build && cd build - cmake .. -DBUILD_EXAMPLES=true -DCMAKE_BUILD_TYPE=Release -DFORCE_LIBUVC=true - make -j1 * probably gonna take a bit, started at 954pm, its 43% at 1040pm -__- 75% at 1058pm * yes it is taking its time 83% at 1106, inished 1115 - sudo make install * Install RealSense SDK pyrealsense2 Python bindings for librealsense: - cd ~/librealsense/build - cmake .. -DBUILD_PYTHON_BINDINGS=bool:true -DPYTHON_EXECUTABLE=$(which python3) - make -j1 * also going to take a bit, started at 11:35. finished at 1232, so about an hour - sudo make install * Modify the path by adding the following line to the .bashrc file: - export PYTHONPATH=$PYTHONPATH:/usr/local/lib * Apply the change: - source ~/.bashrc HOT DANG THAT WORKED! Made a backup copy of the 64gb uSd card. Kinda wished i used a 16gb card as 64gb backups are big and take 14min to read and 30min to write. This thing doesnt need 64gb of space either Used win32diskimager to do backups, worked well. Lets try examples export PYTHONPATH=$PYTHONPATH:/usr/local/lib cd ~/librealsense/wrappers/python/examples hmm there are issues actually running examples sudo cp ~/librealsense/wrappers/python/pyrealsense2/__init__.py /usr/lib/python3/dist-packages/pyrealsense2/ Download time change to home directory /pi/ git clone https://github.com/thien94/vision_to_mavros.git cd vision_to_mavros/script chmod +x d4xx_to_mavlink.py chmod +x opencv_depth_filtering.py pip3 install apscheduler pip3 install -U pymavlink pip3 install opencv-python pip3 install opencv-contrib-python; sudo apt-get install -y libatlas-base-dev libhdf5-dev libhdf5-serial-dev libatlas-base-dev libjasper-dev libqtgui4 libqt4-test * this takes a bit, like an hour? gstreamer is sad sudo apt-get install gstreamer-1.0 sudo apt-get install gstreamer1.0-dev sudo apt-get install libgstrtspserver-1.0-dev gstreamer1.0-rtsp sudo apt-get install gstreamer1.0-plugins-ugly sudo pip install dronekit >looks like it didnt quite install? < sudo apt-get install libxml2-dev libxslt-dev python-dev Nice, i can now run d4xx_to_mavlink.py. Lets make a backup copy!