Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

use default dir only if sensor not connected #459

Open
wants to merge 5 commits into
base: dev
Choose a base branch
from

Conversation

askuric
Copy link
Member

@askuric askuric commented Mar 14, 2025

Hey @runger1101001,

I think this is a bug, but I am not sure. Let me know if I'm missing something.
I am not 100% sure what is the motivation behind this part of the code.

The issue that I was having is that if the user uses the openloop mode at the start the initFOC will skip the direction calibration (as the motor.init will set the direction to CW). And this can lead to unstable behaviour later if the real direction is CCW and the user goes to the closed-loop control. Does it make sense to set the default sensor direction only if the sensor is not there?

@runger1101001
Copy link
Member

runger1101001 commented Mar 14, 2025

Hey Antun,

It would seem to me that after this change, and if the sensor is set, then in open loop mode the direction would remain in UNKNOWN (unless you explicitly set it)?
I think this is ok, as it isn't used in open loop mode.

I think the motivation is that when you use the open loop mode in combination with a sensor. TBH I can't remember where it came from but I suspect it has to do with the python calibration & linearity measurement where I was running open loop but with the sensor in use.

I guess these and other similar examples are different edge cases - to handle them correctly its probably necessary for the users to explicitly set or unset the direction depending on what they want.

Its fine for me to remove this or change it in the way you have suggested, but I think there might be some of the users affected who are doing things like open loop + velocity measurement, or running their own calibration routines.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants