![]() |
Smart Car Controller
1.0
Library to manage a two wheeled robotic vehicle (DC Motors)
|
The next step is to use the Calibrate example sketch to determine configuration parameters and store them permanently in EEPROM.
Calibrate allows the vehicle motors to be controlled through the Serial Monitor using a command line interface (CLI) to invoke test the functions (type ? for help text listing the functions).
Whilst setting parameters, it is a good idea to save parameters to EEPROM using the CLI on a regular basis. The saved parameters can be reloaded from EEPROM at any time - useful when a change has created an unviable set of parameters.
The drive() method initiates PID speed control of the motors. This may include speeds that are less than the minimum needed to rotate the motor from a standing start.
For low speeds and a standing start, the kicker PWM is set as the initial speed for a short time to 'unstick' the motor before the actual (lower) speed is set. The kicker PWM should be set slightly higher than the PWM value found when setting up the motors.
The move() function allows precise movements at this predefined PWM setting. The setting is a compromise that needs to be fine tuned by experimentation, and should
The control limits are the lowest and highest outputs allowed by the PID controller. The lower limit should have been noted in the first step, using MotorTest. The lower limit should also be less than either the kicker or move() PWM settings.
The upper limit will generally be set at 255 (the maximum) unless there is some other reason to make it lower.
Next: Tuning PID Parameters