Jrk PID learn button

Hi all,

I think you could within a few minutes add a Learn… button to the PID tab in the configuration utility. That is, it would configure your PID for your current application (load). If your PID:s are way off you might damage your Jrk.

It could look like this in the Jrk configurator:

  • user MUST first set limits properly
  • user enters the P (propotional), target current.
  • Jrk configurator will automatically set I (integral) and D (derivative) to zero
  • Jrk configurator will automatically run the motor and look for the best period, look for constant oscillation
  • once best period is found it will set I and D and report: I found this period for the suggested P, the period is ± off. Report good/bad attempt

There could also be a dropdown box of predefined PID charts like:

  • classic
  • Zeiger Nichols
  • Tyreus and Luyben
  • Pressen
  • etc

I made an excel PID tuning chart using typical methods found on the www
http://www.poes-weather.com/~patrik/jrk/

A proto elevation over azimuth antenna rotor using Jrk 12v12:s
http://youtu.be/nDGb-3sB-hk

I feel like it will take quite a bit longer than a few minutes to make that feature. If you’d like, you should be able to make a stand-alone application with those features, by using the Pololu USB SDK.

- Ryan

Hi Ryan,

you should be able to make a stand-alone application with those features…
Yes, will do that. We use linux and at the moment our test Jrk calibration SW looks like this http://www.poes-weather.com/~patrik/jrk/jrk-plot-test.png
Users can get it from github https://github.com/poes-weather/Sensor-Benchmark

Q1: The integral term in the configuration plot, how is it calculated? Your document say The integral is computed as the sum of the error over all PID cycles https://www.pololu.com/docs/0J38/all#3.d. Is it computed in % using the PID period count (read from Jrk), PID period (ms) variable and Integral limit variable. Could you submit the algorithm how the x integral is calculated in the plot.

Q2: How many times can we write to the EEPROM?

Hello, Patrik.

The algorithm for computing the Integral (a.k.a. errorSum) runs once per PID period and it is basically this:

error = scaledFeedback - target
errorSum += error

The pseudocode above doesn’t show the various limits that get applied to the Integral, which are set in the PID tab of the configuration utility.

The Integral is plotted on the graph just like any other variable. The 100% point corresponds to the number in the box to the right of the word “integral”, which is 1000 by default because the default integral limit is 1000.

The datasheet of the jrk’s microcontroller (PIC18F14K50) says that the EEPROM is rated for 100,000 erase/write cycles.

–David

Many thanks David for the answer!

so in the plot the Integral[%] = (errorSum / Integral limit) * 100. Integral limit is the “user scaling factor” in the plot (max 1000). The errorSum is read from the Jrk API variables?

struct jrkVariables
{
    u16 input;             // Offset 1
	u16 target;            // Offset 3
	u16 feedback;          // Offset 5
    u16 scaledFeedback;    // Offset 7  
	s16 errorSum;          // Offset 9
	s16 dutyCycleTarget;   // Offset 11
	s16 dutyCycle;         // Offset 13
    u8 current;            // Offset 15
	u8 pidPeriodExceeded;  // Offset 16
	u16 pidPeriodCount;    // Offset 17
    u16 errorFlagBits;     // Offset 19
	u16 errorOccurredBits; // Offset 21
};

The (linux) calibration software is done! A sloppy video testing feedback accuracy…