Files
picar/pycar
..
2021-04-20 22:28:38 +09:30

PyCar

This module is the original project for RC Car control, and as such contains the most functionality.

Note that only python 3+ has been tested for support (up to and including python 3.8).

Build

Before building with python or Docker, you should generate protobuf code. If you have Java installed, the easiest way to do this is with the :pycar:copyPythonCode gradle task

./gradlew :pycar:copyPythonCode

Build using setup tools. The easiest way to build is using the gradle task. This will also generate protobuf code if it hasn't already been generated.

./gradlew :pycar:build

Otherwise you can run:

python setup.py bdist_wheel

Docker

A docker image has been created to ease deployment on the raspberry pi.

The docker image is always built on a tag in GitLab CI.

Otherwise, the image can be built by running

docker build --build-arg PYPI_USERNAME=$PYPI_USERNAME --build-arg PYPI_PASSWORD=$PYPI_PASSWORD .

or running the gradle task (which will also generate protobuf code)

./gradlew :pycar:buildDocker

Runtime environment variables

There are two key environment variables that should probably be configured at runtime: CAR_VEHICLE

  • This variable can have two values, and is used to control whether
  • Possible Values:
    • CAR_MOCK (Default, log changes to stdout)
    • CAR_2D
      • Use gpiozero and pigpio to control steering/throttle servos)

CAR_LIDAR

  • This variable controls whether an RPLidar will be used, or a file to load LiDAR scans from.
  • Possible Values:
    • LIDAR_MOCK (Default)
    • {Serial Port}
      • You must have an RPLidar connected via this port to access. For most linux systems such as raspberry pi, this will probably be /dev/ttyUSB0