Is there any way to speed up setTargetPosition?

Comments & issues
Post Reply
josh.williams
Fresh meat
Posts: 4
Joined: Fri Mar 27, 2020 7:23 pm
Contact:

Is there any way to speed up setTargetPosition?

Post by josh.williams »

Hi all,

I have a segment of code in python 3.7 that I'm trying to run on a timer that includes:

Code: Select all

stepper1.setTargetPosition(stepper1_targetposition)
stepper2.setTargetPosition(stepper2_targetposition)
From timing my code, it looks like these two lines take about 0.04 seconds to run.

I'd like to run this code on a timer every 0.01 second. Does anyone know of a way to do so? Is it possible to actually change the target position of my stepper every 0.01 second?

I've played around with

Code: Select all

setTargetPosition_async()
a little bit but don't really understand what it's doing nor have been able to get my code to run.

Thanks!
--Josh
User avatar
mparadis
Site Admin
Posts: 959
Joined: Fri Oct 28, 2011 12:17 pm
Contact:

Re: Is there any way to speed up setTargetPosition?

Post by mparadis »

The async version of the function is non-blocking so it should run a bit faster because both steppers are being set simultaneously. I'm not sure why it's not working for you. Whether your motor can physically respond to changes every 0.01s though is another matter since it takes time to change direction.
Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot] and 22 guests