From ff2bd83568ebb78796e259dcb17076295c49aea0 Mon Sep 17 00:00:00 2001 From: Mark Omo Date: Fri, 30 Nov 2018 13:40:57 -0700 Subject: [PATCH 01/25] Create License File Create License File --- LICENSE.md | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 LICENSE.md diff --git a/LICENSE.md b/LICENSE.md new file mode 100644 index 00000000..7b58d626 --- /dev/null +++ b/LICENSE.md @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2018 Odrive + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. From 11592f9be6f27664dd9f0f80785d4750b360e95a Mon Sep 17 00:00:00 2001 From: Oskar Weigl Date: Thu, 6 Dec 2018 17:04:52 -0800 Subject: [PATCH 02/25] Update hoverboard.md --- docs/hoverboard.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/docs/hoverboard.md b/docs/hoverboard.md index 2e9f6cf4..2851b516 100644 --- a/docs/hoverboard.md +++ b/docs/hoverboard.md @@ -18,6 +18,8 @@ You may wire the motor phases in any order into a motor connector on the ODrive, | Green | Z | | Black | GND | +Note: In order to ber compatible with encoder inputs, the ODrive doesn't have any filtering capacitors on the pins where the hall sensors connect. Therefore to get a reliable hall signal, it is recommended that you add some filter capacitors to these pins. You can see instructions [here](https://discourse.odriverobotics.com/t/encoder-error-error-illegal-hall-state/1047/7?u=madcowswe) + ### Hoverboard motor configuration Standard 6.5 inch hoverboard hub motors have 30 permanent magnet poles, and thus 15 pole pairs. If you have a different motor you need to count the magnets or have a reliable datasheet for this information. From 82665389241daa122d1e0171e1d13e09203e7267 Mon Sep 17 00:00:00 2001 From: Oskar Weigl Date: Thu, 6 Dec 2018 17:05:02 -0800 Subject: [PATCH 03/25] Update hoverboard.md --- docs/hoverboard.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/hoverboard.md b/docs/hoverboard.md index 2851b516..1c0f0ce3 100644 --- a/docs/hoverboard.md +++ b/docs/hoverboard.md @@ -18,7 +18,7 @@ You may wire the motor phases in any order into a motor connector on the ODrive, | Green | Z | | Black | GND | -Note: In order to ber compatible with encoder inputs, the ODrive doesn't have any filtering capacitors on the pins where the hall sensors connect. Therefore to get a reliable hall signal, it is recommended that you add some filter capacitors to these pins. You can see instructions [here](https://discourse.odriverobotics.com/t/encoder-error-error-illegal-hall-state/1047/7?u=madcowswe) +Note: In order to ber compatible with encoder inputs, the ODrive doesn't have any filtering capacitors on the pins where the hall sensors connect. Therefore to get a reliable hall signal, it is recommended that you add some filter capacitors to these pins. You can see instructions [here](https://discourse.odriverobotics.com/t/encoder-error-error-illegal-hall-state/1047/7?u=madcowswe). ### Hoverboard motor configuration From 73bb86440d6fb48ac219a2b4af797bf10a70a9b5 Mon Sep 17 00:00:00 2001 From: Oskar Weigl Date: Sun, 9 Dec 2018 15:21:02 -0800 Subject: [PATCH 04/25] Update getting-started.md --- docs/getting-started.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/getting-started.md b/docs/getting-started.md index d9cc3dd6..8b81f657 100644 --- a/docs/getting-started.md +++ b/docs/getting-started.md @@ -40,7 +40,7 @@ permalink: / -* A power supply (12V-24V for the 24V board variant, 12V-48V for the 48V board variant). A battery is also fine. +* A power supply (12V-24V for the 24V board variant, 12V-48V for the 48V board variant). A battery is also fine. Some advice on choosing a power supply can be found [here](https://things-in-motion.blogspot.com/2018/12/how-to-select-right-power-source-for.html).
What voltage variant do I have?
On all ODrives shipped July 2018 or after have a silkscreen label clearly indicating the voltage variant. From 43bb11f89d3bd9137003d8a4600fff2539c35504 Mon Sep 17 00:00:00 2001 From: Svyatoslav Mishin Date: Fri, 28 Dec 2018 12:50:41 +0300 Subject: [PATCH 05/25] link to ArduinoLib was fixed --- docs/ascii-protocol.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/ascii-protocol.md b/docs/ascii-protocol.md index 951ec214..51ff18ea 100644 --- a/docs/ascii-protocol.md +++ b/docs/ascii-protocol.md @@ -7,7 +7,7 @@ * **Windows:** Use the Zadig utility to set the ODrive's driver to "usbser". Windows will then make the device available as COM port. You can use [PuTTY](https://www.chiark.greenend.org.uk/~sgtatham/putty/) to manually send commands or open the COM port using your favorite programming language * **Linux/macOS:** Run `/dev/tty*` to list all serial ports. The ODrive will show up as `/dev/ttyACM0` on Linux and `/dev/tty.usbmodem[...]` on macOS. Once you know the name, you can use `screen /dev/ttyACM0` (with the correct name) to send commands manually or open the device using your favorite programming language. Serial ports on Unix can be opened, written to and read from like a normal file. * **Via UART:** Connect the ODrive's TX (GPIO1) to your host's RX. Connect your ODrive's RX (GPIO2) to your host's TX. The logic level of the ODrive is 3.3V. - * **Arduino:** You can use the [ODrive Arduino library](https://github.com/madcowswe/ODriveArduino) to talk to the ODrive. + * **Arduino:** You can use the [ODrive Arduino library](https://github.com/madcowswe/ODrive/tree/master/Arduino/ODriveArduino) to talk to the ODrive. * **Windows/Linux/macOS:** You can use an FTDI USB-UART cable to connect to the ODrive. ## Command format From a676071cef1aca853a3ca067aeece14e074674a6 Mon Sep 17 00:00:00 2001 From: Jasper Galvin Date: Thu, 3 Jan 2019 18:51:21 +0800 Subject: [PATCH 06/25] Update getting-started.md I was trying to work out how to enable To enable Circular position control but could only find info on discord so added here --- docs/getting-started.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/docs/getting-started.md b/docs/getting-started.md index 8b81f657..9408b23d 100644 --- a/docs/getting-started.md +++ b/docs/getting-started.md @@ -288,6 +288,9 @@ Use the `move_to_pos` function to move to an absolute position: ``` ### Circular position control + +To enabel Circular position control 'axis.controller.config.setpoints_in_cpr = True' + This mode is useful for continuos incremental position movement. For example a robot rolling indefinitely, or an extruder motor or conveyor belt moving with controlled increments indefinitely. In the regular position mode, the `pos_setpoint` would grow to a very large value and would lose precision due to floating point rounding. From 7d99aff2fe9d1504f3b564b5b60478c6e49071c5 Mon Sep 17 00:00:00 2001 From: Pattinson Date: Thu, 3 Jan 2019 12:18:58 -0800 Subject: [PATCH 07/25] Update hyperlink to "ODrive Arduino Library" Update link to https://github.com/madcowswe/ODrive/tree/master/Arduino/ODriveArduino --- docs/ascii-protocol.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/ascii-protocol.md b/docs/ascii-protocol.md index 951ec214..51ff18ea 100644 --- a/docs/ascii-protocol.md +++ b/docs/ascii-protocol.md @@ -7,7 +7,7 @@ * **Windows:** Use the Zadig utility to set the ODrive's driver to "usbser". Windows will then make the device available as COM port. You can use [PuTTY](https://www.chiark.greenend.org.uk/~sgtatham/putty/) to manually send commands or open the COM port using your favorite programming language * **Linux/macOS:** Run `/dev/tty*` to list all serial ports. The ODrive will show up as `/dev/ttyACM0` on Linux and `/dev/tty.usbmodem[...]` on macOS. Once you know the name, you can use `screen /dev/ttyACM0` (with the correct name) to send commands manually or open the device using your favorite programming language. Serial ports on Unix can be opened, written to and read from like a normal file. * **Via UART:** Connect the ODrive's TX (GPIO1) to your host's RX. Connect your ODrive's RX (GPIO2) to your host's TX. The logic level of the ODrive is 3.3V. - * **Arduino:** You can use the [ODrive Arduino library](https://github.com/madcowswe/ODriveArduino) to talk to the ODrive. + * **Arduino:** You can use the [ODrive Arduino library](https://github.com/madcowswe/ODrive/tree/master/Arduino/ODriveArduino) to talk to the ODrive. * **Windows/Linux/macOS:** You can use an FTDI USB-UART cable to connect to the ODrive. ## Command format From 1627666cdfce8ee2f23b52dda03d100b374b633d Mon Sep 17 00:00:00 2001 From: Oskar Weigl Date: Thu, 3 Jan 2019 17:00:26 -0800 Subject: [PATCH 08/25] Update getting-started.md --- docs/getting-started.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/getting-started.md b/docs/getting-started.md index 9408b23d..e0991902 100644 --- a/docs/getting-started.md +++ b/docs/getting-started.md @@ -289,7 +289,7 @@ Use the `move_to_pos` function to move to an absolute position: ### Circular position control -To enabel Circular position control 'axis.controller.config.setpoints_in_cpr = True' +To enable Circular position control, set 'axis.controller.config.setpoints_in_cpr = True' This mode is useful for continuos incremental position movement. For example a robot rolling indefinitely, or an extruder motor or conveyor belt moving with controlled increments indefinitely. In the regular position mode, the `pos_setpoint` would grow to a very large value and would lose precision due to floating point rounding. From b1a0f2958edf4928067970b99c26f49290e035ad Mon Sep 17 00:00:00 2001 From: Paul Guenette Date: Fri, 4 Jan 2019 23:18:40 -0500 Subject: [PATCH 09/25] Add note re gcc 8.2.1 --- docs/developer-guide.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/docs/developer-guide.md b/docs/developer-guide.md index ecf3e1ea..03afa0c8 100644 --- a/docs/developer-guide.md +++ b/docs/developer-guide.md @@ -80,7 +80,9 @@ __Note__: make sure these programs are not only installed but also added to your Some instructions in this document may assume that you're using a bash command prompt, such as the Windows 10 built-in bash or [Git](https://git-scm.com/download/win) bash. -* [ARM compiler](https://developer.arm.com/open-source/gnu-toolchain/gnu-rm/downloads) __Note__: After installing, create an environment variable named `ARM_GCC_ROOT` whose value is the path you installed to. e.g. `C:\Program Files (x86)\GNU Tools Arm Embedded\7 2018-q2-update`. This variable is used to locate include files for the c/c++ Visual Studio Code extension. +* [ARM compiler](https://developer.arm.com/open-source/gnu-toolchain/gnu-rm/downloads) + * __Note 1__: After installing, create an environment variable named `ARM_GCC_ROOT` whose value is the path you installed to. e.g. `C:\Program Files (x86)\GNU Tools Arm Embedded\7 2018-q2-update`. This variable is used to locate include files for the c/c++ Visual Studio Code extension. + * __Note 2__: 8-2018-q4-major seems to have a bug on Windows. Please use 7-2018-q2-update. * [Tup](http://gittup.org/tup/index.html) * [Make for Windows](http://gnuwin32.sourceforge.net/packages/make.htm) * [OpenOCD](http://gnuarmeclipse.github.io/openocd/install/). Also follow the instructions on the ST-LINK/V2 drivers. From 5143cc505561a135b28f124d287ed93c250eece4 Mon Sep 17 00:00:00 2001 From: Paul Guenette Date: Thu, 10 Jan 2019 03:27:19 -0500 Subject: [PATCH 10/25] Fix CHANGELOG.md link --- docs/developer-guide.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/developer-guide.md b/docs/developer-guide.md index 03afa0c8..8083e16b 100644 --- a/docs/developer-guide.md +++ b/docs/developer-guide.md @@ -5,7 +5,7 @@ As such it assumes that you know things like how to use Git, what a compiler is, The official releases are maintained on the `master` branch. However since you are a developer, you are encouraged to use the `devel` branch, as it contains the latest features. -The project is under active development, so make sure to check the [Changelog](CHANGELOG.md) to keep track of updates. +The project is under active development, so make sure to check the [Changelog](../CHANGELOG.md) to keep track of updates. ### Table of contents From 5708465aea0ec5ef986e83fd7cc7e20a323cd25a Mon Sep 17 00:00:00 2001 From: Oskar Weigl Date: Thu, 10 Jan 2019 18:40:17 -0800 Subject: [PATCH 11/25] Update LICENSE.md --- LICENSE.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/LICENSE.md b/LICENSE.md index 7b58d626..977309e4 100644 --- a/LICENSE.md +++ b/LICENSE.md @@ -1,6 +1,6 @@ MIT License -Copyright (c) 2018 Odrive +Copyright (c) 2016-2018 ODrive Robotics Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal From 7ad679c4494dec40d3aec17acdbaeb114dc471e2 Mon Sep 17 00:00:00 2001 From: Oskar Weigl Date: Thu, 10 Jan 2019 19:19:58 -0800 Subject: [PATCH 12/25] Update troubleshooting.md --- docs/troubleshooting.md | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/troubleshooting.md b/docs/troubleshooting.md index c05c7f92..a441ef95 100644 --- a/docs/troubleshooting.md +++ b/docs/troubleshooting.md @@ -32,6 +32,7 @@ The axis error may say that some other component has failed. Say it reports `ERR * Axis error flags defined [here](../Firmware/MotorControl/axis.hpp). * Motor error flags defined [here](../Firmware/MotorControl/motor.hpp). * Encoder error flags defined [here](../Firmware/MotorControl/encoder.hpp). +* Controller error flags defined [here](../Firmware/MotorControl/controller.hpp). * Sensorless estimator error flags defined [here](../Firmware/MotorControl/sensorless_estimator.hpp). ## Common Axis Errors From bf39862748217c0a62bee97404230ed84bb31f09 Mon Sep 17 00:00:00 2001 From: jusic Date: Sun, 13 Jan 2019 22:44:44 +0200 Subject: [PATCH 13/25] Update odrivetool.md, how to use dfu-util on macOS Add notes about using dfu-util on macOS. I successfully restored the firmware on macOS High Sierra to a ODrive 3.5 (48V) after a failed odrivetool dfu upload. The only caveat in these instructions is that I don't know any easy way to get objcopy on macOS, so I used a separate Ubuntu VM to convert the firmware .elf to a .bin. --- docs/odrivetool.md | 32 +++++++++++++++++++++++++++++--- 1 file changed, 29 insertions(+), 3 deletions(-) diff --git a/docs/odrivetool.md b/docs/odrivetool.md index 18dc7b0d..5a8d4358 100644 --- a/docs/odrivetool.md +++ b/docs/odrivetool.md @@ -135,9 +135,35 @@ In the Firmware directory, after finishing building the firmware: sudo dfu-util -a 0 -s 0x08000000 -D build/ODriveFirmware.bin ``` -#### MacOS -**This section needs more detail. Please consider adding detail if you got it to work.** -You may be able to use [dfu-util](http://dfu-util.sourceforge.net/) to upgrade the firmware. The command should be similar to the Linux instructions. +#### macOS + +First, you need a Ubuntu/Debian Linux (virtual) machine to convert the `.elf` file from into a `.bin` file that the `dfu-util` understands. Copy the latest `.elf` for your board from [here](https://github.com/madcowswe/ODrive/releases). Proceed to convert the binary (tested on Ubuntu 18.04): + +```text +$ sudo apt install binutils-arm-none-eabi +$ arm-none-eabi-objcopy -O binary ODriveFirmware_v3.5-48V.elf ODriveFirmware_v3.5-48V.bin +``` + +Back on the macOS machine (tested on macOS High Sierra), install `dfu-util`: + +```text +$ sudo port install dfu-util # via MacPorts; for HomeBrew use "brew install dfu-util" +``` + +Then, copy the new `.bin` firmware file to the macOS machine, find the correct device serial number to use. + +```text +$ dfu-util --list # list the DFU capable devices +[...] +Found DFU: [0483:df11] ver=2200, devnum=5, cfg=1, intf=0, path="20-2", alt=0, + name="@Internal Flash /0x08000000/04*016Kg,01*064Kg,07*128Kg", serial="388237123123" +``` + +Finally, flash the firmware using the found serial number: + +```text +$ sudo dfu-util -S 388237123123 -a 0 -s 0x08000000 -D ODriveFirmware_v3.5-48V.bin +``` ## Flashing with an STLink From c17b61a10f3c99a542c51c8d8c6f08348a9d19af Mon Sep 17 00:00:00 2001 From: jaredairbusaerial <42249132+jaredairbusaerial@users.noreply.github.com> Date: Sun, 13 Jan 2019 17:36:22 -0500 Subject: [PATCH 14/25] Improved power connection procedure information --- docs/getting-started.md | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/docs/getting-started.md b/docs/getting-started.md index e0991902..3e2ebf43 100644 --- a/docs/getting-started.md +++ b/docs/getting-started.md @@ -56,14 +56,19 @@ All non-power I/O is 3.3V output and 5V tolerant on input, on ODrive v3.3 and ne ### Wiring up the motors * Connect the motor phases into the 3-phase screw terminals. It is not recommended to use a clip-on connector such as an alligator clip, as this can cause issues with the phase resistance/inductance measurements. -* Connect the power source to the DC terminals. Make sure to pay attention to the polarity. -* Do not apply power just yet. ### Wiring up the encoders Connect the encoder(s) to J4. The A,B phases are required, and the Z (index pulse) is optional. The A,B and Z lines have 3.3k pull up resistors, for use with open-drain encoder outputs. For single ended push-pull signals with weak drive current (\<4mA), you may want to desolder the pull-ups. ![Image of ODrive all hooked up](https://docs.google.com/drawings/d/e/2PACX-1vTCD0P40Cd-wvD7Fl8UYEaxp3_UL81oI4qUVqrrCJPi6tkJeSs2rsffIXQRpdu6rNZs6-2mRKKYtILG/pub?w=1716&h=1281) +### Safety & Power UP +
+ Always think safety before powering up the ODrive if motors are attached. Consider what might happen if the motor spins as soon as power is applied. +
+* Unlike some devices, the ODrive does not recieve power over the USB port so the 24/48 volt power input is required even just to communicate with it using USB. It is ok to power up the ODrive before or after connecting the USB cable. +* To power up the ODrive, connect the power source to the DC terminals. Make sure to pay attention to the polarity. A small spark is normal. This is caused by the capacitors charging up. + ## Downloading and Installing Tools Most instructions in this guide refer to a utility called `odrivetool`, so you should install that first. From c04a61b621b2f4016f19b90d34e1704e777ab443 Mon Sep 17 00:00:00 2001 From: Oskar Weigl Date: Sun, 13 Jan 2019 17:15:47 -0800 Subject: [PATCH 15/25] Update odrivetool.md --- docs/odrivetool.md | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/docs/odrivetool.md b/docs/odrivetool.md index 5a8d4358..c00d5bc3 100644 --- a/docs/odrivetool.md +++ b/docs/odrivetool.md @@ -137,20 +137,25 @@ sudo dfu-util -a 0 -s 0x08000000 -D build/ODriveFirmware.bin #### macOS -First, you need a Ubuntu/Debian Linux (virtual) machine to convert the `.elf` file from into a `.bin` file that the `dfu-util` understands. Copy the latest `.elf` for your board from [here](https://github.com/madcowswe/ODrive/releases). Proceed to convert the binary (tested on Ubuntu 18.04): +First, you need to install the arm development tools to copy the binary into the appropriate format. + +```text +$ brew cask install gcc-arm-embedded +``` + +Then convert the binary to .bin format ```text -$ sudo apt install binutils-arm-none-eabi $ arm-none-eabi-objcopy -O binary ODriveFirmware_v3.5-48V.elf ODriveFirmware_v3.5-48V.bin ``` -Back on the macOS machine (tested on macOS High Sierra), install `dfu-util`: +Install `dfu-util`: ```text $ sudo port install dfu-util # via MacPorts; for HomeBrew use "brew install dfu-util" ``` -Then, copy the new `.bin` firmware file to the macOS machine, find the correct device serial number to use. +Find the correct device serial number to use: ```text $ dfu-util --list # list the DFU capable devices From 74da2ae51455f3b9d6003b41adb4561a0c4cfa54 Mon Sep 17 00:00:00 2001 From: jaredairbusaerial <42249132+jaredairbusaerial@users.noreply.github.com> Date: Sun, 13 Jan 2019 21:10:26 -0500 Subject: [PATCH 16/25] Missing L in 'remote control' --- docs/hoverboard.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/hoverboard.md b/docs/hoverboard.md index 1c0f0ce3..4ecaaf84 100644 --- a/docs/hoverboard.md +++ b/docs/hoverboard.md @@ -120,7 +120,7 @@ odrv0.axis0.requested_state = AXIS_STATE_IDLE Hopefully you got your motor to spin! Feel free to repeat all of the above for the other axis if appropriate. ### PWM input -If you want to drive your hoverboard wheels around with an RC remote contro you can use the [RC PWM input](interfaces.md#rc-pwm-input). There is more information in that link. +If you want to drive your hoverboard wheels around with an RC remote control you can use the [RC PWM input](interfaces.md#rc-pwm-input). There is more information in that link. Lets use GPIO 3/4 for the velocity inputs so that we don't have to disable UART. Then let's map the full stick range of these inputs to some suitable velocity setpoint range. We also have to reboot to activate the PWM input. From 17406fa8a5c4142226131b45ce7675660672ac95 Mon Sep 17 00:00:00 2001 From: jaredairbusaerial <42249132+jaredairbusaerial@users.noreply.github.com> Date: Sun, 13 Jan 2019 21:18:05 -0500 Subject: [PATCH 17/25] Added safety notice for PWM input. --- docs/hoverboard.md | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/docs/hoverboard.md b/docs/hoverboard.md index 1c0f0ce3..9641ae6d 100644 --- a/docs/hoverboard.md +++ b/docs/hoverboard.md @@ -120,7 +120,7 @@ odrv0.axis0.requested_state = AXIS_STATE_IDLE Hopefully you got your motor to spin! Feel free to repeat all of the above for the other axis if appropriate. ### PWM input -If you want to drive your hoverboard wheels around with an RC remote contro you can use the [RC PWM input](interfaces.md#rc-pwm-input). There is more information in that link. +If you want to drive your hoverboard wheels around with an RC remote control you can use the [RC PWM input](interfaces.md#rc-pwm-input). There is more information in that link. Lets use GPIO 3/4 for the velocity inputs so that we don't have to disable UART. Then let's map the full stick range of these inputs to some suitable velocity setpoint range. We also have to reboot to activate the PWM input. @@ -161,6 +161,9 @@ odrv0.axis0.requested_state = AXIS_STATE_CLOSED_LOOP_CONTROL odrv0.axis1.requested_state = AXIS_STATE_CLOSED_LOOP_CONTROL ``` +### Safety +Be sure to setup the Failsafe feature on your RC Receiver so that if connection is lost between the remote and the receiver, the receiver outputs 0 and 0 for the velocity setpoint of both axes (or whatever is safest for your configuration). Also note that if the receiver turns off (loss of power, etc) or if the signal from the receiver to the ODrive is lost (wire comes unplugged, etc), the ODrive will continue the last commanded velocity setpoint. There is currently no timeout function in the ODrive for PWM inputs. + ### Automatic startup Try to reboot and then activate AXIS_STATE_CLOSED_LOOP_CONTROL on both axis. Check that everything is operational and works as expected. If so, you can now make the ODrive turn on the motor power automatically after booting. This is useful if you are going to be running the ODrive without a PC or other logic board. From 4c00ffc321858323b2c8134d4bb16cbbf8613c79 Mon Sep 17 00:00:00 2001 From: jaredairbusaerial <42249132+jaredairbusaerial@users.noreply.github.com> Date: Sun, 13 Jan 2019 21:21:31 -0500 Subject: [PATCH 18/25] Added safety notice for PWM input in interfaces doc --- docs/interfaces.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/docs/interfaces.md b/docs/interfaces.md index ff0ec9ac..3c1cf39d 100644 --- a/docs/interfaces.md +++ b/docs/interfaces.md @@ -127,6 +127,8 @@ As an example, we'll configure GPIO4 to control the angle of axis 0. We want the ``` 5. With the ODrive powered off, connect the RC receiver ground to the ODrive's GND and one of the RC receiver signals to GPIO4. You may try to power the receiver from the ODrive's 5V supply if it doesn't draw too much power. Power up the the RC transmitter. You should now be able to control axis 0 from one of the RC sticks. +Be sure to setup the Failsafe feature on your RC Receiver so that if connection is lost between the remote and the receiver, the receiver outputs 0 for the velocity setpoint of both axes (or whatever is safest for your configuration). Also note that if the receiver turns off (loss of power, etc) or if the signal from the receiver to the ODrive is lost (wire comes unplugged, etc), the ODrive will continue the last commanded velocity setpoint. There is currently no timeout function in the ODrive for PWM inputs. + ## Ports Note: when you use an existing library you don't have to deal with the specifics described in this section. From aedb65027b7e33a567993e1185f5dfac4e895937 Mon Sep 17 00:00:00 2001 From: Oskar Weigl Date: Mon, 14 Jan 2019 22:12:21 -0800 Subject: [PATCH 19/25] Update getting-started.md --- docs/getting-started.md | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/getting-started.md b/docs/getting-started.md index 3e2ebf43..39f86488 100644 --- a/docs/getting-started.md +++ b/docs/getting-started.md @@ -194,6 +194,7 @@ This is the resistance of the brake resistor. If you are not using it, you may s `odrv0.axis0.motor.config.pole_pairs` This is the number of **magnet poles** in the rotor, **divided by two**. To find this, you can simply count the number of permanent magnets in the rotor, if you can see them. _Note: this is not the same as the number of coils in the stator._ If you can't see them, try sliding a magnet around the rotor, and counting how many times it stops. This will be the number of **pole pairs**. If you use a magnetic piece of metal instead of a magnet, you will get the number of **magnet poles**. + `odrv0.axis0.motor.config.motor_type` This is the type of motor being used. Currently two types of motors are supported: High-current motors (`MOTOR_TYPE_HIGH_CURRENT`) and gimbal motors (`MOTOR_TYPE_GIMBAL`).
Which motor_type to choose?
From 5d7d6352886d05d3d4aeda6d2bece2baf0894472 Mon Sep 17 00:00:00 2001 From: Damien LaRocque Date: Tue, 15 Jan 2019 23:03:44 -0400 Subject: [PATCH 20/25] Change getting-started.md with trajectory control Trajectory Control commands weren't fully detailed. --- docs/getting-started.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/docs/getting-started.md b/docs/getting-started.md index 39f86488..1a346bd8 100644 --- a/docs/getting-started.md +++ b/docs/getting-started.md @@ -261,6 +261,7 @@ You can also directly control the current of the motor, which is proportional to ### Trajectory control +Set `axis.controller.config.control_mode = CTRL_MODE_TRAJECTORY_CONTROL`.
This mode lets you smoothly accelerate, coast, and decelerate the axis from one position to another. With raw position control, the controller simply tries to go to the setpoint as quickly as possible. Using a trajectory lets you tune the feedback gains more aggressively to reject disturbance, while keeping smooth motion. ![Taptraj](TrapTrajPosVel.PNG)
@@ -295,7 +296,7 @@ Use the `move_to_pos` function to move to an absolute position: ### Circular position control -To enable Circular position control, set 'axis.controller.config.setpoints_in_cpr = True' +To enable Circular position control, set `axis.controller.config.setpoints_in_cpr = True` This mode is useful for continuos incremental position movement. For example a robot rolling indefinitely, or an extruder motor or conveyor belt moving with controlled increments indefinitely. In the regular position mode, the `pos_setpoint` would grow to a very large value and would lose precision due to floating point rounding. From 077dd214b72666dab868a94e18093ea34baea5a7 Mon Sep 17 00:00:00 2001 From: Oskar Weigl Date: Tue, 15 Jan 2019 19:49:03 -0800 Subject: [PATCH 21/25] Update troubleshooting.md --- docs/troubleshooting.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/docs/troubleshooting.md b/docs/troubleshooting.md index a441ef95..ef780745 100644 --- a/docs/troubleshooting.md +++ b/docs/troubleshooting.md @@ -74,6 +74,12 @@ In general, you need resistance_calib_max_voltage > calibration_current * phase_resistance`. ``` +* `ERROR_MODULATION_MAGNITUDE` + +The bus voltage was insufficent to push the requested current through the motor. Reduce `motor.config.calibration_current` and/or `motor.config.current_lim`, for errors at calibration-time and closed loop control respectively. + +For gimbal motors, it is recommended to set the calibration_current and current_lim to half your bus voltage, or less. + * `ERROR_DRV_FAULT = 0x0008` The ODrive v3.4 is known to have a hardware issue whereby the motors would stop operating From a43831e8d05230b2ada36a84aa5ce3c8e2f7d2e5 Mon Sep 17 00:00:00 2001 From: Oskar Weigl Date: Tue, 15 Jan 2019 19:50:32 -0800 Subject: [PATCH 22/25] Update troubleshooting.md --- docs/troubleshooting.md | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/docs/troubleshooting.md b/docs/troubleshooting.md index ef780745..744d6eb3 100644 --- a/docs/troubleshooting.md +++ b/docs/troubleshooting.md @@ -74,12 +74,6 @@ In general, you need resistance_calib_max_voltage > calibration_current * phase_resistance`. ``` -* `ERROR_MODULATION_MAGNITUDE` - -The bus voltage was insufficent to push the requested current through the motor. Reduce `motor.config.calibration_current` and/or `motor.config.current_lim`, for errors at calibration-time and closed loop control respectively. - -For gimbal motors, it is recommended to set the calibration_current and current_lim to half your bus voltage, or less. - * `ERROR_DRV_FAULT = 0x0008` The ODrive v3.4 is known to have a hardware issue whereby the motors would stop operating @@ -91,6 +85,12 @@ power supply of the DRV8301 gate driver chips, thus tripping its under-voltage f To resolve this issue you can limit the M0 current to 40A. The lowest current at which the DRV fault was observed is 45A on one test motor and 50A on another test motor. Refer to [this post](https://discourse.odriverobotics.com/t/drv-fault-on-odrive-v3-4/558) for instructions for a hardware fix. +* `ERROR_MODULATION_MAGNITUDE = 0x0080` + +The bus voltage was insufficent to push the requested current through the motor. Reduce `motor.config.calibration_current` and/or `motor.config.current_lim`, for errors at calibration-time and closed loop control respectively. + +For gimbal motors, it is recommended to set the calibration_current and current_lim to half your bus voltage, or less. + ## Common Encoder Errors * `ERROR_CPR_OUT_OF_RANGE = 0x02` From d5614b73906edfbfe921204da54f36b4fd92951a Mon Sep 17 00:00:00 2001 From: Oskar Weigl Date: Wed, 16 Jan 2019 15:04:24 -0800 Subject: [PATCH 23/25] Update interfaces.md --- docs/interfaces.md | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/interfaces.md b/docs/interfaces.md index 3c1cf39d..3f5a7dbd 100644 --- a/docs/interfaces.md +++ b/docs/interfaces.md @@ -33,6 +33,7 @@ The ODrive can be controlled over various ports and protocols. If you're comfort (*) ODrive v3.5 and later Notes: +* You must also connect GND between ODrive and your other board. * ODrive v3.3 and onward have 5V tolerant GPIO pins. * ODrive v3.5 and later have some noise supression filters on the default step/dir pins * You can change the step/dir pins using `axis.config._gpio_pin`. From aeb8d6abb89d8176c0fa933e5fee6af3dd56d0de Mon Sep 17 00:00:00 2001 From: Oskar Weigl Date: Wed, 16 Jan 2019 15:05:02 -0800 Subject: [PATCH 24/25] Update ODriveArduinoTest.ino --- .../examples/ODriveArduinoTest/ODriveArduinoTest.ino | 1 + 1 file changed, 1 insertion(+) diff --git a/Arduino/ODriveArduino/examples/ODriveArduinoTest/ODriveArduinoTest.ino b/Arduino/ODriveArduino/examples/ODriveArduinoTest/ODriveArduinoTest.ino index f948f7f6..1e835026 100644 --- a/Arduino/ODriveArduino/examples/ODriveArduinoTest/ODriveArduinoTest.ino +++ b/Arduino/ODriveArduino/examples/ODriveArduinoTest/ODriveArduinoTest.ino @@ -8,6 +8,7 @@ template<> inline Print& operator <<(Print &obj, float arg) { obj.print(a // Serial to the ODrive SoftwareSerial odrive_serial(8, 9); //RX (ODrive TX), TX (ODrive RX) +// Note: you must also connect GND on ODrive to GND on Arduino! // ODrive object ODriveArduino odrive(odrive_serial); From eaaf4d14eab9d6541cf73d04bcba3a0a71075a57 Mon Sep 17 00:00:00 2001 From: Oskar Weigl Date: Thu, 24 Jan 2019 14:24:10 -0800 Subject: [PATCH 25/25] Update troubleshooting.md --- docs/troubleshooting.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/docs/troubleshooting.md b/docs/troubleshooting.md index 744d6eb3..369f9d39 100644 --- a/docs/troubleshooting.md +++ b/docs/troubleshooting.md @@ -71,7 +71,8 @@ Some motors will have a considerably different phase resistance and inductance t In general, you need ```text -resistance_calib_max_voltage > calibration_current * phase_resistance`. +resistance_calib_max_voltage > calibration_current * phase_resistance +resistance_calib_max_voltage < 0.5 * vbus_voltage ``` * `ERROR_DRV_FAULT = 0x0008`