odrive tool

master
Drew Bednar 3 years ago
parent 98ea7d9bf8
commit 797a3d6dd1

@ -11,9 +11,24 @@ brew install libusb
``` ```
``` ```
pip install odrive pip install -r dev_requirements.txt
pip install -r requirements.txt
``` ```
## The Odrive interface ## The Odrive interface
https://docs.odriverobotics.com/odrivetool.html https://docs.odriverobotics.com/odrivetool.html
## The examples
The motors used in the example are from Alibaba and listed as
[24V 36V 48V 6.5 inch wheel hub motor RBE-102036-002 with encoder for robot].
[24V 36V 48V 6.5 inch wheel hub motor RBE-102036-002 with encoder for robot]: https://www.alibaba.com/product-detail/24V-36V-48V-6-5-inch_60843979831.html?spm=a2700.galleryofferlist.normal_offer.d_title.646a42f9aowWtJ

@ -1,30 +1,56 @@
# #
# This file is autogenerated by pip-compile # This file is autogenerated by pip-compile with python 3.8
# To update, run: # To update, run:
# #
# pip-compile dev_requirments.in # pip-compile dev_requirments.in
# #
appdirs==1.4.3 # via black appdirs==1.4.3
attrs==19.3.0 # via black, pytest # via black
black==19.10b0 # via -r dev_requirments.in attrs==19.3.0
click==7.1.1 # via black, pip-tools # via
entrypoints==0.3 # via flake8 # black
flake8==3.7.9 # via -r dev_requirments.in # pytest
importlib-metadata==1.5.0 # via pluggy, pytest black==19.10b0
mccabe==0.6.1 # via flake8 # via -r dev_requirments.in
more-itertools==8.2.0 # via pytest click==7.1.1
packaging==20.3 # via pytest # via
pathspec==0.7.0 # via black # black
pip-tools==4.5.1 # via -r dev_requirments.in # pip-tools
pluggy==0.13.1 # via pytest entrypoints==0.3
py==1.8.1 # via pytest # via flake8
pycodestyle==2.5.0 # via flake8 flake8==3.7.9
pyflakes==2.1.1 # via flake8 # via -r dev_requirments.in
pyparsing==2.4.6 # via packaging mccabe==0.6.1
pytest==5.4.1 # via -r dev_requirments.in # via flake8
regex==2020.2.20 # via black more-itertools==8.2.0
six==1.14.0 # via packaging, pip-tools # via pytest
toml==0.10.0 # via black packaging==20.3
typed-ast==1.4.1 # via black # via pytest
wcwidth==0.1.8 # via pytest pathspec==0.7.0
zipp==3.1.0 # via importlib-metadata # via black
pip-tools==4.5.1
# via -r dev_requirments.in
pluggy==0.13.1
# via pytest
py==1.8.1
# via pytest
pycodestyle==2.5.0
# via flake8
pyflakes==2.1.1
# via flake8
pyparsing==2.4.6
# via packaging
pytest==5.4.1
# via -r dev_requirments.in
regex==2020.2.20
# via black
six==1.14.0
# via
# packaging
# pip-tools
toml==0.10.0
# via black
typed-ast==1.4.1
# via black
wcwidth==0.1.8
# via pytest

@ -0,0 +1,62 @@
from pathlib import Path, PurePath
import click
import yaml
# OPTIONS
config_option = click.option(
'-c',
'--config',
default=PurePath(Path(__file__).parent, Path('odrive.yaml')),
type=Path,
help='A config file for the odrive. Defaults to odrive.yaml.'
)
@click.group()
def cli():
pass
@cli.command('configure')
@config_option
def configure(**options):
"""Configures an Odrive with a provided .yaml file of config values."""
config_file = options['config']
if not config_file.is_file():
raise FileNotFoundError(f'No config file {config_file} found.')
print(options['config'])
class RoboWheelConfig:
"""
Class for configuring an Odrive axis.
"""
# Motor KV
KV_RATING = 10.0
# min/max phase inductance of motor
MIN_PHASE_INDUCTANCE = 0.0 # ?
MAX_PHASE_INDUCTANCE = 0.001 # ?
# Min/Max phase resistance of motor
MIN_PHASE_RESISTANCE = 0.0 # ?
MAX_PHASE_RESISTANCE = 2.5 # ? I think my motor is 1.7 ohm...
ENCODER_PULSE_PER_REV = 3200.0
ENCODER_COUNT_PER_REV = ENCODER_PULSE_PER_REV * 4
# Number of magnets in the motor divided by 2
POLE_PAIR_COUNT = 27.0
# See https://docs.odriverobotics.com/hoverboard
RESISTANCE_CALIB_MAX_VOLTAGE = 4.0 # HB motors are larger with more resistance so he doubled the 2.0 default
REQUESTED_CURRENT_RANGE = 25.0 # lower values are more sensitive default was 60
CURRENT_CONTROL_BANDWIDTH = 100.0 # Motors are also high inductance so the bandwidth to 100 from the default 1000
TORQUE_CONSTANT = 8.27 / KV_RATING
if __name__ == "__main__":
cli()

@ -1 +1,3 @@
odrive==0.4.11 click==7.1.1
odrive
pyyaml

@ -1,40 +1,80 @@
# #
# This file is autogenerated by pip-compile # This file is autogenerated by pip-compile with python 3.8
# To update, run: # To update, run:
# #
# pip-compile requirements.in # pip-compile requirements.in
# #
appnope==0.1.0 # via ipython appnope==0.1.0
backcall==0.1.0 # via ipython # via ipython
certifi==2019.11.28 # via requests backcall==0.1.0
chardet==3.0.4 # via requests # via ipython
cycler==0.10.0 # via matplotlib certifi==2019.11.28
decorator==4.4.2 # via ipython, traitlets # via requests
idna==2.9 # via requests chardet==3.0.4
intelhex==2.2.1 # via odrive # via requests
ipython-genutils==0.2.0 # via traitlets click==7.1.1
ipython==7.13.0 # via odrive # via -r requirements.in
jedi==0.16.0 # via ipython cycler==0.10.0
kiwisolver==1.1.0 # via matplotlib # via matplotlib
matplotlib==3.2.0 # via odrive decorator==4.4.2
monotonic==1.5 # via odrive # via
numpy==1.18.1 # via matplotlib # ipython
odrive==0.4.11 # via -r requirements.in # traitlets
parso==0.6.2 # via jedi idna==2.9
pexpect==4.8.0 # via ipython # via requests
pickleshare==0.7.5 # via ipython intelhex==2.2.1
prompt-toolkit==3.0.4 # via ipython # via odrive
ptyprocess==0.6.0 # via pexpect ipython==7.13.0
pygments==2.6.1 # via ipython # via odrive
pyparsing==2.4.6 # via matplotlib ipython-genutils==0.2.0
pyserial==3.4 # via odrive # via traitlets
python-dateutil==2.8.1 # via matplotlib jedi==0.16.0
pyusb==1.0.2 # via odrive # via ipython
requests==2.23.0 # via odrive kiwisolver==1.1.0
six==1.14.0 # via cycler, python-dateutil, traitlets # via matplotlib
traitlets==4.3.3 # via ipython matplotlib==3.2.0
urllib3==1.25.8 # via requests # via odrive
wcwidth==0.1.8 # via prompt-toolkit monotonic==1.5
# via odrive
numpy==1.18.1
# via matplotlib
odrive==0.4.11
# via -r requirements.in
parso==0.6.2
# via jedi
pexpect==4.8.0
# via ipython
pickleshare==0.7.5
# via ipython
prompt-toolkit==3.0.4
# via ipython
ptyprocess==0.6.0
# via pexpect
pygments==2.6.1
# via ipython
pyparsing==2.4.6
# via matplotlib
pyserial==3.4
# via odrive
python-dateutil==2.8.1
# via matplotlib
pyusb==1.0.2
# via odrive
pyyaml==5.4.1
# via -r requirements.in
requests==2.23.0
# via odrive
six==1.14.0
# via
# cycler
# python-dateutil
# traitlets
traitlets==4.3.3
# via ipython
urllib3==1.25.8
# via requests
wcwidth==0.1.8
# via prompt-toolkit
# The following packages are considered to be unsafe in a requirements file: # The following packages are considered to be unsafe in a requirements file:
# setuptools # setuptools

Loading…
Cancel
Save