Calibration is optional, but it will improve the accuracy of driving maneuvers. This one-time calibration aids the Robot blocks in measuring and correcting distances and speeds, using information from the servo's feedback connection.
The calibration code takes about one minute to collect all of its data. You will need a smooth, and obstacle-free, floor area. While the calibration program is running, the ActivityBot 360° will pivot forward and backward, using only one wheel at a time. It will let you know when it's done by turning off its P26 and P27 lights (below the breadboard). This video shows an ActivityBot correctly performing the calibration.
IMPORTANT! USE FRESH BATTERIES FOR THIS STEP!
What if it didn't work?
If your robot did not move when you started the calibration program, or it started going backward first instead of forward, or if it started and stopped right away or just twitched, then double-check your electrical connections. You may have a servo cable or feedback signal wire plugged in incorrectly.
What if I need to restart or repeat the calibration?
To restart the calibration process, push the reset button any time while the P26 and P27 lights are on.
To repeat the calibration process once it has fully completed, you will need to use BlocklyProp to reload the program. That is because the program modifies itself at the end so that it cannot run a second time, which keeps your ActivityBot from trying to recalibrate the next time you turn power on to load a new program.
Notice that the Robot calibrate block does not have any sockets or plugs for connecting it to other blocks. It is meant to be used by itself without any other blocks in a program, and it takes care of the entire calibration process automatically.
The Robot calibrate block collects requested speed vs. measured speed data and stores it in a part of the Activity Board’s EEPROM memory, where it can retain data even after you turn the power off. That way, the calibration data is available every time you turn the robot back on.
Later, when your project includes Robot blocks that set a certain wheel speed, the underlying code will use the calibration data from EEPROM to start driving the motors at speeds close to what your program asks. That way the code doesn’t have to make large corrections, just small ones, which improves overall accuracy.
Encoders - An encoder converts information from one format to another. The ActivityBot's encoders convert wheel rotation or position into digital information that the Propeller microcontroller can use.
Encoder Ticks are not insects - Throughout this tutorial, you will see the term ticks when used to describe the ActivityBot's wheels turning. In this context, a tick means 1/64th of a wheel revolution. When the wheel makes one complete revolution, it has rotated 64 ticks. We use ticks per second to note how fast the wheels are turning. Ticks can also refer to distance traveled when considering the circumference of the ActivityBot wheel.
Feedback 360° Servo's Internal Encoders - Each Feedback 360° servo has a tiny magnet inside that is attached to the motor shaft. Also inside the servo's case is a Hall-effect sensor, which can detect changes in the position of the magnetic field as the motor shaft rotates. A tiny processor monitors the Hall-effect sensor and sends position information to the Propeller I/O pin. (For more details, see the Feedback 360° Servo product guide [1].)
There is a block that can check the ActivityBot's calibration data and tell you if there are any mistakes or problems with the ActivityBot's servo, encoder, and battery connections. If this test says the calibration was successful, your ActivityBot will be ready to run navigation programs. If not, then it will tell you what problem(s) it detects. After finding and fixing the problem, make sure to run both the calibration and this test again. Your ActivityBot will not be ready for navigation until it is calibrated AND it passes this test!
Now that you have successfully calibrated your ActivityBot 360°, it is time to run a simple test program to make it drive straight forward. The test code below makes both wheels rotate forward at 64 encoder ticks per second for 5 seconds, which should make your ActivityBot roll forward about 1 meter (3 ft.).
Your robot should travel forward for about 1 meter (3 ft.) in a straight line. You may see slight shifts as the robot adjusts its course based on encoder feedback.
The first block is Robot initialize, with the drop-down menu set to ActivityBot 360°. Place this block at the beginning of all projects that use other Robot set or Robot drive blocks.
Next is a Robot drive speed block with the number value 64 attached to both its left and right sockets. This makes both the left wheel and right wheel rotate forward at a rate of 64 ticks per second. The pause 5000 block allows the ActivityBot to drive forward at this rate for 5000 ms (5 seconds). After that, a second Robot drive speed block stops the right and left wheels with the number values 0, 0. We will explore this next.
Links
[1] https://www.parallax.com/downloads/parallax-feedback-360%C2%B0-high-speed-servo-product-guide