AlexShkarin / pyLabLib

Python package for device control and experiment automation
http://pylablib.readthedocs.io
GNU General Public License v3.0
125 stars 28 forks source link

BSC 201-3 Can not home #74

Closed bhathawayML closed 4 months ago

bhathawayML commented 5 months ago

Hi Alexey,

I am using the pylablib.devices.Thorlabs.KinesisMotor to control some BSC201 and BSC203 motors. All of the commands (at least all the ones I've needed to try) are working fine, except for home(). When I send this command, nothing happens. I have tried specifying the channel, sending the command 0x0443 according to APT protocol, and the solution for Issue #6 (changing the destination address). In the Kinesis software, the homing button works as expected for both motors.

from pylablib.devices import Thorlabs as Thorlabs

# BSC203: 70394124
# BSC201: 40375934

dev = Thorlabs.KinesisMotor("40375934", is_rack_system="auto")
dev.home()
dev.home(channel=1)
dev.send_comm(messageID=0x0443, dest=0x11)
dev.send_comm(messageID=0x0443, dest=0x21)
dev.send_comm(messageID=0x0443, dest=0x50)
dev.close()

Is there anything you suggest trying out? Or do you see I am missing something?

Thank you in advance! -Brooke

AlexShkarin commented 4 months ago

Dear Brooke,

I would suggest to first check if the motor is responding to the home command. I've seen a couple of times that home parameters could be off, e.g., the velocity is too small, so the motor is homing so slowly that it looks like it's not moving. You can use get_status method to get the status before/after the homing command and see if it makes a difference.

The other possibility is that the stage is already homed. By default, home method only calls the homing command if it's not homed yet, so you can try dev.home(channel=1,force=True) to see if it makes any difference. Afterwards, you can check if the stage is homed by checking get_status result (it should have homed apear as one of the items in the resulting list).

You can also try manually sending the command and, just in case, use the bare BasicKinesisDevice class to avoid sending any other commands:

dev=Thorlabs.BasicKinesisDevice("40375934",is_rack_system=True)
dev.send_comm(0x0443,param1=0x01,param2=0x00,source=0x01,dest=0x21) # dest=0x22 for channel 2 and 0x23 for channel 3
dev.close()

Just in case, I would also suggest power cycling the device before doing it, to make sure that it's not stuck in some weird state, which sometimes happend when a command with a wrong destination address is sent.

Let me know if any of this works.

Sincerely,

Alexey.

bhathawayML commented 4 months ago

Hi Alexey,

Yep! The forcing it to home did the trick. Can't believe I missed that one lol.

Thank you for the help!