From 7941f2c05b037c9ad321f4fefc6a14f7be27cb84 Mon Sep 17 00:00:00 2001 From: Oskar Weigl Date: Sun, 1 Jul 2018 13:55:38 -0700 Subject: [PATCH 1/9] remove decode_temp broken import --- tools/odrivetool | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/odrivetool b/tools/odrivetool index c3b2f415..e3a3ed22 100755 --- a/tools/odrivetool +++ b/tools/odrivetool @@ -15,7 +15,7 @@ sys.path.insert(0, os.path.join(os.path.dirname(os.path.dirname( import fibre.discovery from fibre import Logger, Event import odrive -from odrive.utils import OperationAbortedException, decode_temp +from odrive.utils import OperationAbortedException from odrive.configuration import * # Flush stdout by default From 955aba11a50a40299f17ec63765dfb705bf95c59 Mon Sep 17 00:00:00 2001 From: Oskar Weigl Date: Sun, 1 Jul 2018 15:42:48 -0700 Subject: [PATCH 2/9] fix axis error motor failed when encoder failed --- Firmware/MotorControl/encoder.cpp | 2 +- tools/setup.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Firmware/MotorControl/encoder.cpp b/Firmware/MotorControl/encoder.cpp index f80f04dc..4eb72f10 100644 --- a/Firmware/MotorControl/encoder.cpp +++ b/Firmware/MotorControl/encoder.cpp @@ -33,7 +33,7 @@ void Encoder::setup() { void Encoder::set_error(Encoder::Error_t error) { error_ |= error; - axis_->error_ |= Axis::ERROR_MOTOR_FAILED; + axis_->error_ |= Axis::ERROR_ENCODER_FAILED; } bool Encoder::do_checks(){ diff --git a/tools/setup.py b/tools/setup.py index d5e38eff..8dcc7cdd 100644 --- a/tools/setup.py +++ b/tools/setup.py @@ -33,7 +33,7 @@ to publish packages with the name odrive. # Set to true to make an official post-release, rather than dev of new version is_post_release = False -post_rel_num = 5 +post_rel_num = 9 # To test higher numbered releases, bump to the next rev bump_rev = not is_post_release From 187acfe4118deedcb9fdc1764dc959f66f12bf69 Mon Sep 17 00:00:00 2001 From: Oskar Weigl Date: Sun, 1 Jul 2018 15:51:44 -0700 Subject: [PATCH 3/9] update changelog --- CHANGELOG.md | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5c977487..98a879ec 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,8 +3,14 @@ Please add a note of your changes below this heading if you make a Pull Request. # Releases -## [0.4.0] - 2018-06-10 +## [0.4.1] - 2018-07-01 +### Fixed +* Encoder errors would show up as Axis error `ERROR_MOTOR_FAILED` instead of `ERROR_ENCODER_FAILED`. +* Various pip install dependencies +* Ability for python tools threads to quit properly +* dfuse error prints now python3 compatible +## [0.4.0] - 2018-06-10 ### Added * Encoder can now go forever in velocity/torque mode due to using circular encoder space. * Protocol supports function return values From 86095e1136d4bd22e6e0508dfd705d119305ce0c Mon Sep 17 00:00:00 2001 From: Oskar Weigl Date: Sun, 1 Jul 2018 16:11:32 -0700 Subject: [PATCH 4/9] add fw version print during build --- tools/odrive/version.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tools/odrive/version.py b/tools/odrive/version.py index 9c98f0be..58d860b4 100644 --- a/tools/odrive/version.py +++ b/tools/odrive/version.py @@ -70,6 +70,9 @@ if __name__ == '__main__': args = parser.parse_args() git_name, major, minor, revision, unreleased = get_version_from_git() + print('Firmware version {}.{}.{}{}, aka {}'.format( + major, minor, revision, '-dev' if unreleased else '', + git_name)) args.output.write('#define FW_VERSION "{}"\n'.format(git_name)) args.output.write('#define FW_VERSION_MAJOR {}\n'.format(major)) args.output.write('#define FW_VERSION_MINOR {}\n'.format(minor)) From 38517801b66dee3706a170d931150dc1687d2acd Mon Sep 17 00:00:00 2001 From: Oskar Weigl Date: Sun, 1 Jul 2018 16:12:50 -0700 Subject: [PATCH 5/9] add fw version print during build --- tools/odrive/version.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/odrive/version.py b/tools/odrive/version.py index 58d860b4..71dcfaa8 100644 --- a/tools/odrive/version.py +++ b/tools/odrive/version.py @@ -70,7 +70,7 @@ if __name__ == '__main__': args = parser.parse_args() git_name, major, minor, revision, unreleased = get_version_from_git() - print('Firmware version {}.{}.{}{}, aka {}'.format( + print('Firmware version {}.{}.{}{} ({})'.format( major, minor, revision, '-dev' if unreleased else '', git_name)) args.output.write('#define FW_VERSION "{}"\n'.format(git_name)) From 3929054e2346e089d6e5abce006d34d03d7a05a9 Mon Sep 17 00:00:00 2001 From: Nathan Kau Date: Sun, 1 Jul 2018 16:15:48 -0700 Subject: [PATCH 6/9] Update odrive/docs/encoders.md to fix typo --- docs/encoders.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/encoders.md b/docs/encoders.md index 47ec0944..8735575f 100644 --- a/docs/encoders.md +++ b/docs/encoders.md @@ -20,7 +20,7 @@ All encoder types that are currently supported require the ODrive to do some sor During encoder offset calibration the rotor must be allowed to rotate without any biased load during startup. That means mass and weak friction loads are fine, but gravity or spring loads are not okay. -In the `odrivetool`, type `.encoder.requested_state = AXIS_STATE_ENCODER_OFFSET_CALIBRATION` Enter. +In the `odrivetool`, type `.requested_state = AXIS_STATE_ENCODER_OFFSET_CALIBRATION` Enter. To verify everything went well, check the following variables: From 127433195f23dc9522c3b230786304bf1dc8c00e Mon Sep 17 00:00:00 2001 From: Oskar Weigl Date: Sun, 1 Jul 2018 21:18:04 -0700 Subject: [PATCH 7/9] use subprocess check_call instead of run to be compatible with python < 3.5 --- tools/odrive/utils.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/odrive/utils.py b/tools/odrive/utils.py index 57effc4f..a69c9ca1 100755 --- a/tools/odrive/utils.py +++ b/tools/odrive/utils.py @@ -153,8 +153,8 @@ def setup_udev_rules(logger): logger.warn("you should run this as root, otherwise it will probably not work") with open('/etc/udev/rules.d/50-odrive.rules', 'w') as file: file.write('SUBSYSTEM=="usb", ATTR{idVendor}=="1209", ATTR{idProduct}=="0d3[0-9]", MODE="0666"\n') - subprocess.run(["udevadm", "control", "--reload-rules"], check=True) - subprocess.run(["udevadm", "trigger"], check=True) + subprocess.check_call(["udevadm", "control", "--reload-rules"]) + subprocess.check_call(["udevadm", "trigger"]) logger.info('udev rules configured successfully') def yes_no_prompt(question, default=None): From 174be018c748d67339ef5c102d742fc402d22f91 Mon Sep 17 00:00:00 2001 From: Oskar Weigl Date: Sun, 1 Jul 2018 21:19:39 -0700 Subject: [PATCH 8/9] reset fixcounter --- tools/setup.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/setup.py b/tools/setup.py index 8dcc7cdd..217e95dd 100644 --- a/tools/setup.py +++ b/tools/setup.py @@ -33,11 +33,11 @@ to publish packages with the name odrive. # Set to true to make an official post-release, rather than dev of new version is_post_release = False -post_rel_num = 9 +post_rel_num = 0 # To test higher numbered releases, bump to the next rev bump_rev = not is_post_release -devnum = 1 +devnum = 0 # TODO: add additional y/n prompt to prevent from erroneous upload From 3e1cfcaf5b1fecea875ca24e54c1790d87b7a0c3 Mon Sep 17 00:00:00 2001 From: Oskar Weigl Date: Sun, 1 Jul 2018 21:34:43 -0700 Subject: [PATCH 9/9] improve pip setup version handling and cleanup --- tools/odrive/version.py | 4 +-- tools/setup.py | 68 +++++++++++++++++++++++------------------ 2 files changed, 40 insertions(+), 32 deletions(-) diff --git a/tools/odrive/version.py b/tools/odrive/version.py index 71dcfaa8..5a2827a3 100644 --- a/tools/odrive/version.py +++ b/tools/odrive/version.py @@ -36,7 +36,7 @@ def get_version_from_git(): print(ex) return "[unknown version]", 0, 0, 0, 1 -def get_version_str(git_only=False, is_post_release=False, bump_rev=False): +def get_version_str(git_only=False, is_post_release=False, bump_rev=False, release_override=False): """ Returns the versions of the tools If git_only is true, the version.txt file is ignored even @@ -57,7 +57,7 @@ def get_version_str(git_only=False, is_post_release=False, bump_rev=False): version = '{}.{}.{}'.format(major, minor, revision) if is_post_release: version += ".post" - elif unreleased: + elif not release_override and unreleased: version += ".dev" return version diff --git a/tools/setup.py b/tools/setup.py index 217e95dd..fcdea0bd 100644 --- a/tools/setup.py +++ b/tools/setup.py @@ -31,13 +31,16 @@ PyPi credentials and that your account has the rights to publish packages with the name odrive. """ +# Set to true to make the current release +is_release = False + # Set to true to make an official post-release, rather than dev of new version is_post_release = False post_rel_num = 0 # To test higher numbered releases, bump to the next rev -bump_rev = not is_post_release devnum = 0 +bump_rev = not is_post_release and not is_release # TODO: add additional y/n prompt to prevent from erroneous upload @@ -50,7 +53,10 @@ creating_package = "sdist" in sys.argv # Load version from Git tag import odrive.version version = odrive.version.get_version_str( - git_only=creating_package, is_post_release=is_post_release, bump_rev=bump_rev ) + git_only=creating_package, + is_post_release=is_post_release, + bump_rev=bump_rev, + release_override=is_release) # If we're currently creating the package we need to autogenerate # a file that contains the version string @@ -85,33 +91,35 @@ if not creating_package: except PermissionError: print("Warning: could not set up udev rules. Run `sudo odrivetool udev-setup` to try again.") -setup( - name = 'odrive', - packages = ['odrive', 'odrive.dfuse', 'fibre'], - scripts = ['odrivetool', 'odrivetool.bat', 'odrive_demo.py'], - version = version, - description = 'Control utilities for the ODrive high performance motor controller', - author = 'Oskar Weigl', - author_email = 'oskar.weigl@odriverobotics.com', - license='MIT', - url = 'https://github.com/madcowswe/ODrive', - keywords = ['odrive', 'motor', 'motor control'], - install_requires = [ - 'ipython', # Used to do the interactive parts of the odrivetool - 'PyUSB', # Required to access USB devices from Python through libusb - 'PySerial', # Required to access serial devices from Python - 'requests', # Used to by DFU to load firmware files - 'IntelHex', # Used to by DFU to download firmware from github - 'matplotlib', # Required to run the liveplotter - 'pywin32 >= 222; platform_system == "Windows"' # Required for fancy terminal features on Windows - ], - package_data={'': ['version.txt']}, - classifiers = [], -) +try: + setup( + name = 'odrive', + packages = ['odrive', 'odrive.dfuse', 'fibre'], + scripts = ['odrivetool', 'odrivetool.bat', 'odrive_demo.py'], + version = version, + description = 'Control utilities for the ODrive high performance motor controller', + author = 'Oskar Weigl', + author_email = 'oskar.weigl@odriverobotics.com', + license='MIT', + url = 'https://github.com/madcowswe/ODrive', + keywords = ['odrive', 'motor', 'motor control'], + install_requires = [ + 'ipython', # Used to do the interactive parts of the odrivetool + 'PyUSB', # Required to access USB devices from Python through libusb + 'PySerial', # Required to access serial devices from Python + 'requests', # Used to by DFU to load firmware files + 'IntelHex', # Used to by DFU to download firmware from github + 'matplotlib', # Required to run the liveplotter + 'pywin32 >= 222; platform_system == "Windows"' # Required for fancy terminal features on Windows + ], + package_data={'': ['version.txt']}, + classifiers = [], + ) -# TODO: include README + # TODO: include README -# clean up -if creating_package: - os.remove(version_file_path) - os.remove(fibre_link) +finally: + # clean up + if creating_package: + os.remove(version_file_path) + os.remove(fibre_link)