Unable to set encoder to hall effect


#1

I’m trying to get my odrive to control a hoverboard motor. I’m following the guide here (https://github.com/madcowswe/ODrive/blob/devel/docs/hoverboard.md)

All is fine until I get to this line

odrv0.axis0.encoder.config.mode = ENCODER_MODE_HALL

I get an errors “NameError: name ‘ENCODER_MODE_HALL’ is not defined”

Is there a config mode number I could use instead? Anyway around this issue for the moment?

Any help would be greatly appreciated.


#2

You need to switch to devel firmware and odrive_tool repos


#3

Ah, you’re absolutely right. I didn’t notice that the hoverboard doc was in the devel branch. Now it’s all starting to make sense

Thanks


#4

hey James I’m having the same problem and I’m trying to have my ODrive power hoverboard motors too, what did you do to switch to the devel firmware? Or I guess, what does it mean to be in the devel branch?


#6

In development, possibly not stable (that is it might have unknown bugs, not yet ready for reliable everyday use)


#7

Hi,
Today we recently released a new version of the firmware, and with that comes support for hall effect feedback, hoverboard motors, and pwm input: they were not officially supported before.
You can check the hoverboard guide in the documentation.
You will need to upgrade your firmware to fw-v0.4.2, instructions here.


#8

So i have upgraded firmware to .0.4.2 i run through the setup discussed “hoverboard guide” however i can not execute command " ```
odrv0.axis0.encoder.config.mode = ENCODER_MODE_HALL it chucks following error…

In [2]: odrvO.axis0.encoder.config.mode=ENCODER_MODE_HALL

NameError Traceback (most recent call last)
/usr/local/lib/python3.7/site-packages/fibre/shell.py in ()
----> 1 odrvO.axis0.encoder.config.mode=ENCODER_MODE_HALL

NameError: name ‘ENCODER_MODE_HALL’ is not defined

any clues ?


#9

Yes you also need to upgrade odrivetool. Try this command pip install odrive --upgrade --no-cache-dir


#10

I am having the same issue. I am have updated to version 4.2 of the firmware and I have tried upgrading Odrivetool. I am running a current version of Anaconda (per the getting started guide). Odrivetool is at version 0.4.1. Am I not on the current version of Odrivetool?


#11

odrivetool version should match the firmware version - they are released concurrently. In particular, odrivetool 4.1 doesn’t know what the numeric value of ENCODER_MODE_HALL is, but 4.2 will.


#12

I have tried to update Odrivetool with the command mentioned above. It continues to install version 4.1. Suggestions?


#13

I’m having the same problem as well, I tested on my regular pc as well as one with a fresh install of Win 7. still getting 4.1


#14

Best I can suggest is uninstall/reinstall odrivetool and see what happens. Sorry I can’t be of more help. Hopefully someone more knowledgeable will be along soon.


#15

I have had the same problem too. My odrivetool is only v4.1 even though I only installed in on a fresh windows a couple of days ago.

The version on pypi seems to still be 4.1

My workaround has been to run the following which seems to work.
odrv0.axis0.encoder.config.mode = 1


#16

Good workaround @Martin_Conway. Indeed, that is the value that the ENCODER_MODE_HALL enum corresponds to.


#17

Also, if you download and extract the source code from github, you can run odrivetool from the tools folder and it seems to give you the up to date version. I haven’t tested if this creates any other problems. Previous having pip installed odrive should have sorted the dependencies.

https://github.com/madcowswe/ODrive/archive/master.zip


#18

That’s what I do routinely, Martin, and so far so good. Haven’t run into any problems to speak of and I don’t think you will either.


#19

My sincere apologies, @Martin_Conway is absolutely right, I forgot to update the PyPi with the latest version when making the release. I have now updated it.
This command should now upgrade odrivetool to v0.4.2: pip install odrive --upgrade --no-cache-dir