Arduino Function: RobotControl.lineFollowConfig

Description

This method changes the parameters for line following. Use this function if line-following is not working as expected, or you want to change the robot's speed while line-following. This function changes the "PD algorithms" that enable to robot to think about what may happen next while line reading. The robot attempts to predict any possible errors on the next reading of the IR sensors, and corrects its movement accordingly by changing the speed of each wheel separately. See the note below for a deeper explanation.

Syntax

Robot.lineFollowConfig(KP,KD,robotSpeed,intergrationTime)

Parameters

KP : int, proportional gain *KD : int, derivative gain *integrationTime: int, delay time between each time we run the algorithm in ms *robotSpeed: int, between 0 and 100, indicating the percentage speed of motors.

Examples

#include 
long timer;

void setup(){
 Robot.begin();
 Robot.beginLCD();
 delay(3000);

 Robot.lineFollowConfig(11,5,50,10);//set PID parameters
 Robot.setMode(MODE_LINE_FOLLOW);
 timer=millis();
 while(!Robot.isActionDone()){
   //pauses line-following for 3 seconds every 5 seconds
   if(millis()-timer>=5000){
     Robot.pauseMode(true);
     delay(3000);
     Robot.pauseMode(false);
     timer=millis();
   }
   Robot.debugPrint(millis());
 }
 Robot.text("Done!",0,10,true);
 while(true);

}
void loop(){
}


Based on the reference originally written by Arduino Community,  wiring.org.co and  arduino.cc