Joined: Thu Jan 19, 2012 2:00 pm
HiTechnic Motor/Controller PID - Very Strange Behavior
Anomalies observed using these motors with encoders and the HiTechnic motor controller.
1. Using the motors in PID control mode, they seemed "twitchy" when stopping at an encoder target..
#pragma config(Motor, mtr_S1_C1_1, RMotor, tmotorNormal, PIDControl, encoder)
#pragma config(Motor, mtr_S1_C1_2, LMotor, tmotorNormal, PIDControl, reversed, encoder)
2. When using the command for coast vs brake when stopped, it didn't seem to make anything "smoother" when stopping.
bFloatDuringInactiveMotorPWM = true ; // True = Coast, False = Brake
3. When using the command for setting the maximum speed down a bit, things got even "stranger".
nMaxRegulatedSpeed12V = 800 ; // set the max Encoder Counts/Second (PID Motor speed regulation)
After using this command, when starting up for an encoder target, the motors seemed to start near the maximum speed, then would slow down to the 800 maximum, with the majority of the distance being at the 800 max. When nearing the end (when PID kicks in to slow down to a stop), the motor would actually SPEED UP to the original max speed and then slow down, instead of slowing down from the 800 max we were running.
4. When setting nMaxRegulatedSpeed12V back to the 1000 setting that the documentation claims is the default value, I could not get to the original full speed the motors originally had. I tried 0, 1000, 1200 and 2000 but had to use 5000 to get my original full speed back, and even then it seems like my motor speed maximum is slower (even with a new battery) than it used to be.
Questions (matching above numbering):
1. Anyone experiencing the twitchy behavior and come up with a way to smooth it out?
2. I have let the system use the Brake method (default) and expected that Coast would make things more twitchy. Has anyone had better performance using Coast for smoother driving? I expected it would be less smooth in Coast mode...
3. I think there is either a bug in RobotC or the HiTechnic controllers and the PID algorithm. If you have an encoder-target distance to travel, and you use the nMaxRegulatedSpeed12V command, do you get the same "fast-regulated-fast" behavior I see? I thought that the PID control is in the HiTechnic controller, but perhaps RobotC is doing the PID and has a bug in it that makes it not honor the regulated speed command properly?
4. Is there a way to "reset" the controller to factory? Is there firmware updates for the motor controller that I need to apply? Is the documentation for this command correct? How does one "disable" the effect of the speed regulation and restore "full speed/unregulated" speed like I had before I used this? Power-cycling doesn't seem to clear it up, code to set it higher doesn't seem to resolve the issues of running slower.
Any advise would be most welcome, FTC competition is in 5 days...