Skip to main content

A Python driver for driving the Rover Robotics OpenRover Basic robot

Project description

OpenRover Python Suite

This is the official Python driver for the Rover Robotics "Open Rover Basic" robot. Use this as a starting point to get up and running quickly.

Included in this package are:

  1. A Python library for programmatically interfacing with the Rover over USB
  2. A command line application "pitstop" for upgrading and configuring the Rover firmware
  3. A test suite that confirms the Firmware and hardware are operating as expected.

Setup

To install official releases from PyPi:

python3 -m pip install -U pip setuptools
python3 -m pip install -U openrover --no-cache-dir

On Linux, you may not have permission to access USB devices. If this is the case, run the following then restart your computer:

sudo usermod -a -G dialout $(whoami)

Development setup

Manual Prerequisites:

  • Python3 (recommended to install Python3.6, Python3.7, and Python3.8)
  • Poetry

Instead, we recommend:

git clone https://github.com/RoverRobotics/openrover-python.git
cd openrover-python
poetry install

Useful commands

For testing, it is recommended to use tox, which can run tests on multiple Python interpreters.

pytest
Test on current Python interpreter
tox
Test on all supported Python minor versions
black .
Reformat code to a uniform style
githooks setup
Install git pre-commit hook to automatically run black

Caveats

  • When running in PyCharm in debug mode, you will get a warning like "RuntimeWarning: You seem to already have a custom sys.excepthook handler installed ..." https://github.com/python-trio/trio/issues/1553
  • Note this is a pyproject (PEP-517) project so it will NOT work to pip install --editable ...

pitstop

Pitstop is a new utility to bootload your rover and set options. After installing, you can invoke it with pitstop or python3 -m openrover.pitstop.

> pitstop --help
usage: pitstop [-h] [-p port] [-f path/to/firmware.hex] [-m version]
               [-u k:v [k:v ...]]

OpenRover companion utility to bootload robot and configure settings.

optional arguments:
  -h, --help            show this help message and exit
  -p port, --port port  Which device to use. If omitted, we will search for a possible rover device
  -f path/to/firmware.hex, --flash path/to/firmware.hex
                        Load the specified firmware file onto the rover
  -m version, --minimumversion version
                        Check that the rover reports at least the given version
                        version may be in the form N.N.N, N.N, or N
  -u k:v [k:v ...], --updatesettings k:v [k:v ...]
                        Send additional commands to the rover. v may be 0-255; k may be:
                                3=SET_POWER_POLLING_INTERVAL_MS
                                4=SET_OVERCURRENT_THRESHOLD_100MA
                                5=SET_OVERCURRENT_TRIGGER_DURATION_5MS
                                6=SET_OVERCURRENT_RECOVERY_THRESHOLD_100MA
                                7=SET_OVERCURRENT_RECOVERY_DURATION_5MS
                                8=SET_PWM_FREQUENCY_KHZ
                                9=SET_BRAKE_ON_ZERO_SPEED_COMMAND
                                11=SET_BRAKE_ON_DRIVE_TIMEOUT
                                12=SET_MOTOR_SLOW_DECAY_MODE
                                13=SET_TIME_TO_FULL_SPEED

tests

To run tests, first attach the rover via breakout cable then run either openrover-test or python3 -m openrover.test. By default, tests that involve running the motors will be skipped, since you may not want a rover ripping cables out of your computer. If you have made sure running the motors will not damage anything, these tests can be opted in with the flag --motorok.

> openrover-test
==================== test session starts =====================
platform win32 -- Python 3.7.3, pytest-4.3.1, py-1.8.0, pluggy-0.9.0
rootdir: ..., inifile:
plugins: trio-0.5.2
collected 32 items

..\openrover\tests\test_bootloader.py .s                [  6%]
..\openrover\tests\test_data.py ..                      [ 12%]
..\openrover\tests\test_find_device.py ....             [ 25%]
..\openrover\tests\test_openrover_protocol.py ....      [ 37%]
..\openrover\tests\test_rover.py .......sssss......ss   [100%]

=========== 24 passed, 8 skipped in 89.14 seconds ============

OpenRover Basic

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

openrover-1.0.0a1.tar.gz (121.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

openrover-1.0.0a1-py3-none-any.whl (125.1 kB view details)

Uploaded Python 3

File details

Details for the file openrover-1.0.0a1.tar.gz.

File metadata

  • Download URL: openrover-1.0.0a1.tar.gz
  • Upload date:
  • Size: 121.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.0.9 CPython/3.8.2 Linux/5.4.0-40-generic

File hashes

Hashes for openrover-1.0.0a1.tar.gz
Algorithm Hash digest
SHA256 2b90b0dff22a58951efdcf63ae7f1f1730576407fa4d86a640f0384996aa6c45
MD5 2736515ca04cbb1308689a749c5c0282
BLAKE2b-256 c213dbc689f96cb495de155ba339abde0840392059a08bf0cce67008712b7ffb

See more details on using hashes here.

File details

Details for the file openrover-1.0.0a1-py3-none-any.whl.

File metadata

  • Download URL: openrover-1.0.0a1-py3-none-any.whl
  • Upload date:
  • Size: 125.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.0.9 CPython/3.8.2 Linux/5.4.0-40-generic

File hashes

Hashes for openrover-1.0.0a1-py3-none-any.whl
Algorithm Hash digest
SHA256 01e0c3ee11bb812d42cc5dc2ad414089ca6c2e5d92a72d43db3fa3698eb0211b
MD5 4cd73accfd5764e32563e7b25a688c91
BLAKE2b-256 9cad5c928540144544a5e590375af95fa1141a3e184e94ae9dc1f2a31b3526fa

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page