Motion Studio - Auto-Tune PID crashes app

General discussion of using Roboclaw motor controllers
Post Reply
evangifford
Posts: 19
Joined: Tue Jun 09, 2020 11:32 am
Motion Studio - Auto-Tune PID crashes app

Post by evangifford »

Hello,

Motion Studio 1.0.0.64

I'm using a SOLO 30A with a 600 PPR A/A Encoder with microswitch endstop on S3.

After trying multiple times with multiple PCs and SOLOs, I have always experienced the same problem
when trying to auto-tune PID (Velocity or Position) - it has never completed.

Encoder works fine and has never been a problem.

Expected Behavior:

Pressing Auto-Tune PID, the wheel/encoder will perform a series of movements and update the P I D fields with the calculated values.

Actual Behavior:

Pressing Auto-Tune PID, the wheel/encoder do perform a series of movements, then the motor goes in one direction - indefinitely - and the application freezes. This state requires a power-cycle of the SOLO and a force quit of the application.

Restarting the application, the P I D values are at default value - so the auto-tune failed.
User avatar
Basicmicro Support
Posts: 1594
Joined: Thu Feb 26, 2015 9:45 pm
Re: Motion Studio - Auto-Tune PID crashes app

Post by Basicmicro Support »

Did you reverse you encoder channels to see if that was the problem? If not do so and retry autotuning. Note that when moving the motor using the PWM Settings screen when you move the motor slider up the encoder value should increase as the motor turns. When you move the motor slider down from center the encoder value should decrease as the motor turns.

The other likely cause is USB is glitching. Depending on the Motor noise from the motor could be the cause.

Autotuning doesn't work in all cases so you may have to manually tune it. If you need help with that just call us.
evangifford
Posts: 19
Joined: Tue Jun 09, 2020 11:32 am
Re: Motion Studio - Auto-Tune PID crashes app

Post by evangifford »

Yes, you're right - the encoder channels needed to be reversed in my application for it to complete.

I didn't realize the PID would be sensitive to the direction - it seems like it would be able to figure that out based on the increment/decrementing of the encoder.

It's not great that this crashes the app with no error though, leaving a noob like me bewildered that a cool feature just plain didn't work.

A message "encoder channels are not in the same direction as motors" would be great!
User avatar
Basicmicro Support
Posts: 1594
Joined: Thu Feb 26, 2015 9:45 pm
Re: Motion Studio - Auto-Tune PID crashes app

Post by Basicmicro Support »

The Autotuner does try to determine the direction. It could be your encoders are noisy. Had a customer with that problem the other day. He needed to add filtering to the encoder channels. This applies to hall sensor encoders. Add .01uf capacitors from each encoder line to gnd.

It isnt that the app crashed, its that the autotuner never finished. We need to add a timeout to the autotuner. Currently it will just keep trying, forever.
Joe
Posts: 34
Joined: Fri Dec 23, 2016 1:00 am
Re: Motion Studio - Auto-Tune PID crashes app

Post by Joe »

I can confirm the unexpexted behavior of Motion Studio (curr. version, Win10).
In my case it applies only to motor2. Motor direction is ok but after autotuning M2 Motion Studio crashes and a power cycle of Roboclaw 2x30 is needed.
In an earlier version of Motion Studio it worked without any problems.

I also noticed some crashes when I tried to manually enter values in the position PID fields particularly in the Max Pos field (e.g. 500000).
User avatar
Basicmicro Support
Posts: 1594
Joined: Thu Feb 26, 2015 9:45 pm
Re: Motion Studio - Auto-Tune PID crashes app

Post by Basicmicro Support »

If the Autotuner doesn't get the values it wants it will just keep trying which will cause the UI to freeze(technically it freezes the UI while autotuning always, but it happens fast enough no one notices). I/ve have made a note to address this in the next firmware update.

On the other, can you remember which edit boxes you were entering value into that cause a freeze. Every edit box has a range setting which will through an exception if a value outside the range happens. Each should be handled by an exception handler that changes the text to red indicating an error. It sounds like at least one field may not be linked to the exception handler properly. It is probably an easy fix but having an idea which edit box it was would be helpful.
Joe
Posts: 34
Joined: Fri Dec 23, 2016 1:00 am
Re: Motion Studio - Auto-Tune PID crashes app

Post by Joe »

I did some more tests and I now I think that the values in the fields are not responsible for the application crashes. It's more as you said that autotune never finishes. The result is that the app is not responding anymore and you need a power cycle of the Roboclaw and restart Motion Studio.
What I don't understand is that velocity PID autotune works and also calculates an acceptable QPPS value but if you change the screen to the position settings the QPPS is set to 0 again (other as shown in your Youtube autotune video). Also adding manual position PID settings won't lead to success. But for that I will open a new thread because I don't want to hijack this thread.
User avatar
Basicmicro Support
Posts: 1594
Joined: Thu Feb 26, 2015 9:45 pm
Re: Motion Studio - Auto-Tune PID crashes app

Post by Basicmicro Support »

Each autotuner function measures QPPS and then runs the autotune function. You no longer need to enter tha QPPS values before starting. It will be overwritten.

The Position Autotuner also run s a velocity autotune if you have it set to PIV which will overwrite your velocity tuned settings if you had previously tuned velocity.

Manual tuning always leads to success IF you set the right values. :)

Note that isnt actually true. A truely non-linear load can not be tunes. But those are very rare. In most cases you can get a reasonably tuning manually. If you use cascaded settings(PIV) then its usually very easy to tune.

In your case if you are getting a good velocity tune, then all you have to tune manually is the Position P value.

In that case the steps are:

1. In Velocity Settings, Autotune velocity.
2. Change to Position Settings screen. Do NOT run Position Autotuner.
3. Set the min and max Position values. Use the PWM settings screen to manually determine these values if you havent already.
4. Set the Position P values to a low number. Move Motor slider. The motor should move toward the target position(assuming you have the motor direction and encoder direction wired correctly(double check that using PWM settings screen as well).
5. If the motor moves toward the position but doesnt reach the target or reaches it slowly, increase Position P value. If the Motor moves toward and overshoots the target, reduce the P value.
6. Move motor slider to a new position and observe results. Repeat 5 until you are happy with the control.
User avatar
Basicmicro Support
Posts: 1594
Joined: Thu Feb 26, 2015 9:45 pm
Re: Motion Studio - Auto-Tune PID crashes app

Post by Basicmicro Support »

I've used that same model even that gear ratio and autotuning always worked well for me.

What do you have mounted to the motor?
What is your power source?
Make sure you are using the latest Motion Studio version.

Do you have a second motor to test? If so what are the results.
In some cases you may need to add .01uf capacitors from each encoder wire to ground. This usually doesnt affect autotuning to the point of failure but some of these motors(most in fact) allow noise to bleed into the encoder signal lines. If this gets to be too much it is possible this could be causing the autotune problem.

Lastly try uninstalling and reinstalling Motion studio, forcing a firmware update and clicking the Restore defaults setting in the Device menu to set everything back to factor settings.

Post Reply