Page 1 of 1

DC stepper control using a DCC1002 module - position reached

Posted: Thu Feb 09, 2023 10:51 am
by julien
Hello,
I've been playing with the servo phidget and the stepper phidget in the past but this is my first time using a DCC module.

It's not clear to me how I can make my motor positioning synchronous.
In the past I was monitorting the positionChanged event and blocking until the current position is the target position, but with a DC motor and depending on the PID, the motor might overshoot.

So here are my questions:
- Do you confirm that voidPhidgetMotorPositionController_setTargetPosition() is asynchronous?
- Do you confirm that the callback of voidPhidgetMotorPositionController_setTargetPosition_async() is not called when the position is reached, but when the targetPosition has been sent to the microcontroller?
- How do you recommend to program the detection of "position reached"?

Thanks in advance.

Re: DC stepper control using a DCC1002 module - position reached

Posted: Fri Feb 10, 2023 11:25 am
by Patrick
setTargetPosition() is synchronous in that it returns once the command has been accepted by the board. setTargetPosition_async() is basically the same, but returns immediately. It can take 10s of milliseconds to send a command to the board and hear back - the async call is there for sending commands to multiple channels in parallel.

You'll need to monitor the PositionChange or DutyCycleUpdate events to determine when it's reached position.

-Patrick

Re: DC stepper control using a DCC1002 module - position reached

Posted: Mon Feb 13, 2023 11:35 am
by julien
Thanks a lot, works great this way.
I have one last question: is it possible to use an input from the VINT Hub and use it as a homing switch for the encoder?
This can of course be done from the PC, but I was wondering if it can be done at the micro-controller level.
Thanks in advance.