Position P-Gain Wrong in Manual?

Questions about using encoders with the Roboclaw product line
Posts: 1
Joined: Tue Jul 18, 2017 9:33 am

Position P-Gain Wrong in Manual?

Postby Atrer » Thu Aug 02, 2018 3:54 pm

I'm writing custom code for control of the roboclaw using PID.

According to the manual, sending the Velocity PID values over UART should be ordered as DPI

Send: [Address, 61, D(4 bytes), P(4 bytes), I(4 bytes), MaxI(4 bytes),
Deadzone(4 bytes), MinPos(4 bytes), MaxPos(4 bytes), CRC(2 bytes)]

This works when setting the velocity values. P=1, I=0, D=0 sent as 0-1-0 gives movement.

Position PID does not behave this way. Sending P=1, I=0, D=0 as 0-1-0 results in no movement. *However* sending 0-0-1 does. Is the 'P' gain parsed from the wrong spot in the UART control?

It's my understanding that the only PID gain that is required is 'P' and you will always get movement of some sort if you have 'P' set to a value but 'I' and 'D' set as 0. Thus logically 'P' is for position is not where it is supposed to be.

Am I misunderstanding something? Or does position control with P=0, I=1, D=0 actually work where P=1, I=0, D=0 does not?

User avatar
Basicmicro Support
Posts: 965
Joined: Thu Feb 26, 2015 9:45 pm

Re: Position P-Gain Wrong in Manual?

Postby Basicmicro Support » Mon Aug 06, 2018 9:01 am

1. Position PID settings packet order is address, command, D, P and then I in that order, then the remaining arguments follow.

2. Setting a value in I but nothing else will garauntee some movement at some point(The integral will eventually wind up enough to cause movement).

3. Settinga P of 1 wont necessarilly cause movement. It WILL cause some PWMing but that may not be enough to cause the motor to move. Note P values are using in the thousands on a properly tuned motor. So a P of 1 is very low.

If you are manually tuning you should follow the description in the manual. Keep increasing P until the motor starts to oscillate instead of settling to a stop at some point. When you reach that point on P set P to 2/3rds that value. Then set I to 1/10th the P value and retest. Increase/Decrease I as needed. D may need to be mixed in while adjusting I to compensate for I induced oscillation.

That is assuming you are tuning for a Position PID. In general I recommend tuning for a PI-P cascaded velocity/position controller if you are using a quadrature encoder. PI tuning for velocity is easy and then only an appropriate position P is required which you can increment through until you are happy with the control response.

Return to “Velocity and Position Control”

Who is online

Users browsing this forum: No registered users and 0 guests