Thorlabs / Motion_Control_Examples

Software examples for Thorlabs motion control products (e.g. T-Cube, K-Cube, and benchtop brushless, DC, stepper, and Piezo motor controllers)
MIT License
75 stars 31 forks source link

C++ KCube CC_MoveToPosition Bug and CC_SetHomingParameters wrong Enum in help file #34

Closed BaNavyBlue closed 3 months ago

BaNavyBlue commented 1 year ago

I've noticed a bug with CC_MoveToPosition where it will stall if moving back to a count position near 0 If I wait for the flags CC_WaitForMessage I will often get the 2 Generic Motor Flag with 2 Generic Motor Stopped, followed by (Generic Motor, Limit Updated), I'm assuming due to overshoot. I try to catch this in my WaitForMessage loop, but sometimes it stalls before returning those messages. At first I tried catching if my position change would yield a negative count and setting the MoveToPosition to 1. This stalls CC_WaitForMessage. My current solution is to just call CC_Home this appears to work fine without stalling anything.

Another semi random bug from the basic example is upon initialization CC_Home usually reverses to it's lowest count, but occasionally it decides home is at full forward.

To fix this issue one needs to use CC_SetHomingParamsBlock and set the direction flags. The help file that comes with kenisis says the direction parameter is a MOT_TravelDirection enum, but its actually the MOT_DirectionSense enum.

TrumanMetz commented 3 months ago

Hello, My sincerest apologies for this delayed response. Thank you for bringing this to our attention. I will route this information to the Kinesis developers (if this hasn't been fixed already it certainly will now.