Software for controlling a robot over a VPN with a Logitech F310 Gamepad. The robot runs python on a raspberry pi, and is controlled with an arduino. A VPN connection is used to facilitate communication between a PC and the robot over the internet. Specifically, this project uses WireGuard VPN hosted on a private Vultr server.
- PC with Ubuntu 20.04*
- Raspberry Pi with Ubuntu Server 20.04*
- Docker installed on both the Raspberry Pi and PC
- Logitech F310 Gamepad
- A robot with the required configuration
*This code probably works fine on other Ubuntu distributions, but has only been tested on Ubuntu 20.04
- Ensure you can SSH into the Raspberry Pi
- Install all the requirements
- Ensure the robot has an internet connection. This involves messing with
wpa_supplicant
. You may need an ethernet cable at first to connect.
- Follow the guide for setting up a VPN server here.
a. Ensure WireGuard is installed on the Raspberry Pi and your PC.
b. Configure your keys and add them to your server.
c. Ensure your PC's VPN IP will be 10.0.0.2 and your Raspberry Pi's VPN IP will be 10.0.0.3 (or change the code to your preference).
- SSH into the robot.
- Run
tmux
or your favorite terminal manager. - Navigate to
robot/
and run./start.sh
. This will launch the robot's docker container that runs all the code and manages dependencies. - Detach from your session (with
tmux
, this can be accomplished using Ctrl+B and then hitting the D key).
a. At this point, you canexit
your SSH session if you want. - Make sure the gamepad is plugged into your PC.
- On the PC, navigate to
control-station
and run./start.sh
. This launches the control station docker container and sets up the joystick. - The robot should be ready to run!
- Use Ctrl+C to stop the ground station contatiner.
- SSH into the robot.
- Reattach to the terminal session (for
tmux
, this would be atmux attach
or atmux attach -t #
where # is the session ID) - Use Ctrl+C to stop the robot process.
The vpn-test
and serial-test
folders contain docker containers that are run on the server and raspberry Pi respectively. vpn-test
is used to ensure the PC and the VPN server have low latency, while serial-test
is for checking the communication between the Raspberry Pi and the Arduino.