Deutsch English ; |
What to do if the robot does not move in a straight line?
The disadvantage of low-cost robots is that they often lack precision. Some robots move exactly straight ahead when the forward() command is given, some tend to make a left turn, others a right turn. With the command
calibrate(offset, differential, arcScaling)
you can calibrate the robot more precisely. The calibrate() function requires three parameters, which are set to 0 by default.
offset (Range: (-10, 50)). Minimum power of the motors. Depending on the state of charge of the battery)
differential (Range: (-150, 150)). Controls the left or right-hand twist. If the robot tends to travel on a left-hand bend with the forward() command, a negative value must be selected. If the robot tends to move in a right-hand arc when the forward() command is given, a positive number must be selected.
arcScalling (Range: (-50, 50)). Calibrates the robot when travelling on a left or right arc (commands leftArc(radius) and rightArc(radius)) Positive value if the robot radius is too large, negative value if the robot radius is too small.
Example 1: Calibration when travelling straight ahead
Callibration with left-hand twist | Callibration with right-hand twist |
from mbrobot import * calibrate(0, -15, 0) forward() delay(4000) stop() |
from mbrobot import * calibrate(0, 20, 0) forward() delay(4000) stop() |
Example 2: Adjusting the radius by leftArc() and rightArc()
Callibration if the radius of the robot is greater than 20 cm |
from mbrobot import * calibrate(0, 0, 10) leftArc(0.2) delay(4000) rightArc(0.2) delay(4000) stop() |
You must determine the size of the parameters for your robot by trial and error and insert the line calibrate() in all programmes in which you want to achieve more precise movement.
If you are working with mbRobot Plus V2, you must use the import line from mbrobot_plusV2 import *.