Current state of the Robot C PID


We are using version 4.26 of Robot C and we notice the features for the built-in PID and also the drive motor specification in the “Motors and Sensors” tab. Where can I find documentation of these features- a search of these forums pointed to an old Wiki page that is no longer maintained…

Thanks in advance,

Ravi

Anyone…

Here is what I remember from the last time I looked into this several months ago.

PID was working, the motor control value is not directly coupled to the motor pwm value, that is, sending 127 to the motor does not allow it to run full speed, a certain amount of headroom is allowed so the motor speed can be increased as well as decreased.

Sending a motor to a target location was working, there were some bugs when reseting encoders.

PID could not be turned on and off in the program, once it was set on you could not turn it off. Using PID when in driver control made the robot hard to control, so although it was useful in autonomous, you were stuck using it for the rest of the match. This was a show stopper at that time.

I heard that this functionality was mainly aimed at standalone autonomous programs used in a classroom setting but it may have been quietly improved, it needs re-evaluating.

Why don’t you just try it out and report back to us all.

Hey Guys,

Here’s some responses to your Q’s.

With the addition of the Graphical Programming Interface with ROBOTC (as of 4.28 BETA), we’ve enhanced the PID to make it more reliable. I don’t know where the help docs went for these pages, but we’re in the process of restoring them.

This bug regarding setting multiple target locations has been resolved. There was a bug in the firmware where the PID was being thrown off when motor speeds + targets were being changed simultaneously. This should be resolved as of 4.28 BETA.

You can dynamically turn PID on and off in your program by using the following commands:

nMotorPIDSpeedCtrl[port1] = RegSpeed; //PID Enabled
nMotorPIDSpeedCtrl[port1] = RegIdle; //PID Disabled

Setting a “move to target” command will automatically turn the regulation to “RegPosition”, but it’ll return to “Speed” or “Idle” after completing the movement.

Like I said, we’re in the process of updating the docs on the PID stuff with the enhancements made in 4.28 BETA, so as soon as we have those finished, we’ll post them and include them in the next release.

Thanks!

Do you know if there is a way to see the motor power being applied to the motor via the built in pid control in robot c 4.0?

Ive got 2 motors geared together and was wondering if I could just apply the same correction to both of them, if I only have 1 encoder for the 2.

I believe what you are looking for is actually the function slaveMotor.
void slaveMotor(tMotor nSlaveMotor, tMotor nMasterMotor)