I'm working on a robot with differential drive (2 drive wheels equipped with rotary encoders and 4 free spinning omni wheels for stability) and each wheel is controlled via a separate arduino nano.
I have implemented two PID loops, one for position control and one for speed control (first one gets a position in number of pulses and second gets an RPM as their goals).
The position PID works fine by produces jerky motion and acts more like a "bang bang" control where it starts at full speed. I'm not sure how I can combine these to plan a move that reaches a certain number of pulses with a given maximum acceleration and / or velocity.
I know 3D printers for example, have settings for jerk,acceleration and velocity so I tried to go through marlin to see how that's implemented but I had no luck! Can anyone please provide examples or links to tutorials / papers regarding this?
I think an easy solution would be pre calculating the motion profile and then tracking it with the position PID, but I'm not sure if there are better solutions for this.