Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Scanner_Controller.py script not work #2

Closed
henrikmyl opened this issue Jun 2, 2021 · 13 comments
Closed

Scanner_Controller.py script not work #2

henrikmyl opened this issue Jun 2, 2021 · 13 comments
Assignees

Comments

@henrikmyl
Copy link

When i try to run Scanner_Controller.py script i get error:

Traceback (most recent call last): File "Scanner_Controller.py", line 6, in <module>
   from GUI.Live_view_FLIR import customFLIR
ModuleNotFoundError: No module named 'GUI'

Scanner_Controller py script error

How i can fix that?

My system:
Windows 10
Spinnaker library 2.4.0.144
Blackfly S BFS-U3 camera

@FabianPlum
Copy link
Collaborator

FabianPlum commented Jun 2, 2021

Hi Henrik,

Thanks for letting us know! As a quick fix to test your setup, you can run the script from an IDE such as PyCharm, with the project in the scAnt main directory. Then your interpreter should be able to find all the scripts.

I will properly fix the issue shortly, so you can run the Scanner_Controller.py script without this workaround.

In the meantime, would you mind running the scAnt.py script to see if the issue is occurring there as well?

All the best
Fabi

@henrikmyl
Copy link
Author

henrikmyl commented Jun 2, 2021

ScAnt.py script seems to work. Now this recognize my camera model and also live view work.

Edit:

I just noticed that the stepper controller is not found.

Error: Failed to open generic handle.  Access is denied.  Try closing all other programs that are using the device.  Windows error code 0x5.
No Stepper Controller found!

@henrikmyl
Copy link
Author

henrikmyl commented Jun 4, 2021

ScAnt.py recognizes part of my step motors (on some level), so that error message is no longer relevant. I think that came because Pololu Tic control center software was open at the same time.

But i can't start scanning because i get message "Stepper need to be homed before scanning!" Terminal show "Homing stepper X" and "Homing stepper Z", Y stepper is dead, nothing happens when pressing reset button. Pololu Tic control center software recognize all three step motors.

image

Terminal messages when i try to move Y stepper:

y stepper terminal

y stepper terminal 2

@FabianPlum
Copy link
Collaborator

FabianPlum commented Jun 4, 2021

Did you add your stepper IDs in the Scanner_Controller.py script?

self.stepperX_ID = "XXXXXXXX"
self.stepperY_ID = "YYYYYYYY"
self.stepperZ_ID = "ZZZZZZZZ"

I assume you have, as the responses in the terminal appear correct. Could you send me a picture of the wiring of your stepper motors and limit switches? If the limit switches are not configured correctly, it may be that the program does not recognise them properly. We recommend connecting the limit switches to the Pololu Tic boards as follows:

GND: Black
TX: Green
RX: Red

Then the setup should be:

for the Z-axis (camera slider)

image

The TX of the limit switch of the Z-axis needs to be set to "limit switch forward" and to "limit switch reverse" for the X-axis (gimbal).

The official documentation of the Pololu stepper controllers may provide some additional info, depending on your components and the type of limit switch: https://www.pololu.com/docs/0J71/4.14

@FabianPlum FabianPlum self-assigned this Jun 4, 2021
@henrikmyl
Copy link
Author

henrikmyl commented Jun 5, 2021

Did you add your stepper IDs in the Scanner_Controller.py script?

self.stepperX_ID = "XXXXXXXX"
self.stepperY_ID = "YYYYYYYY"
self.stepperZ_ID = "ZZZZZZZZ"

My stepper IDs:

self.stepperX_ID = "00323588"
self.stepperY_ID = "00323558"
self.stepperZ_ID = "00323541"

I reinstalled everything. The Z axis work now. Z axis problem was in limit switch connecting. Thanks for that picture and information.

But... the X-axis problem not solved. When i press "Home X axis," stepper motor starting move little bit backward and forward. After a while this ends. X-axis limit switch connecting work. I tested that switch by hand and that status changed. Any ideas?

After this Tic Control Center shows that X-axis stepper motor new position is -200, but in reality that stepper move about "+15 - 15" backward and forward.

Tic control center values after backward and forward:
x problem

cmd:

Stepper X

@henrikmyl
Copy link
Author

X-axis problem is solved! This takes time when all is new...

If someone has the same problem, increase the self.stepper_currents values. I also reduced self.stepper_home_pos to -500 default value is -1000.

current

@FabianPlum
Copy link
Collaborator

Hi @henrikmyl ,

Glad to hear you were able to resolve the issue!
Given that there are many different steppers to chose from, it's very good to know that this is a potential fix! Just be sure not to increase the current beyond the rating of your stepper to avoid damage to your components.

All the best
Fabi

@FabianPlum FabianPlum pinned this issue Mar 18, 2022
@FabianPlum FabianPlum unpinned this issue Mar 18, 2022
@sbasnagala
Copy link

Hi,
When I try to Home X-axis, it goes in the right direction (away from the camera, I suppose this is right) but never comes back. Is it supposed to come back? or how does this work? The gimble arc carries the stepper motor all the way up, and it can not go anymore but tries to go higher (after a few jerky actions then stops). Is there a setting that I can use in the script file to make it work.?
Z-axis and Y-axis working fine.

@FabianPlum
Copy link
Collaborator

Hi @sbasnagala
Double-check the motor direction in the tic control centre. If for one of the axes the motor moves in an unexpected direction, you can change the motor direction under:

Input and motor settings > Motor > Invert motor direction

Depending on the wiring of your steppers, your default direction may not be what the scanner expects. Also, ensure you are using step mode 1/8 for all motors for the correct range.

The correct movement directions for each motor are:
X - axis : positive > gimbal arm moves away from end-stop (therefore, the limit switch should be set to backwards)
Y - axis : positive > anti-clockwise
Z - axis : positive > towards end-stop (therefore, as described above, the limit switch should be set to forwards)

@sbasnagala
Copy link

So when homing x-axis, what direction it should go? Ideally x-axis should stay perpendicular to the ground when homing, which is zero position, right? I tried putting 190 in the x-axis after homing, but axis never returned.

@FabianPlum
Copy link
Collaborator

When homing the X-axis it should move towards the end-stop (if it does not, the axis needs to be inverted via tic control centre). The "home" (and zero position) is at the end-stop as any other position has no absolute reference and may change with design modifications.

The centre is at (positive) 190 and the maximum positive position is at 450 when using the original scAnt design.

@sbasnagala
Copy link

Hi Fabian,
Thanks!! All the stepper motors working right now!! I started scanning and it seems like it is very slow. It's been 12 min into the scan so far and when I check the output folder, there are only 7 images taken every 2 seconds. The progress bar is still 0%, and says "running Scan". I can see the image is not focused in the live view and z-axis is not moving and the gimble arc stopped halfway between 0 and ends top. Any clue what is going on?

@FabianPlum
Copy link
Collaborator

@sbasnagala I opened a new issue, so we don't go too far off-topic here :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants