Skip to content
This repository has been archived by the owner on Jun 7, 2023. It is now read-only.

Commit

Permalink
update pipfile and .aicoe-ci (#26)
Browse files Browse the repository at this point in the history
  • Loading branch information
MichaelClifford authored Nov 30, 2021
1 parent 5716053 commit 5d08528
Show file tree
Hide file tree
Showing 9 changed files with 2,834 additions and 11 deletions.
22 changes: 11 additions & 11 deletions .aicoe-ci.yaml
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
# Setup and configuring aicoe-ci with configuration file `.aicoe-ci.yaml`
# Example `.aicoe-ci.yaml` with a full list of config options is available here: https://github.com/AICoE/aicoe-ci/blob/master/docs/.aicoe-ci.yaml
---
check: []
# Uncomment following line to build a public image of this repo
# - thoth-build
check:
- thoth-build
# Uncomment following lines to build a public image of this repo
# build:
# build-stratergy: Source
# build-source-script: "image:///opt/app-root/builder"
# base-image: quay.io/thoth-station/s2i-custom-notebook:latest
# registry: quay.io
# registry-org: aicoe
# registry-project: <CHANGE-ME>
# registry-secret: aicoe-pusher-secret
build:
base-image: "quay.io/thoth-station/s2i-elyra-custom-notebook:v0.4.1"
build-source-script: "image:///opt/app-root/builder"
custom-tag: latest
build-strategy: Source
registry: quay.io
registry-org: aicoe
registry-project: summit-2021-octo-keynote
registry-secret: aicoe-pusher-secret
3 changes: 3 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ repos:
rev: 6.1.1
hooks:
- id: pydocstyle
exclude: apps/donkeycars/

- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.0.1
Expand All @@ -51,6 +52,7 @@ repos:
rev: "0.5.0"
hooks:
- id: black-nb
exclude: apps/donkeycars/

# Enable this in repositories with python packages.
# - repo: https://github.com/mgedmin/check-manifest
Expand All @@ -63,6 +65,7 @@ repos:
hooks:
- id: flake8
additional_dependencies: ["pep8-naming"]
exclude: apps/donkeycars/
# Ignore all format-related checks as Black takes care of those.
args:
["--ignore", "E2,W5", "--select", "E,W,F,N", "--max-line-length=120"]
16 changes: 16 additions & 0 deletions Pipfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
[[source]]
url = "https://pypi.org/simple"
verify_ssl = true
name = "pypi"

[packages]
aicoe-donkeycar = "*"
opencv-python-headless = "*"
tensorflow = "*"
pandas = "*"
imgaug = "0.3.0"

[dev-packages]

[requires]
python_version = "3.8"
1,130 changes: 1,130 additions & 0 deletions Pipfile.lock

Large diffs are not rendered by default.

110 changes: 110 additions & 0 deletions apps/donkeycars/default_car/calibrate.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
#!/usr/bin/env python3
"""
Scripts to drive a donkey 2 car
Usage:
manage.py (drive)
Options:
-h --help Show this screen.
"""
import os
import time

from docopt import docopt

import donkeycar as dk

# import parts
from donkeycar.parts.controller import LocalWebController, JoystickController, WebFpv
from donkeycar.parts.throttle_filter import ThrottleFilter
from donkeycar.utils import *

from socket import gethostname


def drive(cfg):
"""
Construct a working robotic vehicle from many parts.
Each part runs as a job in the Vehicle loop, calling either
it's run or run_threaded method depending on the constructor flag `threaded`.
All parts are updated one after another at the framerate given in
cfg.DRIVE_LOOP_HZ assuming each part finishes processing in a timely manner.
Parts may have named outputs and inputs. The framework handles passing named outputs
to parts requesting the same named input.
"""

# Initialize car
V = dk.vehicle.Vehicle()

ctr = LocalWebController(port=cfg.WEB_CONTROL_PORT)
V.add(
ctr,
inputs=["cam/image_array", "tub/num_records"],
outputs=["angle", "throttle", "user/mode", "recording"],
threaded=True,
)

# this throttle filter will allow one tap back for esc reverse
th_filter = ThrottleFilter()
V.add(th_filter, inputs=["throttle"], outputs=["throttle"])

drive_train = None

# Drive train setup
if cfg.DONKEY_GYM or cfg.DRIVE_TRAIN_TYPE == "MOCK":
pass

elif cfg.DRIVE_TRAIN_TYPE == "SERVO_ESC":

from donkeycar.parts.actuator import PCA9685, PWMSteering, PWMThrottle

steering_controller = PCA9685(cfg.STEERING_CHANNEL, cfg.PCA9685_I2C_ADDR, busnum=cfg.PCA9685_I2C_BUSNUM)
steering = PWMSteering(
controller=steering_controller, left_pulse=cfg.STEERING_LEFT_PWM, right_pulse=cfg.STEERING_RIGHT_PWM
)

throttle_controller = PCA9685(cfg.THROTTLE_CHANNEL, cfg.PCA9685_I2C_ADDR, busnum=cfg.PCA9685_I2C_BUSNUM)
throttle = PWMThrottle(
controller=throttle_controller,
max_pulse=cfg.THROTTLE_FORWARD_PWM,
zero_pulse=cfg.THROTTLE_STOPPED_PWM,
min_pulse=cfg.THROTTLE_REVERSE_PWM,
)

drive_train = dict()
drive_train["steering"] = steering
drive_train["throttle"] = throttle

V.add(steering, inputs=["angle"], threaded=True)
V.add(throttle, inputs=["throttle"], threaded=True)

elif cfg.DRIVE_TRAIN_TYPE == "MM1":
from donkeycar.parts.robohat import RoboHATDriver

drive_train = RoboHATDriver(cfg)
V.add(drive_train, inputs=["angle", "throttle"])

ctr.drive_train = drive_train
ctr.drive_train_type = cfg.DRIVE_TRAIN_TYPE

class ShowHowTo:
def __init__(self):
print(f"Go to http://{gethostname()}.local:{ctr.port}/calibrate to calibrate ")

def run(self):
pass

V.add(ShowHowTo())

# run the vehicle for 20 seconds
V.start(rate_hz=cfg.DRIVE_LOOP_HZ, max_loop_count=cfg.MAX_LOOPS)


if __name__ == "__main__":
args = docopt(__doc__)
cfg = dk.load_config()

if args["drive"]:
drive(cfg)
Loading

0 comments on commit 5d08528

Please sign in to comment.