diff --git a/CHANGELOG.md b/CHANGELOG.md index 16cda1ec..e619a52f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,7 +1,7 @@ # Unreleased Features Please add a note of your changes below this heading if you make a Pull Request. -## [0.4.1] - UNRELEASED +## UNRELEASED ### Added * Hall sensor feedback * Configurable RC PWM input @@ -12,6 +12,13 @@ Please add a note of your changes below this heading if you make a Pull Request. * `encoder.config.bandwidth` # Releases +## [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. diff --git a/Firmware/MotorControl/encoder.cpp b/Firmware/MotorControl/encoder.cpp index f5c76a35..9a6210ce 100644 --- a/Firmware/MotorControl/encoder.cpp +++ b/Firmware/MotorControl/encoder.cpp @@ -25,7 +25,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/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: 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): diff --git a/tools/odrive/version.py b/tools/odrive/version.py index 9c98f0be..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 @@ -70,6 +70,9 @@ if __name__ == '__main__': args = parser.parse_args() git_name, major, minor, revision, unreleased = get_version_from_git() + print('Firmware version {}.{}.{}{} ({})'.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)) 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 diff --git a/tools/setup.py b/tools/setup.py index 961ceec6..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 = 8 +post_rel_num = 0 # To test higher numbered releases, bump to the next rev -bump_rev = not is_post_release -devnum = 1 +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)