Closed SaeedSobhi closed 2 years ago
Interesting, I think the code should work such that it waits until the action was performed. Did you set "isblocking" to true?
Am Do., 10. Feb. 2022 um 11:56 Uhr schrieb Sobhi Saeed < @.***>:
Using the class ESP32Client from ESP32RestSerialAPI to control the stepper motor, one should add at least 3 seconds delay when switching the movement axis (x to y or y to x) otherwise the motor won't be able to respond to new moving order.
PS. the issue could be the Stepper Motor response time, not necessarily a bug in the JSON file or in the Python code.
— Reply to this email directly, view it on GitHub https://github.com/openUC2/UC2-REST/issues/3, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABBE5OBFYRSSQDXCEKMN4WLU2OKT5ANCNFSM5OAKHPLA . You are receiving this because you are subscribed to this thread.Message ID: @.***>
"Is_blocking" was set to True, but I still have the same problem, I suggest a delay time of "max(3, steps-number//1000)" in the master code since we have to wait for the movement to be done before acquiring new data.
Hey, i have updated large parts of the code. Can you please follow the README and install the Arduino firmware and update the python code?;)
On Mon, Feb 14, 2022, 11:52 Sobhi Saeed @.***> wrote:
"Is_blocking" was set to True, but I still have the same problem, I suggest a delay time of "max(3, steps-number//1000)" in the master code since we have to wait for the movement to be done before acquiring new data.
— Reply to this email directly, view it on GitHub https://github.com/openUC2/UC2-REST/issues/3#issuecomment-1038930878, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABBE5OBY2ZPTURORNN6FEOTU3DMHFANCNFSM5OAKHPLA . You are receiving this because you commented.Message ID: @.***>
The new code works perfectly, no need to add any delay :) There's a small mistake in the python test code, still using "axis =1 or 2" even though we should use "steps = (x-steps, y-steps, z-steps)" instead
Hey, I have updated large parts of the arduino and python code. Would you mind testing it?
It's important to outcomment only the line #include "pindef_STORM_Berlin.h"
in the Main ino
file.
Can you check if this works?
This will also work with ImSwitch. Though I have to document this properly I guess..
Hi, I tried the new code, it is working, although there are some issues:
from ESP32RestSerialAPI import ESP32Client serialport1 = 'COM7' Motor = ESP32Client(serialport=serialport1) print("Move in X") Motor.move_stepper(steps=(2000, 0, 0), speed=100, is_absolute=False, is_blocking=True) print("Move in Y") Motor.move_stepper(steps=(0, 2000, 0), speed=100, is_absolute=False, is_blocking=True)
The motor will only response to the movement in Y direction, and the output would be: Move in X Casting JSON string from serial to Python dict failed Move in Y
Hey, did you manage to get it working @SaeedSobhi ? Sorry, it'S still work-in-progress. @ranranking is also getting it to work in the meantime. Eventually he could help you.
Regarding your questions:
When out-commenting #include "pindef_STORM_Berlin.h" we have to add another "identifier_setup" otherwise we won't be able to compile the Arduino Code.
:
Well yes, the pindef_*.h
files gives you some hints about the configuration. The code can run many different hardware arrangements. I could add one for your ptychography setup if you want. You can now outcomment //#include "pindef_ptychography.h"
and see if it works.
Can you please test the new code? The message Casting JSON string from serial to Python dict failed
should be fine. Just a warning..
Indeed I changed the API. Thanks for pointing that out! :)
Hi Bene, thanks for updating the code, the new code works perfectly!
Using the class ESP32Client from ESP32RestSerialAPI to control the stepper motor, one should add at least 3 seconds delay when switching the movement axis (x to y or y to x) otherwise the motor won't be able to respond to new moving order.
PS. the issue could be the Stepper Motor response time, not necessarily a bug in the JSON file or in the Python code.