How to Connect T265 & Raspberry Pi - DDLdancer/OneWho_Wiki GitHub Wiki

Step by Step Instruction

  1. Ardupilot wiki for T265
  2. Ardupilot Blog for T265 & Raspberry Pi
  3. connect raspberrypi with realsense camera
  4. raspberry-pi-via-mavlink

Notice

1. DIY a cable

  • Connect the PiConnectLite’s serial cable to one of the autopilot’s telemetry ports. You need to make a DIY cable by yourself.
  • Things to prepare
      1) Pixhawk 4 cable with 6pin
      2) Female To Female Dupont Jumper Wire Cable
  • Cut both wires and solder them together following the picture instructions below.

    Keep those 3 wires on the Pixhawk 4 cable.
  • Please be careful to find the pinouts we need to use on the Raspberry Pi (6,8,10).
  • Finally, we need to plug the 6pin head into Telem1 (or Telem2).

2. Set Parameters

3. RaspberryPi configuration for T256

3.1 Update the system

*Do not copy and run the whole code because you'll probably need to check the output of every command and make sure that everything runs smoothly

# add RaspberryPi deb source
echo "deb http://raspbian.raspberrypi.org/raspbian/ buster main contrib non-free rpi" | sudo tee -a /etc/apt/sources.list.d/rpi.list
echo "deb http://archive.raspberrypi.org/debian/ buster main" | sudo tee -a /etc/apt/sources.list.d/rpi.list
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 9165938D90FDDD2E
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 82B129927FA3303E

# Update system
sudo apt update
sudo apt upgrade -y

# Install dependencies
sudo apt-get install -y git libssl-dev libusb-1.0-0-dev pkg-config
sudo apt-get install -y gcc g++ cmake python3-dev raspberrypi-kernel-headers 
sudo apt-get install -y libxinerama-dev libxcursor-dev libx11-dev libxext-dev libxrender-dev libxtst-dev libxt-dev xorg-dev libglu1-mesa-dev # GUI lib

3.2 clone and compile librealsense

*Note that from this step on you'll probably need to use a network proxy for the Raspberrypi due to terrible internet environment in China

# Clone the repository under home
cd ~
git clone https://github.com/IntelRealSense/librealsense.git

# Install udev rules
cd ~/librealsense
sudo cp config/99-realsense-libusb.rules /etc/udev/rules.d/
sudo udevadm control --reload-rules && udevadm trigger

# Create the destination directory
mkdir build && cd build

# Start compiling
# Probably remove extra files if it's not your first run, see the comments below
cmake -D CMAKE_BUILD_TYPE="Release" \
-D FORCE_LIBUVC=ON \
-D BUILD_PYTHON_BINDINGS=ON \
-D BUILD_EXAMPLES=ON ..

make -j4

# Install the library if compiling succeeded
sudo make install
sudo ldconfig

# Finally, reboot the pi:
sudo reboot

Remove extra files if this is not your first compile
xarg sudo rm < install_manifest.txt
rm CMakeCache.txt

3.3 Test that librealsense is installed correctly

Plugin T265 and run rs-enumerate-devices

The results above indicate that your of installation of librealsense is successful

Test pyrealsense2 python wrapper

export PYTHONPATH=$PYTHONPATH:/usr/lib/python3/dist-packages/pyrealsense2
cd ~/librealsense/wrappers/python/examples
python3 t265_example.py

You should see a stream of data coming from the T265.

3.4 Install python's Apriltags

*requires opencv2

3.5

4.1 Install realsense-ros

Create a catkin workspace and init it
if you already have a workspace you won't need to do this

mkdir -p ~/catkin_ws/src
cd ~/catkin_ws/src/
catkin_init_workspace
echo "source ~/catkin_ws/devel/setup.bash" >> ~/.bashrc
source ~/.bashrc

Get into your workspace and clone realsense-ros package from github

cd ~/catkin_ws/src
git clone https://github.com/pal-robotics/ddynamic_reconfigure.git
git clone https://github.com/IntelRealSense/realsense-ros.git
cd realsense-ros/
git checkout `git tag | sort -V | grep -P "^2.\d+\.\d+" | tail -1`

and start compiling

cd ~/catkin_ws
catkin_make clean
catkin_make -DCATKIN_ENABLE_TESTING=False -DCMAKE_BUILD_TYPE=Release
catkin_make install

4.2 Test realsense-ros

run roslaunch realsense2_camera rs_camera.launch
you'll be able to see
realsense roslaunch success
"Realsense Node Is Up" suggests that realsense camera is running