The robot is based on a Raspberry Pi 4. I wanted to make a stereoscopic live broadcast to a VR helmet with head tracking, but unfortunately it turned out that the Raspberry Pi 4 is too slow for that.
So, all that's left is to control the gamepad from the console. The project may prove useful to someone for a variety of purposes.
Plywood 3mm elements for laser cutting:
Main python program:
In the program, the image from the USB camera is zoomed because my camera had a wider viewing angle than the raspberry pi camera.
I was using the Raspberry Pi Imager application to install Raspbian Full(with desktop) on Raspberry Pi.
In my case, I had to execute a series of commands to get everything started:
sudo apt update && sudo apt upgrade -y
sudo apt install -y python3-pip python3-opencv
pip install adafruit-circuitpython-servokit flask flask-cors --break-system-packages
sudo usermod -aG video $USERYou must remember to enable I2C.
To connect to the gamepad I executed the following commands:
sudo rfkill unblock bluetooth
sudo rfkill unblock all
sudo systemctl restart bluetooth
bluetoothctl
power on
agent on
default-agent
scan on
// run pairing mode on the gamepad
pair XXXXX // XXXXX - your gamepad address
trust XXXXX
connect XXXXX
exitNext we create a python environment:
python -m venv env --system-site-packages
source env/bin/activate
pip install adafruit-circuitpython-servokit inputs flask opencv-python
pip install evdev
pip install approxeng.inputand run the program:
sudo ./env/bin/python3 stereocam.pyWhen you restart Rpi, you need only to repeat last command. Gamepad will connect automaticaly everytime when Rpi's gonna ready.
Vertical servo is connected to channel 8, horizontal to channel 12.








Comments