Skip to content
Control steering and throttle of a R/C car via MQTT with Raspberry Pi 3B
Python
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
demo add main template Jun 2, 2019
parts add main template Jun 2, 2019
tests add main template Jun 2, 2019
util add main template Jun 2, 2019
.gitignore add config example Jun 2, 2019
LICENSE Create LICENSE Jun 3, 2019
README.md update readme Jun 3, 2019
config.yml after the experiment Jun 3, 2019
pc_main.py after the experimented Jun 3, 2019
pi_main.py
requirements.txt clean requirements Jun 3, 2019

README.md

RCVehiclePy

This is a Tool to Control steering and throttle of a R/C car via MQTT with Raspberry Pi 3B.

demo_off_road

Table of Contents

Prepare Hardware

Setup Raspberry Pi 3B

  • You can read my simple instruction at here.

Build a car

Access point

We have several ways to connect Host PC and Raspberry Pi in outside.

  • Setting Raspberry Pi as an access point. (documentation)
  • Put a smart phone on a R/C car, and tethering both of them.
  • Put a mobile wifi router on a R/C car.

Getting Started

Connect to Pi via SSH

After setup access points,

$ sudo ssh pi@raspberrypi.local

Setup momo

Momo is a powerfuil WebRTC Native Client. You can follow my instraction at here.

Clone Repository

$ cd ~/
$ git clone https://github.com/shirokunet/RCVehiclePy

Update pip3 (optional)

$ sudo apt-get remove python-pip python3-pip
$ wget https://bootstrap.pypa.io/get-pip.py
$ sudo python3 get-pip.py

Setup Prerequisites

  • Python 3.5.x
  • numpy 1.16.1
  • PyYAML 3.12
$ cd ~/RCVehiclePy/
$ sudo pip3 install -r requirements.txt
$ sudo apt-get install python3-numpy
$ sudo apt-get install python3-yaml

Check Pi's IP address

$ ifconfig
    wlan0: flags=4163 mtu 1500
    inet xx.xx.xx.xx netmask 255.255.255.0

Setup config file

Then chenge config file

$ cd ~/RCVehiclePy/
$ vi config.yml
pi_ip: 'xx.xx.xx.xx'

Lunch MQTT publisher on the Raspberry Pi

$ cd ~/RCVehiclePy/
$ python3 pi_main.py

Set environment on the host PC

Same as the step of the Raspberry Pi.

Lunch MQTT publisher on the host PC

$ cd ~/RCVehiclePy/
$ python3 pc_main.py

Send command to Pi from the host PC

Just push key "UP" or "DOWN" or "LEFT" or "RIGHT" on the terminal.

Stop Program

Type 'Ctrl' + 'c' in both terminals.

Demo

The latency is about 100~300msec. It can be controlled easily even if you watch only the camera streaming. demo_flat_road

camera_flat_road

Acknowledgments

License

This project is licensed under the Apache License 2.0 - see the LICENSE file for details

You can’t perform that action at this time.