Page 1 of 1

setCurrentLimit triggers Position changed handler, not curr

Posted: Tue Mar 11, 2014 11:51 am
by CatherineHolloway
I think there's a problem in the phidgets libraries. When I set the current limit with setCurrentLimit(), the position changed event is triggered, not the current changed event.

Re: setCurrentLimit triggers Position changed handler, not c

Posted: Tue Mar 11, 2014 1:11 pm
by CatherineHolloway
also, it seems that setCurrentLimit has no effect on the value returned by getCurrent()

Re: setCurrentLimit triggers Position changed handler, not c

Posted: Tue Mar 11, 2014 2:17 pm
by mparadis
From the C/C++ API:
int CPhidgetStepper_setCurrentLimit (CPhidgetStepperHandle phid, int index, double limit)
Sets the current limit for a motor.

int CPhidgetStepper_getCurrent (CPhidgetStepperHandle phid, int index, double *current)
Gets the current current draw for a motor.
The CurrentLimit sets when the stepper controller's chopper drive cuts out, effectively limiting the current. getCurrent returns the current being drawn by the motor at the time the function is called.

If you want to know what CurrentLimit has been set to, you should use CPhidgetStepper_getCurrentLimit. As for your first question, I'm not sure why you're expecting the current change event to fire when you change the current limit- it's just a maximum, not the actual value. The position change handler shouldn't trigger as a result of changing the current limit either, but might it have triggered because the position changed at that time?

Re: setCurrentLimit triggers Position changed handler, not c

Posted: Wed Mar 12, 2014 12:06 pm
by CatherineHolloway
Yes, you're right, I was interpreting the codebase incorrectly

I'm still not sure why the position handler activated, when the current limit is set, but it's not a biggie and I've found a workaround for the current handler not activating.

Re: setCurrentLimit triggers Position changed handler, not c

Posted: Tue Feb 14, 2017 3:47 pm
by bluwavguy
On this topic, using the 1067 controller and the 3327 Bipolar stepper with rated current at 1.7A, do I need to call the getCurrent 1st, then call setCurrentLimit to set the limit?

Under load tests I know the stepper runs fine a 1.5A using the simple GUI program app that came with the controller....

I plan to modify the Stepper-simple program to build my app and I did not see a call within this program to set the limit. Therefore in reviewing the header file found the api.

I'll need to add the functionality but want to make sure I'm doing this correctly...

Since I am new to most all of this my application is to drive the motor one direction for a set period of time, delay, then drive the motor the opposite direction for a set period of time, delay, then repeat over a 12 hour period.

Therefore, once I set the current limit that's all I care about unless I'm missing something...

thanks in advance, Brian

Re: setCurrentLimit triggers Position changed handler, not c

Posted: Wed Feb 15, 2017 8:23 am
by mparadis
No, you don't need to call getCurrent if you already know what you want the current limit to be. Play around with the current limit, velocity limit, and acceleration in testing to determine which numbers work well for you, and then set those properties when your program begins.