UniNE-CHYN / thorpy

Python library implementing Thorlabs APT communication protocol
43 stars 22 forks source link

Motor movement control on KDC101 on Ubilinux #12

Closed mhejda closed 6 years ago

mhejda commented 6 years ago

Hello!

Sorry for my rather newbish question, but I already spent hours trying to figure it out myself. How to actually move the motor using thorpy? (relative or absolute movement) Im using THORlabs KDC101 connected via USB with Z812B motor on Ubilinux.

I tried calling the provided test.py code and succesfully acquired information from the KDC101, including current position, motor name and such details. However, in the 's' object created in the example, I cannot find any function to actually move the motor.

I also tried different approach, using the thorpy.message.MGMSG_MOT_SET_MOVERELPARAMS(0x01, distance) to set the movement and then probably move using command like thorpy.message.MGMSG_MOT_MOVE_RELATIVE_short(...). However, whatever I input as parameters into these MGMSG functions, I ALWAYS recieve TypeError: %x format, an integer is required, not NoneType. Can anyone give me a helping hand with moving the motor? Thanks in advance.

lfasnacht commented 6 years ago

Sorry, I completely missed your message.

Normally you don't have to use messages directly, just use position:

s.position = 123

Does that do the trick?