1

I am trying to use a PID controller to achieve a target FPS and Latency. For the PID controller, I used https://github.com/tekdemo/MiniPID.

This is how I set it up in a while loop:

    while(true){
    /* Create the command with all the given values.*/
    char Run_Command[150];
    sprintf(Run_Command,
            "./%s --threads=4 --threads2=2 --target=NEON --n=%d --partition_point=%d --partition_point2=%d --order=%s > output.txt",
            graph.c_str(), N_Frames, PartitionPoint1, PartitionPoint2,
            Order.c_str());
    /* Run the command and parse the results.*/
    system(Run_Command);
    ParseResults();

    /* Both Latency and Throughput Requirements are Met.*/
    if ( FPSCondition && LatencyCondition ){
        printf("Solution Was Found.\n TargetBigFrequency:%d \t TargetLittleFrequency:%d \t PartitionPoint1:%d \t PartitionPoint2:%d \t Order:%s\n",
        BigFrequencyTable[BigFrequencyCounter],LittleFrequencyTable[LittleFrequencyCounter], PartitionPoint1, PartitionPoint2, Order.c_str());
        break;
    }
    printf("Target Perfromance Not Satisfied\n\n");

    /* Get the output of the PID. */
    double output_FPS=pid.getOutput(Sensor_FPS, Target_FPS);
    double output_Latency=pid.getOutput(Sensor_Latency, Target_Latency);

    /* Do something with the output of the PID. */

}

I don't understand what the output of the PID controller indicates, and how I can use it to transition towards my target FPS and Latency.

the Tin Man
  • 158,662
  • 42
  • 215
  • 303
KazeKoda
  • 11
  • 3
  • `PID controller to achieve a target FPS and Latency.` How is "target FPS and latency" _controlled_? ` I set it up` What is "it"? Please explain the context. What are you trying to do? What are you running? What do you want to achieve? How it all is related to "target FPS and latency"? PID controller controls one thing via one input. Are FPS and latency separate measurements? – KamilCuk Jan 22 '22 at 12:51
  • Overall, are you trying to _optimize_ or _control_ ? If you want to control, for example, the level of water in a tank, then you use a PID controller. If you try to _optimize_ an algorithm - find a minimum/maximum/extrema in a space of outputs values, that's _a completely_ different set of algorithms.. I.e. does external stuff affects the "FPS and latency" and you need to "control" the values so they are within some range at all times? Or do you want to _find_ (not control! "find") the best arguments for some command? – KamilCuk Jan 22 '22 at 13:02
  • I get a Target FPS and Target Latency (e.g. 10 FPS and 160ms). What I run is a CNN which returns an FPS value rate and a latency value (e.g. 5 FPS and 220ms), with the settings I have. Now I want to use the PID controller to move towards the target values by changing the settings (e.g. frequency or partition points). What I don't understand is how to use the PID controller to achieve the settings which will provide me the target FPS and Latency. Does this make it understandable? – KazeKoda Jan 22 '22 at 13:15
  • Does MiniPID support multidimensional values? The standard PID is one value is controlled and one is read back. And you can set a target for the value read back. But there are PID controllers with multidimensional values. – Sebastian Jan 22 '22 at 15:27
  • The official term is multivariable PID control. – Sebastian Jan 22 '22 at 15:36
  • Thanks for the information, I will try to find out more about that. – KazeKoda Jan 22 '22 at 23:11

0 Answers0