Question regarding PID, sensor, and servos.

Hey everyone, I am currently developing a bit more of an outline for a project I am working on and had a few questions...

First, fair warning, I am somewhat inexperienced yet but I am starting school next month to try to supplement some of that, so as to better understand the math and fundamentals of what I am trying accomplish. But in the meantime i have been making good headway on other parts of the larger project and learning arduinos/other aspects better.

Which is just to say, I know this is setting my sights a little high for my level of experience, I just want to get a better idea of things before I get into making an attempt down the road, and I want to know if it at least seems feasible so I don't get started only to come up against a wall.

But basically, I am looking to create a (closed loop) PID controller that will adjust servo motors depending on input from an inclinometer, for a pair of bipedal robot legs. I would imagine this would use 6 motors for the joints, and would likely communicate directly with the PWM (rather than using the servo library) so they could be more finely adjusted using PWM resolution, but aside from the separate concepts of these things I do not understand enough of them to know if my assumptions are correct.

Also, if I were to attempt to make a PID controller, how would I go about getting started/sketching out the details? I know the bulk of it requires calculus in order to use the integral and derivative to compensate for the proportional offset (and I don't understand this level of math yet), so aside from how to figure it out on paper, how would you go about even trying to equate such a different input/output in the code?

Sorry this is a bit of a loaded question, just trying to gather whatever othee information is out there that may help. Thanks!

how would you go about even trying to equate such a different input/output in the code?

What do YOU expect the input to be? How, exactly, does that relate to the output?

Oh alright, yeah I suppose that does make sense as the relationship between the two is the determining factor, so first you would have to define that. Duhh. Thanks!

CatDadJynx:
and would likely communicate directly with the PWM (rather than using the servo library) so they could be more finely adjusted using PWM resolution,

I don't know what you have in mind but I can't see how you could get adjustments that are finer than you get with Sevo.writeMicroseconds()

Plus the question posed by @PaulS.

...R

Robin2:
I don't know what you have in mind but I can't see how you could get adjustments that are finer than you get with Sevo.writeMicroseconds()

Plus the question posed by @PaulS.

...R

Oh alright, I'm not quite familiar enough with the servo library (or servos themselves) to know what would be more accurate, just figured working directly with the PWM would be the most accurate (just seemed to make sense), but I'll definitely keep that in mind, thanks!

And yeah, I had just kind of overlooked that minor detail, initially :stuck_out_tongue_winking_eye: just can't see the forest for the trees sometimes, especially with this stuff cuz I just have a lot to learn yet. But yeah, the relationship between the input and output is the defining factor so I would have to base everything else off of it. Got so hung up on how I would go about doing that that I kind of missed the whole point. But thanks, that will definitely be helpful!

CatDadJynx:
working directly with the PWM would be the most accurate

You still have not explained what you had in mind for "PWM".

The PWM that is produced using analogWrite() is entirely different from the PWM that is used to control servos. It is very unfortunate that the same name is used for both.

...R