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

Resetting phase index in velocity mode #2

Open
JohnJohanssonChalmers opened this issue Feb 5, 2021 · 3 comments
Open

Resetting phase index in velocity mode #2

JohnJohanssonChalmers opened this issue Feb 5, 2021 · 3 comments

Comments

@JohnJohanssonChalmers
Copy link

In the functions Roll1_vel() and Roll2_vel() the following code is supposed to keep the phase index in the interval 0 to 2*pi:

	//RESET PHASE INDEX AFTER 2PI
	if (phaseindex1 >= 2*pi) {   //Reset phaseindex_U1 once it completes 2*180o in phase.
		phaseindex1 = 0;
	}
	else if (phaseindex1 <= 0){
		phaseindex1 = 2*pi - phaseindex1;
	}

For the case of phaseindex1 <= 0, I believe is should really be phaseindex1 = 2*pi + phaseindex1; rather than phaseindex1 = 2*pi - phaseindex1;. For the case of phaseindex1 >= 2*pi, it's not really wrong, but setting it to 0 could cause a small speed inconsistency. It would be better to use phaseindex1 = phaseindex1 - 2*pi;.

All together, I would propose the following code:

	//RESET PHASE INDEX AFTER 2PI
	if (phaseindex1 >= 2*pi) {   //Reset phaseindex_U1 once it completes 2*180o in phase.
		phaseindex1 -= 2*pi;
	}
	else if (phaseindex1 < 0){
		phaseindex1 += 2*pi;
	}

The reason I found this was that I experienced that the motor got stuck after rotating just a little bit at certain speeds. I believe this is due to the controller getting stuck in an infinite loop jumping between the edge cases. It only seems to happen at certain negative speeds, which I think is due to floating point imprecision.

@sriharshakunda
Copy link

@JohnJohanssonChalmers I have a similar issue where the motors run for a while and starts cogging. It happened to me in both i2c and PWM mode. Did you find a solution to this?

@JohnJohanssonChalmers
Copy link
Author

@sriharshakunda What do you mean by cogging? The issue I had manifested itself by the motor stopping completely coupled with faint buzzing noise. I only experienced it in velocity mode and only in one direction. I could get out of it by sending a velocity command in the opposite direction. The issue only occurred for certain speeds also. So one way to get around it was to find a speed for which the issue didn't occur.

Does this sound similar to your experience? Are you operating in velocity mode?

I have now modified the firmware of the NearZero to avoid the issues that I found and also to operate in a quite different mode. Hence I can't really reproduce the old issues without changing back to the original firmware.

@sriharshakunda
Copy link

@JohnJohanssonChalmers after digging down a little deeper, the issue is with controller over heating and causing the motors to create ticking noise and cogging.

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

No branches or pull requests

2 participants