KodlabPenn / kodlab_mjbots_sdk

Repo for kodlab SDK for use with mjbots ecosystem
Other
8 stars 7 forks source link

PID controller class #63

Open ethanmusser opened 2 years ago

ethanmusser commented 2 years ago

Feature request for a proportional-derivative (or perhaps proportional-integral-derivative) controller class.

Desired Behavior

Users can utilize the PD/PID controller class for applicable use-cases, or implement their own, more advanced controllers through child classes.

Minimal Proposed Implementation

Desired Features

Later Features

References

This code might be a good jumping-off point for the PID controller.

chandravaran commented 1 year ago

Block_diagram

I was thinking these are the functions and variables that could be in abstract class

ethanmusser commented 1 year ago

Block_diagram

I was thinking these are the functions and variables that could be in abstract class

Some thoughts:

chandravaran commented 1 year ago

So I was thinking there could be times when we want to shift from one controller scheme to another. So in that case we would require to start, run and stop. Which is why I kept these items. If I am not wrong if we were to template the function we would be able to send n number of parameters. Or we could send a vector and then do a check based on the number of parameters. Also we could use a 2-dimensional array that has the names as well.

ethanmusser commented 1 year ago

So I was thinking there could be times when we want to shift from one controller scheme to another. So in that case we would require to start, run and stop. Which is why I kept these items. If I am not wrong if we were to template the function we would be able to send n number of parameters. Or we could send a vector and then do a check based on the number of parameters. Also we could use a 2-dimensional array that has the names as well.

In general, you should definitely start small with this and build up more complicated functionality as you go.

chandravaran commented 1 year ago
ethanmusser commented 1 year ago
  • Sorry missed the Init part, I was thinking that if we were to use different controllers then a separate init would be required. However, I don't if it is required honestly.
  • When I mean by a 2D array, I mean one row will specify the name of the gain and the second row will contain the value. Something like a dictionary in python. Or even 2 1D std:vectors.
  • So if I assume we don't require a hybrid control then Start, Stop, Run are not required correct?
chandravaran commented 1 year ago

I have a question, when I am writing the update function. How would I make it generic to the inputs I can take into the function? Is it possible?

ethanmusser commented 1 year ago

I have a question, when I am writing the update function. How would I make it generic to the inputs I can take into the function? Is it possible?

This question depends on how you have made PIDController. Building on that, generic to what anticipated inputs?

If PIDController is a...

chandravaran commented 1 year ago

I am asking for the update function within the pidcontroller. The number of variables that we give to the update function could vary based on the controller we are using. So I wanted to generalise.

ethanmusser commented 1 year ago

I am asking for the update function within the pidcontroller. The number of variables that we give to the update function could vary based on the controller we are using. So I wanted to generalise.

I would start with SISO and figure out MISO/MIMO implementations later.