How to wait for tic position reached

Hi,
I am running 3 tic 825 boards on win11 over usb using python. I have the interfaces working.
I plan on starting 3 movements at once and I wonder how best to determine when the motors have reached their destinations.

What status command (s) can be used to determine this? Is there more than one way to determine this?

This brings to mind another question about command scheduling:
The manual states:
Set target position” and “Set target velocity” commands to set the target position and target velocity, respectively. These commands allow you to change between “Target position mode” and “Target velocity mode” on the fly

So is the first command completed before the second on the fly command is started?
Or is the new command implemented immediately?

In general are any of the commands blocking during movement? If so which ones? If not how deep is the command buffer? Or does it work a different way?

Thank you.

I think it might help to describe what I want to do. Of the 3 motors my question pertains to just one. I want to rotate this motor 100 steps (180 degrees) and arrive at the target with as high a speed as possible and then slowly rotate 100 steps back to the starting position. The amount of time taken for this cycle is not important – I just want the initial high velocity. This will repeat ~5 times.
Currently using a nema43 at 24v and 2 amps. I realize increasing these would help. I also think a limit switch approach would instantly stop the high speed.
But I would like to address this issue with just tic commands so in addition to the command queuing questions above I would like advice on how to setup the velocity and acceleration parameters for forward and back movements.
Thank you.

Hello.

The set target position and set target velocity commands are not blocking and the Tic does not buffer them; the most recent command received will be the active one. So, for example, if you send a set target position command, then follow it up with a set target velocity command before the target position is reached, it will override the target position and immediately start working toward the target velocity.

There are multiple ways to do what you’re describing, but one possible solution would be to have your code monitor the Tic’s “Current position” variable and wait until it matches the target position. If you are using the Tic Command-line Utility (ticcmd), you can get the current position as part of the data returned from the --status(or -s) option. The output of that command uses the YAML format, so you will need to parse it. You can find an example of doing so in the “Example code to run ticcmd in Python” section of the Tic user’s guide.

As far as the speed and acceleration parameters, the Tic does not store separate motion parameters for forward and reverse movements, but you can update the parameters before each of your movements (e.g. using --max-speed NUM, --starting-speed NUM, --max-accel NUM, and --max-decel NUM).

By the way, it sounds like you are saying that you set the current limit to 2A; if that’s the case, please note that the Tic T825 can handle around 1.5A per phase without additional cooling. It might be okay if you’re only using full-steps, since the coils will only energize to around 71%, but I would not recommend increasing it any higher. Additionally, if you want to use microstepping, you should lower the current limit to avoid an over-temperature condition.

Brandon

Thank you for your response and keeping me “honest” regarding the max current rating. I will definitely use that spec. I have yaml running and I can see the 3 motor’s status reliably thanks to your code solution yesterday.

Can you help me regarding the motion param’s?

The load I’m using is very light (2 oz.) on a 10" arm attached attached to the motor with a mounting flange. In order to achieve the highest rotational velocity in 100 steps should I favor acceleration over velocity?

From my reading it seems a position target wants to reach the target with zero velocity. How does the tic settle/stop when using a velocity target?

Also I’ve read that the motor may not reach a high velocity quickly if it is given an immediate step input and a ramp profile helps this. Can you give guidance regarding this?

I’m looking for ideas or possible experiments on the motion commands knowing they are just ideas to explore and not official Pololu statements.

Thank you for your patience.

This is the stepper motor
Amazon.com?

In general, it is difficult to predict what kind of speed you can get from a stepper motor by just looking at the specs since it depends on several factors of your specific setup (i.e. operating voltage, current limit, load on the motor, micro-stepping mode, speed ramping). So, I cannot give you any specific advice for what motion parameters to use. I recommend going through the steps described in the “Configuring and testing the stepper motor” section of the Tic user’s guide to find good values for your stepper motor.

Typically, I recommend looking at the datasheet for your stepper motor, which usually has a pull-out torque curve that you can use to get a general idea of what the motor can do with certain parameters; however, it looks like your motor is rated for 4A per phase, so since you’re running it at much lower than that, it probably wouldn’t be very helpful (the Tic 36v4 would be a better match for your motors). You will likely need to do some trial and error to figure out what works for your application.

Since your range is only 100 steps, you might not have enough time to see a major improvement from ramping the speed up gradually (i.e. the acceleration). Ideally, if your stepper motor can handle it, you can just set the starting speed and maximum speed equal to the speed you want to use, which will cause it to use that speed for the entire duration of the movement with no acceleration (i.e. not ramping up or down, just starting/stopping abruptly). However, as you alluded to, by ramping the speed up, you can typically reach higher speeds. So, you could try setting the starting speed to whatever your motor can handle, then slowly increasing the maximum speed and acceleration settings to see if you can get it any faster.

In either mode (position or velocity), the Tic will respect the starting speed, max acceleration, and max deceleration settings you have configured to approach the new target. So, as it approaches the target in position mode, it will decelerate down to the starting speed before abruptly stopping (at the target position). In velocity mode, the Tic will accelerate or decelerate to the new target (depending on if the target is faster or slower than the current velocity). If you set the target velocity to 0 to stop the motor, it will decelerate down to the starting speed, then abruptly stop.

Brandon

Ok first I will experiment with speed settings and acceleration.
Your last few sentences hit on a point I need clarified. Under position control the tic will ramp down to zero velocity and automatically halt when it reaches target position.

But in velocity mode the tic will keep running keeping constant velocity and does nothing automatically to stop the motor. Is this a correct statement?

Here is what I need to know. All the ways to stop tic in velocity mode:

  1. You mentioned monitoring the current position and then halting. This involves polling the status and I wonder if windows and usb latency issues will create inaccuracies?
  2. I can set up a kill switch or use a limit switch to automatically stop the motor
  3. Determine the amount of time I need for the 100 steps and use the programmable command timeout feature.

Are there other ways to stop the motor automatically or via polling?
Thank you.

Hello.

There are several ways to stop the Tic after sending it a set target velocity command, the most obvious being to send another set target velocity command that sets the velocity to zero or sending one of the halt commands. Triggering kill switch or limit switch (i.e. your option 2) can also stop the motor, though having whatever is attached to the motor hit a limit switch at full speed may not be ideal depending on the speeds and hardware involved.

As for your options 1 and 3, those sound like awkward ways of trying to do position control without using the set target position commands, and I do not expect them to work well. If you want your motor to stop at a specific position, then I recommend you just use the set target position command. If you want to make that motion as fast as possible, then plan on doing some experimentation to find the maximum speed, acceleration, and deceleration values that support that.

- Patrick